/// <summary> /// 产生了新订单 /// </summary> /// <param name="order"></param> public void NewOrder(Order order) { lock (this) { if (!order.IsPendingNew) { return; } double Qty = order.Qty; // 非上海的,平今要转成平仓 EnumOpenClose OpenClose = CloseTodayHelper.Transform(OpenCloseHelper.CheckOpenClose(order)); Order_OpenClose[order] = OpenClose; switch (OpenClose) { case EnumOpenClose.OPEN: if (order.Side == OrderSide.Buy) { //Long.FrozenOpen += Qty; Long.NewOrderOpen(Qty); } else { //Short.FrozenOpen += Qty; Short.NewOrderOpen(Qty); } break; case EnumOpenClose.CLOSE: if (order.Side == OrderSide.Buy) { //Short.FrozenClose += Qty; Short.NewOrderClose(Qty); } else { //Long.FrozenClose += Qty; Long.NewOrderClose(Qty); } break; case EnumOpenClose.CLOSE_TODAY: if (order.Side == OrderSide.Buy) { //Short.FrozenCloseToday += Qty; //Short.FrozenClose += Qty; Short.NewOrderCloseToday(Qty); } else { //Long.FrozenCloseToday += Qty; //Long.FrozenClose += Qty; Long.NewOrderCloseToday(Qty); } break; default: MessageBox.Show("NewOrder"); break; } if (order.Side == OrderSide.Buy) { Buy.Add(order); } else { Sell.Add(order); } } }
/// <summary> /// 产生了新订单 /// </summary> /// <param name="order"></param> public void NewOrder(Order order) { lock (this) { if (!order.IsPendingNew) { return; } // 非上海的,平今要转成平仓 EnumOpenClose OpenClose = CloseTodayHelper.Transform(OpenCloseHelper.CheckOpenClose(order)); switch (OpenClose) { case EnumOpenClose.OPEN: if (order.Side == OrderSide.Buy) { Long.FrozenOpen += order.Qty; } else { Short.FrozenOpen += order.Qty; } break; case EnumOpenClose.CLOSE: if (order.Side == OrderSide.Buy) { Short.FrozenClose += order.Qty; } else { Long.FrozenClose += order.Qty; } break; case EnumOpenClose.CLOSE_TODAY: if (order.Side == OrderSide.Buy) { Short.FrozenCloseToday += order.Qty; Short.FrozenClose += order.Qty; } else { Long.FrozenCloseToday += order.Qty; Long.FrozenClose += order.Qty; } break; default: break; } if (order.Side == OrderSide.Buy) { Buy.Add(order); } else { Sell.Add(order); } Order_OpenClose[order] = OpenClose; } }