Beispiel #1
0
        public override void OnTrade(Trade trade)
        {
            Print("===========成交回报===========");
            OrderHelper.PrintOnTradeStatus(this, trade);

            if (trade.InstrumentID.Equals(_futureA.ID))
            {
                _tradeA = trade;
            }
            else if (trade.InstrumentID.Equals(_futureB.ID))
            {
                _tradeB = trade;
            }

            if (_tradeA != null && _tradeA.OpenOrClose == EnumOpenClose.平仓 &&
                _tradeB != null && _tradeB.OpenOrClose == EnumOpenClose.平仓)
            {
                _tradeA = _tradeB = null;
            }

            if (PrintPositionStatusOnTradeDeal)
            {
                StrategyExHelper.PrintPositionStatus(this);
            }
        }
Beispiel #2
0
        public override void Exit()
        {
            Print("策略停止运行!" + CurrentTime);
            _orderStatusTracerA.PrintHitStatus();
            _orderStatusTracerB.PrintHitStatus();

            Order[] ods = new Order[] { _orderStatusTracerA.Order, _orderStatusTracerB.Order };
            StrategyExHelper.PrintPositionStatus(this, ods, true);
        }