public void Process(DualPosition dualPosition, OrderBook_BothSide_Size bothSideOrderBook) { // 防自成交 if (bothSideOrderBook.Buy.Count > 0) { int level = bothSideOrderBook.Buy.grid.Keys[0]; foreach (var a in dualPosition.Sell.grid) { if (level >= a.Key) { dualPosition.Sell.Cancel(a.Value); } } } // 上一步有计数,如果没有运行,进行下一步,看挂单数是否对上 if (bothSideOrderBook.Buy.Count > 0) { foreach (var b in bothSideOrderBook.Buy.grid) { int level = b.Key; double size = b.Value; HashSet <Order> set = dualPosition.Sell.grid[level]; } } }
public override void OnStrategyStart() { TimeHelper = new TimeHelper(EnumTradingTime.COMMODITY); PriceHelper = new PriceHelper(Instrument.TickSize); DualPosition = new DualPosition(); DualPosition.Sell.PriceHelper = PriceHelper; DualPosition.Buy.PriceHelper = PriceHelper; // 测试代码 //TargetPosition = 3; DualPosition.Long.Qty = 0; DualPosition.Short.Qty = 0; }
public override void OnStrategyStart() { TimeHelper = new TimeHelper(Instrument.Symbol); PriceHelper = new PriceHelper(Instrument.TickSize); TextParameter = new TextCommon() { OpenClose = EnumOpenClose.OPEN }; CloseTodayHelper = new CloseTodayHelper(EnumExchangeID.SHFE); DualPosition = new DualPosition(); DualPosition.Sell.PriceHelper = PriceHelper; DualPosition.Buy.PriceHelper = PriceHelper; DualPosition.CloseTodayHelper = CloseTodayHelper; // 测试代码 //TargetPosition = 3; DualPosition.Long.Qty = 0; DualPosition.Short.Qty = 0; }