Esempio n. 1
0
        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();
             */
        }
Esempio n. 2
0
 public bool Equals(OrderDuration token)
 {
     return(this == token);
 }
Esempio n. 3
0
 public bool Equals(OrderDuration token)
 {
     return this == token;
 }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
 protected OrderBase()
 {
     Duration = new OrderDuration(DurationCode.DAY);
 }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
 protected OrderBase()
 {
     Duration = new OrderDuration(DurationCode.DAY);
 }