www.gusucode.com > trading工具箱matlab源码程序 > trading/trading/@fixflyer/addListener.m
function listener = addListener(f,cb) %ADDLISTENER Add listener to FIX Flyer object. % L = ADDLISTENER(F,CB) adds the event handling listener, CB, to the % FIXFlyer object, F. L is the listener handle. % % For example, % % f = fixflyer('guest','guest','127.0.0.1',7002); % listener = addListener(f,@(~,e)fixExampleListener(e)); % f.SessionID = flyer.core.session.SessionID('Alpha','Beta','FIX.4.4'); % f.FlyerApplicationManager.registerFIXSession( flyer.apps.FixSessionSubscription(f.SessionID,true,0)); % f.FlyerApplicationManager.connect(); % f.FlyerApplicationManager.start(); % % Note the input e to the function handle represents the event data % that is generated by the FIXFlyer API and does not need to be % defined by the user. % Copyright 2015 The MathWorks, Inc. % Instantiate class with ApplicationMessageListener implementation t = tradingFIXFlyer; % Assign callback function to listener handle listener = addlistener(t.getCallback,'delayed',cb); % Assign listener to FIX Flyer application t.addListener(f.FlyerApplicationManager)