public void Init(ServerInfoField server, UserInfoField user) { if (Api != null) { return; } if (!CheckSettings(server, user)) { return; } _queryManager = new CtpQueryManager(this); _processor = new CtpDealProcessor(this); User = user; Server = server; Api = new CtpTraderApi(GetFlowPath(server, user)); InitHandler(); var items = server.Address.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in items) { Api.RegisterFront(item); } Api.SubscribePrivateTopic(CtpConvert.GetCtpResumeType(server.PrivateTopicResumeType)); Api.SubscribePublicTopic(CtpConvert.GetCtpResumeType(server.PublicTopicResumeType)); _publisher.Post(ConnectionStatus.Connecting); Api.Init(); }
public void Release() { if (Api != null) { Connected = false; Api.Release(); _queryManager.Close(); _queryManager = null; _processor.Close(); _processor = null; Api = null; } }
public void Release() { if (api != null) { _publisher.Post(ConnectionStatus.Releasing); _queryManager.Close(); _queryManager = null; Connected = false; api.Release(); api = null; _processor.Close(); _processor = null; _publisher.Post(ConnectionStatus.Disconnected); } }