示例#1
0
        void UpdateAccounts()
        {
            OrderExecutionSourceStub stub    = _stub;
            FXCMConnectionManager    manager = Manager;

            if (stub == null || manager == null)
            {
                return;
            }

            // The newly produced accounts have no Guids.
            List <AccountInfo> accounts = manager.GetAvailableAccounts(IntegrationAdapter.AdvisedAccountDecimalsPrecision);

            foreach (AccountInfo info in accounts)
            {// Update / insert accounts.
                AccountInfo actualInfo = info;

                AccountInfo?existingInfo = stub.GetAccountInfo(info.Id);
                if (existingInfo.HasValue == false)
                {// New info, assign a Guid.
                    actualInfo.Guid = Guid.NewGuid();
                }
                else
                {
                    actualInfo.Guid = existingInfo.Value.Guid;
                }

                stub.UpdateAccountInfo(actualInfo);
            }
        }