Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-6.106
Tracking Error
0.107
Treynor Ratio
0
Total Fees
$0.00
namespace QuantConnect.Algorithm.CSharp
{
    public class ModulatedVerticalSplitter : QCAlgorithm
    {

        public override void Initialize()
        {
            SetStartDate(2021, 1, 6);
            SetEndDate(2021, 1, 12);
            SetCash(100000);
            
            UniverseSettings.Resolution = Resolution.Minute;
            UniverseSettings.ExtendedMarketHours = true;
            
            UniverseSettings.MinimumTimeInUniverse = TimeSpan.Zero;

            SetUniverseSelection(new ScheduledUniverseSelectionModel(
            	DateRules.Every(DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday),
                TimeRules.Every(TimeSpan.FromHours(1)),
                SelectSymbols
            ));

        }

        public override void OnData(Slice data)
        {
        	if (Time.TimeOfDay == new TimeSpan(16, 00, 0))
            {
            	foreach (var universe in UniverseManager.Values)
            	{
            	    if (universe is UserDefinedUniverse)
            	    {
            	        continue;
            	    }
            	    var symbols = universe.Members.Keys;

            	    foreach (var x in symbols)
            	    {
                		Debug($"{x.Value} {Time}");
            	    }
            	    Debug($"Universe count {symbols.Count()}");
            	}
            	
            	foreach (var x in ActiveSecurities.Keys) {
        			Debug($"Active at 15:35: {x.Value}");
        		}
            }
        }
        
        public override void OnSecuritiesChanged(SecurityChanges changes) { 
        	if (changes.AddedSecurities.Count > 0) {
        		foreach (var s in changes.AddedSecurities) {
        			Debug($"added {s.Symbol.Value}");
        		}
        	}
        	
        	if (changes.RemovedSecurities.Count > 0) {
        		foreach (var s in changes.RemovedSecurities) {
        			Debug($"removed {s.Symbol.Value}");
        		}
        	}
        	
        	foreach (var x in ActiveSecurities.Keys) {
        		Debug($"Active: {x.Value}");
        	}
        	
        }
        
        IEnumerable<Symbol> SelectSymbols(DateTime dateTime)
        {
            if (Time.TimeOfDay == new TimeSpan(13, 00, 0))
            {
            	Debug("13:00 // should have only AAPL and IBM");
            	
                yield return QuantConnect.Symbol.Create("AAPL", SecurityType.Equity, Market.USA);
                yield return QuantConnect.Symbol.Create("IBM", SecurityType.Equity, Market.USA);
                
            } else if (Time.TimeOfDay == new TimeSpan(16, 00, 0)) {
            	Debug("16:00 should have only AMD");
            	
            	yield return QuantConnect.Symbol.Create("AMD", SecurityType.Equity, Market.USA);
            }
            else
            {
            	yield return QuantConnect.Symbol.Create("TSLA", SecurityType.Equity, Market.USA);
            }
        }
    }
}