www.gusucode.com > trading工具箱matlab源码程序 > trading/tradingdemos/ttorderserverstatus.m
function ttorderserverstatus(varargin) %ttorderserverstatus X_TRADER onExchangeStatusUpdate example listener % Copyright 2011-2012 The MathWorks, Inc. persistent nOrderServerCount %varargin{7} has exchange information with order server status %varargin{end} has the instrument exchange sEvent = varargin{7}; sInstrumentExchange = varargin{end}; if strcmpi(sEvent.sExchange,sInstrumentExchange) && strcmpi(sEvent.sText,'Order') if sEvent.bOpened && sEvent.bServerUp evalin('base','bServerUp = true;') else if isempty(nOrderServerCount) %Wait for second instance to make sure Order Server is up nOrderServerCount = 1; else evalin('base','bServerUp = false;') end end end