BasicallyMe.RobinhoodNet.NewOrderSingle.ToDictionary C# (CSharp) Метод

ToDictionary() приватный Метод

private ToDictionary ( ) : string>.IDictionary
Результат string>.IDictionary
        internal IDictionary<string, string> ToDictionary()
        {
            var d = new Dictionary<string, string>();
            d.Add("account", this.AccountUrl.ToString());
            d.Add("symbol", this.Symbol);
            d.Add("instrument", this.InstrumentUrl.ToString());

            if (this.TimeInForce == TimeInForce.GoodForDay)
            {
                d.Add("time_in_force", "gfd");
            }
            else if (this.TimeInForce == TimeInForce.GoodTillCancel)
            {
                d.Add("time_in_force", "gtc");
            }

            d.Add("trigger", this.Trigger.ToString().ToLowerInvariant());
            d.Add("type", this.OrderType.ToString().ToLowerInvariant());
            d.Add("side", this.Side.ToString().ToLowerInvariant());
            d.Add("quantity", this.Quantity.ToString());

            if (this.Price.HasValue)
            {
              d.Add("price", this.Price.Value.ToString());
            }

            if(this.StopPrice.HasValue)
            {
              d.Add("stop_price", this.StopPrice.Value.ToString());
            }

            return d;
        }

Usage Example

Пример #1
0
        PlaceOrder(NewOrderSingle newOrderSingle)
        {
            var json = await _rawClient.PlaceOrder(newOrderSingle.ToDictionary()).ConfigureAwait(false);

            return(new OrderSnapshot(json));
        }
All Usage Examples Of BasicallyMe.RobinhoodNet.NewOrderSingle::ToDictionary