www.gusucode.com > trading工具箱matlab源码程序 > trading/tradingdemos/ttpricelistupdate.m

    function ttpricelistupdate(varargin)
%TTPRICELISTUPDATE X_TRADER onPriceListUpdate sample listener

%   Copyright 2011-2012 The MathWorks, Inc.

%varargin{1} if the Notifier object
pNotify=varargin{1};

%Get the price list object
priceList = pNotify.PriceList;

%Use Count property and Item method to parse price list update data
for i = 1:priceList.Count
  priceUpdate = priceList.Item(int32(i));
  for j = 1:priceUpdate.Count
    priceEntry = priceUpdate.Item(int32(j));
    switch priceEntry.PriceID
      case 'ttLastTradedPrice'
        disp(['Last Price: ' num2str(priceEntry.toDouble)])
      case 'ttLastTradedQty'
        disp(['Last Qty: ' num2str(priceEntry.toDouble)])
        disp(' ')
      case 'ttTotalTradedQty'
        disp(' ')
        disp(['Total Trade Volume: ' num2str(priceEntry.toDouble)])
      otherwise
        disp([priceEntry.PriceID ' ' num2str(priceEntry.toDouble)])
    end
  end
end