/// <summary> /// 更新行情。 /// </summary> /// <param name="marketData">行情数据。</param> private void UpdateMarketData(USeMarketData marketData) { if (marketData == null) { return; } if (this.InvokeRequired) { this.BeginInvoke(new Action <USeMarketData>(UpdateMarketData), marketData); return; } if (m_buyInstrument != null && m_buyInstrument.Equals(marketData.Instrument)) { m_buyMarketData = marketData; } if (m_sellInstrument != null && m_sellInstrument.Equals(marketData.Instrument)) { m_sellMarketData = marketData; } SetPriceControlValue(); }
/// <summary> /// 校验开仓参数。 /// </summary> /// <param name="errorMessage"></param> /// <returns></returns> private bool VerifyOpenArgument(out string errorMessage) { errorMessage = string.Empty; USeInstrument buyInstrument = GetBuyInstrumentFromUI(); if (buyInstrument == null) { errorMessage = "请选择买入合约"; return(false); } USeInstrument sellInstrument = GetSellInstrumentFromUI(); if (sellInstrument == null) { errorMessage = "请选择卖出合约"; return(false); } if (buyInstrument.Equals(sellInstrument)) { errorMessage = "买入卖出合约不能为同一合约"; return(false); } if (this.rbnPreferentialSide_Buy.Checked == false && this.rbnPreferentialSide_Sell.Checked == false) { errorMessage = "请选择优先开仓合约"; return(false); } if (this.rbnBuyOrderPriceType_LastPrice.Checked == false && this.rbnBuyOrderPriceType_OpponentPrice.Checked == false && this.rbnBuyOrderPriceType_QueuePrice.Checked == false) { errorMessage = "请选择买入合约下单价格类型"; return(false); } if (this.rbnSellOrderPriceType_LastPrice.Checked == false && this.rbnSellOrderPriceType_OpponentPrice.Checked == false && this.rbnSellOrderPriceType_QueuePrice.Checked == false) { errorMessage = "请选择卖出合约下单价格类型"; return(false); } if (this.rbnPriceSpreadSide_Greater.Checked == false && this.rbnPriceSpreadSide_Less.Checked == false) { errorMessage = "请选择开仓价差条件"; return(false); } //if(this.nudPriceSpreadThreshold.Value <=0) //{ // errorMessage = "请设定价差阀值"; // return false; //} if (((int)this.nudTotalOrderQty.Value) <= 0m) { errorMessage = "请设定单边开仓手数"; return(false); } if (((int)this.nudOrderQtyUint.Value) < 1) { errorMessage = "请设定开仓单位"; return(false); } if (((int)this.nudDifferentialUnit.Value < 0)) { errorMessage = "请设定合理的仓差单位"; return(false); } return(true); }