Back to Community
Fetch CSV of stocks to use between dates provided

I've made a CSV that contains S&P500 companies on a quarterly basis. The CSV consists of a Date column, and a symbol column. For every quarter, I have 500 rows that contain the date and a symbol for every stock that exists in the S&P500 on that specific date. I'm trying to fetch this data and would like to use these companies in my pipeline, but I'm getting this error when backtesting:

TypeError: 'NoneType' object has no attribute '__getitem__'

It's included in my code, but here's a link to the CSV file I've made with the S&P500 stocks I would like to use between the quarterly intervals:
https://dl.dropboxusercontent.com/s/r52vebo1utaxyoa/sp500_for_quantopian.csv?dl=0

Also, how would I then make it so my pipeline universe are the stocks listed in the CSV while still being able to get data back on those securities. Here's what I'm currently doing with the Q500US universe, which I would like to replace with the stocks in my CSV:

def make_pipeline(context):  
    market_cap = MarketCap()

    rolling_correlations = RollingLinearRegressionOfReturns(  
        target = context.regression_target,  
        returns_length = context.regression_returns_length,  
        regression_length = context.regression_length,  
        mask = context.base_universe  
    ) 

    beta = rolling_correlations.beta  
    should_buy_beta =  (beta < context.beta_threshold)  
    securities_to_trade = (context.base_universe & should_buy_beta)

    return Pipeline(  
        columns = {  
            'market_cap': market_cap,  
            'beta': beta,  
            'should_buy_beta': should_buy_beta,  
            'securities_to_trade': securities_to_trade  
        },  
        screen = (securities_to_trade)  
    )
Clone Algorithm
5
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 58b7a6c24c07925e3c3a1d6c
There was a runtime error.