示例#1
0
        /// <summary>
        /// Dispose resources
        /// </summary>
        public override Task Disconnect()
        {
            Unsubscribe();

            StateStream.OnNext(StatusEnum.Disconnection);

            Gateways.ForEach(o => o.Disconnect());
            Gateways.Clear();
            Charts.Clear();

            _connections.ForEach(o => o.Dispose());
            _connections.Clear();

            return(Task.FromResult(0));
        }
示例#2
0
        /// <summary>
        /// Set initial state
        /// </summary>
        public override Task Connect()
        {
            Disconnect();
            OnLoad();

            StateStream.OnNext(StatusEnum.Connection);

            foreach (var gateway in Gateways)
            {
                _connections.Add(gateway);

                gateway.Account.Instruments.ForEach(o => o.Value.Account = gateway.Account);
                gateway.Account.Gateway = gateway;
                gateway.Connect();
            }

            return(Task.FromResult(0));
        }