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
17.424
Tracking Error
0.002
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
import pandas as pd
import numpy as np

class TestingAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021,4,26)  
        self.SetEndDate(2021,4,28)
        self.SetCash(10000) 
        self.UniverseSettings.Resolution = Resolution.Minute
        self.AddUniverse(self.CoarseFilterFunction, self.FineFilterFunction)
 
        self.spy = self.AddEquity("SPY")
        
        self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.AfterMarketOpen("SPY", 60), self.MainFunction)

    # Coarse filter
    def CoarseFilterFunction(self, coarse):
        coarse_ = [x.Symbol for x in coarse if x.DollarVolume > 100000000 and x.HasFundamentalData]
        return coarse_
        
    # fine Filter
    def FineFilterFunction(self, fine):
        self.tickers = [x.Symbol for x in fine]
        return self.tickers

    def MainFunction(self):
        # series for 1-d data with only 1 input
        self.series = pd.Series()
        # dataframe for 2-d data with more input dimensions
        self.df = pd.DataFrame()
        
        # appending by symbol
        for symbol in self.tickers:
            self.series = self.series.append(pd.Series([self.Securities[symbol].Fundamentals.MarketCap], 
                                                        index=[symbol]))
            self.df = self.df.append(pd.DataFrame([[self.Securities[symbol].Fundamentals.MarketCap, self.Securities[symbol].Fundamentals.ValuationRatios.PERatio]],
                                                    index=[symbol], 
                                                    columns=["market cap", "PE Ratio"]))
                                                    
        self.Log(self.series)
        self.Log(self.df)