Example #1
0
        public void SetDeliveryDate_test()
        {
            StrategyHeader strategyHeader = new StrategyHeader(1, "Sample strategyHeader", "BP12345-RF-01", "RTS-9.13_FT", 10);

            this.tradingData.Get <ICollection <StrategyHeader> >().Add(strategyHeader);

            Signal signal = new Signal(strategyHeader, BrokerDateTime.Make(DateTime.Now), TradeAction.Buy, OrderType.Market, 150000, 0, 0);

            this.tradingData.Get <ICollection <Signal> >().Add(signal);

            Order order = new Order(signal, 150);

            this.tradingData.Get <ICollection <Order> >().Add(order);
            Assert.IsFalse(order.IsDelivered);
            Assert.AreEqual(0, this.tradingData.Get <IEnumerable <OrderDeliveryConfirmation> >().Count());

            OrderSucceeded os = new OrderSucceeded(order.Id, "12345");

            this.rawData.GetData <OrderSucceeded>().Add(os);

            Assert.AreEqual(1, this.tradingData.Get <IEnumerable <OrderDeliveryConfirmation> >().Count());
            OrderDeliveryConfirmation confirmation = this.tradingData.Get <IEnumerable <OrderDeliveryConfirmation> >().Last();

            Assert.AreEqual(order.Id, confirmation.OrderId);
            Assert.AreEqual(order, confirmation.Order);
            Assert.AreEqual(os.DateTime, confirmation.DateTime);
        }
Example #2
0
        public void OrderSucceeded_constructor_test()
        {
            OrderSucceeded os = new OrderSucceeded(35, "9028347");

            Assert.AreEqual(35, os.Cookie);
            Assert.AreEqual("9028347", os.OrderId);
            Assert.AreEqual(BrokerDateTime.Make(DateTime.Now).Date, os.DateTime.Date);
        }
Example #3
0
        protected void OnOrderSucceeded(TradingData data)
        {
            OrderSucceeded?.Invoke(data);
#if DEBUG
            if (_settings.ProductionMode)
            {
                Bot.SaveSettings(_settings);
            }
#endif

#if RELEASE
            Bot.SaveSettings(_settings);
#endif
        }