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
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# region imports
from AlgorithmImports import *
# endregion

class UglyOrangeGuanaco(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 1, 2)
        self.SetEndDate(2020, 1, 3)
        self.SetCash(1000)
        self.SetTimeZone('America/New_York')


        # Universe Settings & Extended Market Hours
        self.AddUniverse(self.CoarseUniverse)
        self.UniverseSettings.Resolution = Resolution.Hour
        self.UniverseSettings.ExtendedMarketHours = True
        self.AddEquity('SPY', Resolution.Hour, extendedMarketHours=True)
    
    def CoarseUniverse(self, coarse):
        sortDV = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
        symbols = [ x.Symbol for x in sortDV 
                    if x.Price > 10 and x.DollarVolume > 10000000 ]
        return symbols[:500]

    def OnData(self, data):

        # Track timestamps of market data being fed in
        if data.ContainsKey( 'SPY' ):
            if not self.Securities['SPY'].Exchange.Hours.IsOpen(self.Time, self.Time + timedelta(hours=1), False):
                self.Log( f'Extended Hours/ {self.Time}')
            else:
                self.Log( f'Market/ {self.Time}')