Beispiel #1
0
        /// <summary>
        ///     Добавляет подписку на заданный тип сообщения по заданному счету.
        /// </summary>
        /// <param name="account">
        ///     Номер счёта.
        /// </param>
        /// <param name="subscriptionType">
        ///     Тип сообщения.
        /// </param>
        public void RequestSessionData(string account, SubscriptionType subscriptionType)
        {
            switch (subscriptionType)
            {
            case SubscriptionType.MoneyPosition:
                if (Limits.ContainsKey(account))
                {
                    OnMessageReceived(Limits[account]);
                }

                break;

            case SubscriptionType.Position:
                if (Portfolios.ContainsKey(account))
                {
                    foreach (var position in Portfolios[account].Values)
                    {
                        OnMessageReceived(position);
                    }
                }

                break;

            case SubscriptionType.Fill:
                if (Fills.ContainsKey(account))
                {
                    foreach (var fill in Fills[account].Values.SelectMany(list => list))
                    {
                        OnMessageReceived(fill);
                    }
                }

                break;

            default:
                Logger.Warn().Print($"Requested session data on account {account} of type {subscriptionType}.");
                break;
            }
        }