Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
how can I get sector index?
get_pricing('AAPL', start_date='2013-01-03', end_date='2014-01-03', symbol_reference_date=None, frequency='daily', fields=None, handle_missing='raise', start_offset=0)  

it's can get AAPL's data

but how can I get sector index data?

What's the sector's code?
What's fuction can get all sectors's code?
Looks like : [code1,code2....]

I'm learner, Any cool boy help me, thanks!

1 response

There isn't price data for sectors. A sector isn't really a 'thing' in that it can't be bought or sold. It doesn't have price and volume data. However, there are these neat things called 'sector ETFs' which are designed to follow sector data. One can get the price of a sector ETF and use that to infer sector performance. Look closely when choosing the ETF. Some are market cap weighted and some are equal weighted. No right or wrong but the weighting will impact the numbers. Also some ETFs include different companies in their respective sectors. For example, to get the biotech sector 'pricing' one could use the iShares IBB ETF as a proxy (https://www.ishares.com/us/products/239699/ishares-nasdaq-biotechnology-etf) like this

get_pricing('IBB', start_date='2013-01-03', end_date='2014-01-03', frequency='daily')  

Another approach would be to calculate the sector data on your own. Simply use pipeline data and group by sector. That would be a little more involved but certainly doable.