示例#1
0
        private void JY_OrderCanceled(object sender, OrderItem e)
        {
            string[] keys = TradeRA.KeySearch("O_" + e.order_no + "_*");
            if (keys.Length == 0 || keys[0].EndsWith("U_0") || keys[0].EndsWith("_F"))
            {
                return;
            }

            Order model = new Order()
            {
                order_no     = e.order_no,
                deal_count   = (int)decimal.Parse(e.deal_count),
                cancel_count = (int)decimal.Parse(e.cancel_count),
                status       = e.status,
            };

            OrderRA.UpdateStatus(model, keys[0]);

            //撤单成功取消冻结
            Order order = OrderRA.Get(keys[0]);

            MessageBiz.Send(order.user_id.ToString(), MessageTypeEnum.Order_Canceled, "[" + order.code + "]" + order.name + "撤单成功,撤单数量:" + model.cancel_count);
            if (e.type == "0")
            {
                string key_unit = "U_" + order.unit_id;
                UnitRA.UpdateCapitalOrderBuy(-order.price * model.cancel_count, key_unit);
            }
            else if (e.type == "1")
            {
                string key_position = "P_" + order.code + "_A_" + order.account_id + "_U_" + order.unit_id;
                PositionRA.UpdateSellableOrderSell(order.cancel_count, key_position);
            }
            MonitorRA.Increment("account_" + account_id, "cancel_count");
        }
示例#2
0
 private void JY_OrderChanged(object sender, OrderItem e)
 {
     string[] keys = TradeRA.KeySearch("O_" + e.order_no + "_*");
     if (keys.Length > 0)
     {
         Order model = new Order()
         {
             order_no     = e.order_no,
             deal_count   = (int)decimal.Parse(e.deal_count),
             cancel_count = (int)decimal.Parse(e.cancel_count),
             status       = e.status
         };
         OrderRA.UpdateStatus(model, keys[0]);
     }
 }