Ejemplo n.º 1
0
        private static void AddItems(OrderAuto order_auto, Order order)
        {
            Dictionary <string, string> items = new Dictionary <string, string>();

            items.Add("id", order_auto.order_times.ToString());
            items.Add("time", order_auto.time_prev_dt.Format());
            items.Add("price", order.price.ToString());
            items.Add("count", order.count.ToString());
            items.Add("result", order_auto.result_prev);
            string key = "T_" + order_auto.id + "_" + order_auto.order_times.ToString().PadLeft(3, '0');

            TradeRA.SetFields(key, items);
            TradeRA.SetExpire(key);
        }
Ejemplo n.º 2
0
 public JsonResult UpdateOrderAuto(OrderAuto order)
 {
     using (var ctx = new UnitOfWork())
     {
         OrderAuto retour = null;
         if (order.id == 0)
         {
             retour = ctx.orders.AddOrderAuto(order);
         }
         else
         {
             retour = ctx.orders.UpdateOrderAuto(order);
         }
         return(Json(retour));
     }
 }
Ejemplo n.º 3
0
        public static void UpdateExecuted(OrderAuto order_auto, Order order, string key)
        {
            Dictionary <string, string> items = new Dictionary <string, string>();

            items.Add("time_next_dt", order_auto.time_next_dt.Format());
            items.Add("time_prev_dt", order_auto.time_prev_dt.Format());
            items.Add("order_times", order_auto.order_times.ToString());
            items.Add("order_count", order_auto.order_count.ToString());
            items.Add("result_prev", order_auto.result_prev);
            TradeRA.SetFields(key, items);
            AddItems(order_auto, order);

            if (order_auto.order_count == order_auto.count_total)
            {
                UpdateStatus(StatusAutoOrderEnum.Done, 1, key);
            }
        }