internal void SetExceptionOrder(StandardOrderEntity exceptionOrder) { if (!string.IsNullOrWhiteSpace(exceptionOrder.OrderNo)) { ExceptionOrderDict[exceptionOrder.OrderNo] = exceptionOrder; } else { Utils.logger.LogInfo("设置异常委托失败, 委托编号为空!, 委托信息 {0}", exceptionOrder); } }
private void StandardOrderItem(KeyValuePair <string, OrdersEntity> item) { if (string.IsNullOrWhiteSpace(item.Value.ord_no)) { return; } try { if (StandardOrderDict.ContainsKey(item.Key)) { var so = StandardOrderDict[item.Key]; bool isChange = (so.CancelQty != int.Parse(item.Value.cxl_qty) || so.FilledPrice != decimal.Parse(item.Value.avg_px) || so.FilledQty != int.Parse(item.Value.filled_qty) || so.OrderStatus != Entities.CATSTypeInfo.GetOrderStatusDescription(item.Value.ord_status.Trim()) || so.ErrMsg != item.Value.err_msg); if (isChange) { so.CancelQty = int.Parse(item.Value.cxl_qty); so.FilledPrice = decimal.Parse(item.Value.avg_px); so.FilledQty = int.Parse(item.Value.filled_qty); so.OrderStatus = Entities.CATSTypeInfo.GetOrderStatusDescription(item.Value.ord_status.Trim()); so.ErrMsg = item.Value.err_msg; OrderChange[item.Key] = true; } } else { if (AddInstructionDict.ContainsKey(item.Value.client_id.Trim())) { var sendOrderInfo = AddInstructionDict[item.Value.client_id.Trim()]; var standardItem = new StandardOrderEntity() { //部分数据必须从下单信息中取。 CancelQty = int.Parse(item.Value.cxl_qty), ClientID = item.Value.client_id.Trim(), FilledPrice = decimal.Parse(item.Value.avg_px), FilledQty = int.Parse(item.Value.filled_qty), Market = Utils.GetMarket(item.Value.symbol), OrderNo = item.Value.ord_no.Trim(), OrderPrice = sendOrderInfo.OrdPrice, OrderQty = sendOrderInfo.OrdQty, OrderStatus = Entities.CATSTypeInfo.GetOrderStatusDescription(item.Value.ord_status.Trim()), StockCode = Utils.GetStockID(sendOrderInfo.Symbol), ErrMsg = item.Value.err_msg, OrderTime = DateTime.Parse(item.Value.ord_time), //TradeSide = int.Parse(item.Value.tradeside), TradeSide = int.Parse(sendOrderInfo.TradeSide), Account = sendOrderInfo.Acct.Trim(), }; StandardOrderDict[item.Key] = standardItem; OrderChange[item.Key] = true; } //else //{ // Utils.logger.LogInfo("下单命令中不包含该clientID" + item.Value.ToJson()); //} } } catch (Exception ex) { Utils.logger.LogInfo("CATSAdapter.StandardOrderMain Exception, Message:{0}", ex.Message); } }