public void Order(Order order) { string request_id = FuncHelper.GetUniqueID().ToString(); order.account_id = account_id; order.name = StockInfoBiz.GetStock(order.code).name; order.time_dt = DateTime.Now; OrderRA.Add(order, "O_" + request_id + "_T_" + order.trade_no + "_U_" + order.unit_id + "_F"); JY.Order(new JY.Order(order.code, order.type, order.count, order.price, request_id)); MonitorRA.Increment("account_" + account_id, "order_count"); }
private void JY_NewOrder(object sender, OrderItem e) { Order order; string[] keys = TradeRA.KeySearch("O_" + e.order_no + "_*"); //处理系统中是否存在未能正常收到回报但已成功的委托(通常由于下单超时导致) if (keys.Length == 0 && !string.IsNullOrWhiteSpace(e.request_id) && e.request_id != "0") { JY_Order_Done(null, new OrderResult(true, e.order_no, "", e.request_id)); keys = TradeRA.KeySearch("O_" + e.order_no + "_*"); } if (keys.Length > 0) { order = OrderRA.Get(keys[0]); if (order.cancel_count != (int)decimal.Parse(e.cancel_count)) { JY_OrderCanceled(null, e); return; } } else { order = new Order(); } order.deal_count = (int)decimal.Parse(e.deal_count); order.cancel_count = (int)decimal.Parse(e.cancel_count); order.status = e.status; order.time_dt = DateTime.Parse(e.date.ToDate() + " " + e.time.ToTime()); if (keys.Length > 0) { OrderRA.UpdateNew(order, keys[0]); } else { string key = "O_" + e.order_no + "_T_0_U_0"; order.trade_no = "0"; order.order_no = e.order_no; order.name = e.name; order.code = e.code; order.price = decimal.Parse(e.price); order.count = order.trade_count = (int)decimal.Parse(e.count); order.type = int.Parse(e.type); order.account_id = account_id; order.state_enum = OrderStatusEnum.Success; OrderRA.Add(order, key); } }