public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { if (value == null) { throw new ArgumentException("Unable to write null OrderDuration to Json.", "value"); } OrderDuration duration = value as OrderDuration; StringBuilder text = new StringBuilder(64); if (duration != null) { text.Append(duration.Code.ToString()); if (duration.Expiration.HasValue && duration.Expiration > DateTime.MinValue) { text.AppendFormat(" - {0}", ((DateTime)duration.Expiration).ToShortDateString()); } } // caller will already write the start object and property name writer.WriteValue(text.ToString()); /* * writer.WriteStartObject(); * writer.WritePropertyName("Duration"); * writer.WriteValue(text.ToString()); * writer.WriteEndObject(); */ }
public bool Equals(OrderDuration token) { return(this == token); }
public bool Equals(OrderDuration token) { return this == token; }
public static OrderRequest GetOrderRequest(int accountKey, AssetType assetType, OrderDuration duration, DateTime gtdDate, decimal limitPrice, decimal stopPrice, OrderType orderType, int quantity, string symbol, TradeAction tradeAction) { OrderRequest order = new OrderRequest { AccountKey = accountKey.ToString(), AssetType = assetType, Duration = duration, GTDDate = gtdDate, LimitPrice = limitPrice, OrderId = 0, OrderType = orderType, Quantity = quantity, Route = Route.Intelligent, StopPrice = stopPrice, Symbol = symbol, TradeAction = tradeAction }; return order; }
protected OrderBase() { Duration = new OrderDuration(DurationCode.DAY); }
public static OrderRequest GetOrderRequest(int accountKey, AssetType assetType, OrderDuration duration, DateTime gtdDate, decimal limitPrice, decimal stopPrice, OrderType orderType, int quantity, string symbol, TradeAction tradeAction) { OrderRequest order = new OrderRequest { AccountKey = accountKey.ToString(), AssetType = assetType, Duration = duration, GTDDate = gtdDate, LimitPrice = limitPrice, OrderId = 0, OrderType = orderType, Quantity = quantity, Route = Route.Intelligent, StopPrice = stopPrice, Symbol = symbol, TradeAction = tradeAction }; return(order); }