private void Transformer(InsertOrder odr, ref CLRDFITCInsertOrderField order) { order.accountID = AccountID; order.lRequestID = RequestID; order.localOrderID = LocalOrderID; order.instrumentID = odr.InstrumentID; order.insertPrice = odr.InsertPrice; order.orderAmount = odr.OrderAmount; switch (odr.BuySell) { case Direction.Buy: order.buySellType = (short)CLRDFITCBuySellType.SPD_BUY; break; case Direction.Sell: order.buySellType = (short)CLRDFITCBuySellType.SPD_SELL; break; } switch (odr.OpenClose) { case Operation.Open: order.openCloseType = (int)CLRDFITCOpenCloseType.SPD_OPEN; break; case Operation.Close: order.openCloseType = (int)CLRDFITCOpenCloseType.SPD_CLOSE; break; case Operation.CloseToday: order.openCloseType = (int)CLRDFITCOpenCloseType.SPD_CLOSETODAY; break; } switch (odr.Flag) { case Flag.Speculator: order.speculator = (int)CLRDFITCSpeculatorType.SPD_SPECULATOR; break; case Flag.Hedge: order.speculator = (int)CLRDFITCSpeculatorType.SPD_HEDGE; break; case Flag.Arbitrage: order.speculator = (int)CLRDFITCSpeculatorType.SPD_ARBITRAGE; break; } switch (odr.OrderType) { case OrderType.MarketPrice: order.orderType = (int)CLRDFITCOrderType.MKORDER; break; case OrderType.LimitPrice: order.orderType = (int)CLRDFITCOrderType.LIMITORDER; break; } order.insertType = (int)CLRDFITCInsertType.BASIC_ORDER; order.instrumentType = (int)CLRDFITCInstrumentType.COMM_TYPE; }
public HashSet <string> RequestInsertOrder(HashSet <InsertOrder> InsertOrders) { HashSet <String> result = new HashSet <String>(); if (null != InsertOrders) { CLRDFITCInsertOrderField order = new CLRDFITCInsertOrderField(); foreach (var odr in InsertOrders) { Transformer(odr, ref order); clrXspeedTradeApi.ReqInsertOrder(order); } } if (result.Count > 0) { return(result); } else { return(null); } }