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() { base.OnStrategyStart(); TargetOrderBook = new OrderBook_BothSide_Size(); TargetOrderBook.Sell.PriceHelper = base.PriceHelper; TargetOrderBook.Buy.PriceHelper = base.PriceHelper; TextParameterAsk = new TextCommon() { OpenClose = EnumOpenClose.OPEN }; TextParameterBid = new TextCommon() { OpenClose = EnumOpenClose.OPEN }; }
public override void OnStrategyStart() { TimeHelper = new TimeHelper(EnumTradingTime.COMMODITY); PriceHelper = new PriceHelper(Instrument.TickSize); TargetOrderBook = new OrderBook_BothSide_Size(); 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() { TargetOrderBook = new OrderBook_BothSide_Size(); }