public override void SendOrder(Order order) { OrderField field = new OrderField(); field.Type = OrderType.Limit; field.HedgeFlag = HedgeFlagType.Speculation; field.InstrumentID = order.Instrument.InstrumentID; field.Side = order.Direction == DirectionType.Buy ? OrderSide.Buy : OrderSide.Sell; switch (order.OpenClose) { case FreeQuant.Framework.OpenCloseType.Close: field.OpenClose = XAPI.OpenCloseType.Close; break; case FreeQuant.Framework.OpenCloseType.CloseToday: field.OpenClose = XAPI.OpenCloseType.CloseToday; break; default: field.OpenClose = XAPI.OpenCloseType.Open; break; } field.Price = order.Price; field.Qty = order.Qty; string localId = mTdApi.SendOrder(field); //这里只记录策略订单,接口订单要等前置返回信息再记录 order.OrderId = localId; mOrderMap.TryAdd(localId, order); }
public string SendOrder(OrderInfo orderInfo) { OrderField order = new OrderField(); order.InstrumentID = orderInfo.Instrumentid; order.OpenClose = XAPI.OpenCloseType.Open; order.HedgeFlag = HedgeFlagType.Speculation; order.Price = orderInfo.Price; order.Qty = orderInfo.Volume; order.Type = XAPI.OrderType.Limit; order.Side = XAPI.OrderSide.Buy; return(api_Trade.SendOrder(ref order)); }
public string SendOrder() { return(api.SendOrder(ref _Order)); }