如何使用ConnectionStatusEx查询、监控行情和交易的连接状态?
使用ConnectionStatusEx
查询、监控行情和交易的连接状态,具体用法见示例一:
示例1:使用ConnectionStatusEx
查询、监控行情和交易的连接状态
using tsdata.common;
vars:tsdata.common.ConnectionStatus CSE(null);
method void AnalysisTechnique_Initialized( elsystem.Object sender, elsystem.InitializedEventArgs args )
vars:int loop;
begin
CSE = new ConnectionStatus;
CSE.MarketDataUpdated += CSE_MarketDataUpdated;
CSE.TradingUpdated += CSE_TradingUpdated;
print(CSE.MarketDataState.ToString());
print(CSE.TradingState.ToString());
end;
Method void CSE_MarketDataUpdated(elsystem.Object sender,tsdata.common.MarketDataStateUpdatedEventArgs args)
Begin
print("MarketDataUpdated:",args.NewState.ToString());
End;
Method void CSE_TradingSingleConnectionStateUpdated(elsystem.Object sender,guosen.TradingSingleConnectionStateUpdatedEventArgs args)
Begin
print("TradingSingleConnectionStateUpdated:",args.AccountID," ",args.NewState.ToString());
End;
Method void CSE_TradingUpdated(elsystem.Object sender,tsdata.common.TradingStateUpdatedEventArgs args)
Begin
print("TradingUpdated:",args.NewState.ToString());
End;