static extern int reqOrderInsert(ref CThostFtdcInputOrderField req);
/// <summary> /// 开平仓:市价单 /// </summary> /// <param name="InstrumentID"></param> /// <param name="OffsetFlag">平仓:仅上期所平今时使用CloseToday/其它情况均使用Close</param> /// <param name="Direction"></param> /// <param name="Volume"></param> public int OrderInsert(string InstrumentID, TThostFtdcOffsetFlagType OffsetFlag, TThostFtdcDirectionType Direction, int Volume) { CThostFtdcInputOrderField tmp = new CThostFtdcInputOrderField(); tmp.BrokerID = this.BrokerID; tmp.BusinessUnit = null; tmp.ContingentCondition = TThostFtdcContingentConditionType.Immediately; tmp.ForceCloseReason = TThostFtdcForceCloseReasonType.NotForceClose; tmp.InvestorID = this.InvestorID; tmp.IsAutoSuspend = (int)TThostFtdcBoolType.No; tmp.MinVolume = 1; tmp.OrderPriceType = TThostFtdcOrderPriceTypeType.AnyPrice; tmp.OrderRef = (++this.MaxOrderRef).ToString(); tmp.TimeCondition = TThostFtdcTimeConditionType.IOC; //立即完成,否则撤单 tmp.UserForceClose = (int)TThostFtdcBoolType.No; tmp.UserID = this.InvestorID; tmp.VolumeCondition = TThostFtdcVolumeConditionType.AV; tmp.CombHedgeFlag_0 = TThostFtdcHedgeFlagType.Speculation; tmp.InstrumentID = InstrumentID; tmp.CombOffsetFlag_0 = OffsetFlag; tmp.Direction = Direction; tmp.LimitPrice = 0; tmp.VolumeTotalOriginal = Volume; return reqOrderInsert(ref tmp); }
/// <summary> /// 开平仓:触发单 /// </summary> /// <param name="InstrumentID"></param> /// <param name="ConditionType">触发单类型</param> /// <param name="ConditionPrice">触发价格</param> /// <param name="OffsetFlag">平仓:仅上期所平今时使用CloseToday/其它情况均使用Close</param> /// <param name="Direction"></param> /// <param name="PriceType">下单类型</param> /// <param name="Price">下单价格:仅当下单类型为LimitPrice时有效</param> /// <param name="Volume"></param> public int OrderInsert(string InstrumentID, TThostFtdcContingentConditionType ConditionType , double ConditionPrice, TThostFtdcOffsetFlagType OffsetFlag, TThostFtdcDirectionType Direction, TThostFtdcOrderPriceTypeType PriceType, double Price, int Volume) { CThostFtdcInputOrderField tmp = new CThostFtdcInputOrderField(); tmp.BrokerID = this.BrokerID; tmp.BusinessUnit = null; tmp.ForceCloseReason = TThostFtdcForceCloseReasonType.NotForceClose; tmp.InvestorID = this.InvestorID; tmp.IsAutoSuspend = (int)TThostFtdcBoolType.No; tmp.MinVolume = 1; tmp.OrderRef = (++this.MaxOrderRef).ToString(); tmp.TimeCondition = TThostFtdcTimeConditionType.GFD; tmp.UserForceClose = (int)TThostFtdcBoolType.No; tmp.UserID = this.InvestorID; tmp.VolumeCondition = TThostFtdcVolumeConditionType.AV; tmp.CombHedgeFlag_0 = TThostFtdcHedgeFlagType.Speculation; tmp.InstrumentID = InstrumentID; tmp.CombOffsetFlag_0 = OffsetFlag; tmp.Direction = Direction; tmp.ContingentCondition = ConditionType; //触发类型 tmp.StopPrice = Price; //触发价格 tmp.OrderPriceType = PriceType; //下单类型 tmp.LimitPrice = Price; //下单价格:Price = LimitPrice 时有效 tmp.VolumeTotalOriginal = Volume; return reqOrderInsert(ref tmp); }
/// <summary> /// 下单:录入报单 /// </summary> /// <param name="order">输入的报单</param> public int OrderInsert(CThostFtdcInputOrderField order) { return reqOrderInsert(ref order); }