Esempio n. 1
0
        void PlatformSourceOrderExecutionProvider_OperationalStateChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            if (OperationalState == OperationalStateEnum.Operational && _accounts.Length == 0)
            {
                if (base.SubscribeToAccounts() == false)
                {
                    SystemMonitor.Error("Failed to subscribe to source. Further operations will not proceed as expected.");
                }

                AccountInfo[] accountInfos;
                if (base.GetAvailableAccountInfos(out accountInfos) && accountInfos.Length > 0)
                {
                    lock (this)
                    {
                        _accounts = new Account[accountInfos.Length];
                        for (int i = 0; i < accountInfos.Length; i++)
                        {
                            _accounts[i] = new RemoteExecutionAccount(accountInfos[i]);
                            _accounts[i].SetInitialParameters(_manager, this, _manager.GetDataDelivery(_dataSourced));
                            _accounts[i].Initialize(this);
                        }

                        if (_accounts.Length > 0)
                        {
                            _defaultAccount = _accounts[0];
                        }
                        else
                        {
                            _defaultAccount = null;
                        }
                    }
                }
                else
                {
                    SystemMonitor.Warning("Failed to establish accounts (default account) on Order Execution Provider.");
                }
            }
        }
        void PlatformSourceOrderExecutionProvider_OperationalStateChangedEvent(IOperational operational, OperationalStateEnum previousOperationState)
        {
            if (OperationalState == OperationalStateEnum.Operational && _accounts.Length == 0)
            {
                if (base.SubscribeToAccounts() == false)
                {
                    SystemMonitor.Error("Failed to subscribe to source. Further operations will not proceed as expected.");
                }

                AccountInfo[] accountInfos;
                if (base.GetAvailableAccountInfos(out accountInfos) && accountInfos.Length > 0)
                {
                    lock (this)
                    {
                        _accounts = new Account[accountInfos.Length];
                        for (int i = 0; i < accountInfos.Length; i++)
                        {
                            _accounts[i] = new RemoteExecutionAccount(accountInfos[i]);
                            _accounts[i].SetInitialParameters(_manager, this, _manager.GetDataDelivery(_dataSourced));
                            _accounts[i].Initialize(this);
                        }

                        if (_accounts.Length > 0)
                        {
                            _defaultAccount = _accounts[0];
                        }
                        else
                        {
                            _defaultAccount = null;
                        }
                    }
                }
                else
                {
                    SystemMonitor.Warning("Failed to establish accounts (default account) on Order Execution Provider.");
                }
            }
        }