Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
CSV Fetcher import multiple stocks issue

Hello all,

I am having issues with importing 30 stocks each day into my universe, currently it seem that only one will import. I am thinking that when I import the csv in, it is renaming all the columns to symbol.1,symbol.2, etc. So in turn it only takes the column one name 'symbol'. If this is actually the problem, how would I reverse this behavior?

Logs:

1970-01-01preview:26INFO          Date symbol symbol.1 symbol.2 symbol.3 symbol.4 symbol.5 symbol.6  \  
0  2014-12-30    PXD      CVX      XEC      XOM      EOG      MPC      SLB  
1  2014-12-31    PXD      CVX      XEC      XOM      EOG      MPC      SLB   

  symbol.7 symbol.8    ...    symbol.20 symbol.21 symbol.22 symbol.23  \  
0      APC      OXY    ...         ISRG      REGN      BIIB       AGN  
1      APC      OXY    ...         ISRG      REGN      BIIB       AGN   

  symbol.24 symbol.25 symbol.26 symbol.27 symbol.28 symbol.29  
0       MCK      ALXN       BCR      PRGO      AMGN       HUM  
1       MCK      ALXN      PRGO       BCR      AMGN       HUM  


2014-12-30PRINTdt  
2014-12-30 00:00:00+00:00    Equity(17436 [PXD])  
Name: sid, dtype: object  
2014-12-30PRINTtotal universe size: 1  
2 responses

from the examples and testing i have done, i believe that the platform only imports the field names "symbol" and does symbol to sid lookups on this field. all other fields are treated as data points against that symbol. you probably need to convert your source file into a single row for each date/symbol:

2014-12-30,PXD
2014-12-30,CVX
2014-12-30,XEC
2014-12-30,XOM

etc.

Hi Ethan,

Thanks for your help, that seem to be the problem. I guess I am going to have to regenerate my CSV now :). I have attached my correct back test for those who are interested.

Logs

1970-01-01preview:26INFO          Date symbol  
0  2014-12-30    PXD  
1  2014-12-30    CVX  
2  2014-12-30    XEC  
3  2014-12-30    XOM  
4  2014-12-30    EOG  
1970-01-01preview:26INFO                                            sid  
dt  
2014-12-30 00:00:00+00:00  Equity(17436 [PXD])  
2014-12-30 00:00:00+00:00  Equity(23112 [CVX])  
2014-12-30 00:00:00+00:00  Equity(24125 [XEC])  
2014-12-30 00:00:00+00:00   Equity(8347 [XOM])  
2014-12-30 00:00:00+00:00   Equity(2564 [EOG])  
2014-12-30PRINTdt  
2014-12-30 00:00:00+00:00    Equity(17436 [PXD])  
2014-12-30 00:00:00+00:00    Equity(23112 [CVX])  
2014-12-30 00:00:00+00:00    Equity(24125 [XEC])  
2014-12-30 00:00:00+00:00     Equity(8347 [XOM])  
2014-12-30 00:00:00+00:00     Equity(2564 [EOG])  
2014-12-30 00:00:00+00:00    Equity(41636 [MPC])  
2014-12-30 00:00:00+00:00     Equity(6928 [SLB])  
2014-12-30 00:00:00+00:00      Equity(455 [APC])  
2014-12-30 00:00:00+00:00     Equity(7612 [TSO])  
Name: sid, dtype: object  
2014-12-30PRINTtotal universe size: 9  
End of logs.