예제 #1
0
        /// <summary>
        /// Instantiates a new instance.
        /// </summary>
        /// <param name="bars">The list of Bar instances to use during the backtest.</param>
        public StrategyBacktester(IEnumerable <Bar> bars)
        {
            var orderCreator = new OrderCreator();

            orderCreator.OrderSent += (order) => OrderSent.SafeTrigger(order);

            var manager = new StrategyManager(orderCreator);

            StrategyInfo = manager.StrategyInfo;

            playableBars = new PlayableBars(bars);

            runner = new StrategyRunner <T>(
                playableBars.ToSingleDataStream(),
                orderCreator: orderCreator,
                strategyInfo: StrategyInfo);
            Strategy = runner.Strategy;
        }
예제 #2
0
 /// <summary>
 /// Triggers the OrderSent event.
 /// </summary>
 /// <param name="orderInfo">The information about the order.</param>
 protected virtual void TriggerOrderSent(OrderInfo orderInfo)
 {
     OrderSent.SafeTrigger(orderInfo);
 }
예제 #3
0
 /// <summary>
 /// Called when an order has been sent. Triggers the OrderSent event.
 /// </summary>
 /// <param name="order">The order information that was sent.</param>
 private void OnOrderSent(OrderInfo order)
 {
     OrderSent.SafeTrigger(order);
 }