www.gusucode.com > trading工具箱matlab源码程序 > trading/tradingdemos/TTPriceUpdateExample.m
%%X_TRADER Price Update example % Copyright 2011-2012 The MathWorks, Inc. %Start or connect to X_TRADER x = xtrdr; %Create event notifier x.createNotifier; %Create an instruments x.createInstrument('Exchange','CME','Product','ES','ProdType','Future','Contract','Mar15','Alias','PriceInstrument1'); %Attach instruments to a notifier x.InstrNotify(1).AttachInstrument(x.Instrument(1)); %Define events x.InstrNotify(1).registerevent({'OnNotifyFound',@(varargin)ttinstrumentfound(varargin{:})}) x.InstrNotify(1).registerevent({'OnNotifyNotFound',@(varargin)ttinstrumentnotfound(varargin{:})}) x.InstrNotify(1).registerevent({'OnNotifyUpdate',@(varargin)ttinstrumentupdate(varargin{:},x)}) %Set the update filter to monitor only desired fields x.InstrNotify(1).UpdateFilter = 'Last$,LastQty$,~LastQty$,Change$'; %Listen for event data x.Instrument(1).Open(0);