Beispiel #1
0
        public override ExchangeStatusType GetInstrumentStatus(string pExc)
        {
            var instField = DicInstrumentField[pExc];
            ExchangeStatusType excStatus = default(ExchangeStatusType);

            if (DicExcStatus.TryGetValue(instField.ProductID, out excStatus) || DicExcStatus.TryGetValue(instField.ExchangeID.ToString(), out excStatus) || DicExcStatus.TryGetValue(instField.InstrumentID, out excStatus))
            {
                return(excStatus);
            }
            return(ExchangeStatusType.Closed);
        }
Beispiel #2
0
        public int ReqOrderInsert(string pInstrument, DirectionType pDirection, OffsetType pOffset, double pPrice, int pVolume, OrderType pType = OrderType.Limit, int pCustom = 0, HedgeType pHedge = HedgeType.Speculation)
        {
            InstrumentField    dif;
            ExchangeStatusType es;

            //小节收盘:等待重新开盘
            if (DicInstrumentField.TryGetValue(pInstrument, out dif))
            {
                if (_initFlow)
                {
                    pPrice += _floConfig.FirstAddTicks * (pDirection == DirectionType.Buy ? 1 : -1) * dif.PriceTick;
                }
                //限定在涨跌板范围内
                MarketData f;
                if (_q == null)
                {
                    ShowInfo("行情接口异常");
                    return(-1);
                }
                if (!_q.DicTick.TryGetValue(pInstrument, out f))
                {
                    _q.ReqSubscribeMarketData(pInstrument);
                    Thread.Sleep(200);
                }
                if (_q.DicTick.TryGetValue(pInstrument, out f))
                {
                    ShowInfo($"合约{pInstrument}无行情");
                }
                else
                {
                    pPrice = Math.Max(f.LowerLimitPrice, Math.Min(f.UpperLimitPrice, pPrice));
                }
                //下单前修正价格为最小变动的倍数
                pPrice = (int)(pPrice / dif.PriceTick) * dif.PriceTick;

                if (DicExcStatus.TryGetValue(dif.ProductID, out es) || DicExcStatus.TryGetValue(dif.InstrumentID, out es) || DicExcStatus.TryGetValue(dif.ExchangeID.ToString(), out es))
                {
                    if (es == ExchangeStatusType.NoTrading)                    //小节收盘中:待处理
                    {
                        ShowInfo($"小节收盘,待重新开盘后再发委托:{pInstrument},{pDirection},{ pOffset},{ pPrice},{ pVolume},{pCustom}");
                        _listWaitTrading.Add(new object[] { pInstrument, pDirection, pOffset, pPrice, pVolume, pType, pCustom, pHedge });
                        return(0);
                    }
                }
            }
            return(base.ReqOrderInsert(pInstrument, pDirection, pOffset, pPrice, pVolume, pCustom, pType, pHedge));
        }