public void Common_FortsTradingSchedule_ClearingEnd_It_Is_Not_TimeToTrade()
        {
            DateTime dateTime = new DateTime(2013, 2, 15, 18, 59, 59);

            ITradingSchedule tradingSchedule = new FortsTradingSchedule();

            Assert.IsFalse(tradingSchedule.ItIsTimeToTrade(dateTime));
        }
        public void Common_FortsTradingSchedule_After_Clearing_ItIsTimeToTrade()
        {
            DateTime dateTime = new DateTime(2013, 2, 15, 19, 0, 0);

            ITradingSchedule tradingSchedule = new FortsTradingSchedule();

            Assert.IsTrue(tradingSchedule.ItIsTimeToTrade(dateTime));
        }
        public void Common_FortsTradingSchedule_PreClearingBegin_It_Is_Not_TimeToTrade()
        {
            DateTime dateTime = new DateTime(2013, 2, 15, 14, 0, 0);

            ITradingSchedule tradingSchedule = new FortsTradingSchedule();

            Assert.IsFalse(tradingSchedule.ItIsTimeToTrade(dateTime));
        }
        public void Common_FortsTradingSchedule_It_Is_Not_DateToTrade()
        {
            DateTime dateTime = new DateTime(2013, 2, 16, 11, 0, 0);

            ITradingSchedule tradingSchedule = new FortsTradingSchedule();

            Assert.IsFalse(tradingSchedule.ItIsTimeToTrade(dateTime));
        }
        public void Common_FortsTradingSchedule_EndOfSession_It_Is_Not_TimeToTrade()
        {
            DateTime dateTime = new DateTime(2013, 2, 15, 23, 50, 0);

            ITradingSchedule tradingSchedule = new FortsTradingSchedule();

            Assert.IsFalse(tradingSchedule.ItIsTimeToTrade(dateTime));
        }
        public void Common_FortsTradingSchedule_SessionEnd_test()
        {
            DateTime nowDate = DateTime.Now;

            DateTime sessionEnd = new DateTime(nowDate.Year, nowDate.Month, nowDate.Day, 23, 0, 0);
            //DateTime sessionEnd = new DateTime(nowDate.Year, nowDate.Month, nowDate.Day, 19, 0, 0);

            ITradingSchedule fortsSchedule = new FortsTradingSchedule();

            if (nowDate.Hour >= 19)
            {
                Assert.AreEqual(sessionEnd.AddDays(1), fortsSchedule.SessionEnd);
            }
            else
            {
                Assert.AreEqual(sessionEnd, fortsSchedule.SessionEnd);
            }
        }
Beispiel #7
0
        public void ByDefault_Order_Expires_At_Midnight()
        {
            Signal signal = new Signal(this.strategyHeader, BrokerDateTime.Make(DateTime.Now), TradeAction.Buy, OrderType.Market, 149000, 0, 0);

            Order order = new Order(signal);

            Assert.AreEqual(this.strategyHeader.Portfolio, order.Portfolio);
            Assert.AreEqual(this.strategyHeader.Symbol, order.Symbol);
            Assert.AreEqual(signal.TradeAction, order.TradeAction);
            Assert.AreEqual(signal.OrderType, order.OrderType);
            Assert.AreEqual(0, order.Price);
            Assert.AreEqual(10, order.Amount);
            Assert.AreEqual(0, order.Stop);
            Assert.AreEqual(signal, order.Signal);
            Assert.AreEqual(signal.Id, order.SignalId);

            ITradingSchedule tradingSchedule = new FortsTradingSchedule();

            Assert.AreEqual(tradingSchedule.SessionEnd, order.ExpirationDate);
        }