Exemple #1
0
        public void AlwaysOpenExchange()
        {
            var time      = new DateTime(2020, 1, 14);
            var delisting = new Delisting(Symbols.BTCUSD, time, 10, DelistingType.Warning);

            var liquidationTime = delisting.GetLiquidationTime(SecurityExchangeHours.AlwaysOpen(DateTimeZone.Utc));

            Assert.AreEqual(new DateTime(2020, 1, 14, 23, 45, 0), liquidationTime);
        }
Exemple #2
0
        public void EquityAndOption(SecurityType securityType)
        {
            var symbol = Symbols.AAPL;

            if (securityType == SecurityType.Option)
            {
                symbol = Symbols.SPY_C_192_Feb19_2016;
            }
            var time      = new DateTime(2020, 1, 14);
            var delisting = new Delisting(symbol, time, 10, DelistingType.Warning);

            var exchangeHours   = MarketHoursDatabase.FromDataFolder().GetExchangeHours(delisting.Symbol.ID.Market, delisting.Symbol, delisting.Symbol.SecurityType);
            var liquidationTime = delisting.GetLiquidationTime(exchangeHours);

            Assert.AreEqual(new DateTime(2020, 1, 14, 15, 45, 0), liquidationTime);
        }
Exemple #3
0
        public void FuturesAndOption(SecurityType securityType)
        {
            var time   = new DateTime(2020, 1, 14);
            var symbol = Symbols.Future_CLF19_Jan2019;

            if (securityType == SecurityType.FutureOption)
            {
                symbol = Symbol.CreateOption(symbol, symbol.ID.Market, OptionStyle.American, OptionRight.Call, 1, time);
            }

            var delisting = new Delisting(symbol, time, 10, DelistingType.Warning);

            var exchangeHours   = MarketHoursDatabase.FromDataFolder().GetExchangeHours(delisting.Symbol.ID.Market, delisting.Symbol, delisting.Symbol.SecurityType);
            var liquidationTime = delisting.GetLiquidationTime(exchangeHours);

            Assert.AreEqual(new DateTime(2020, 1, 14, 16, 45, 0), liquidationTime);
        }
Exemple #4
0
        public void ThrowsIfNotDelistingWarning()
        {
            var delisting = new Delisting(Symbols.AAPL, DateTime.UtcNow, 19, DelistingType.Delisted);

            Assert.Throws <ArgumentException>(() => delisting.GetLiquidationTime(SecurityExchangeHours.AlwaysOpen(DateTimeZone.Utc)));
        }