Some top S&P 500 companies are not available?
-
Many tickers like JPM LLY BKR.B that correspond to top S&P 500 Companies by Weight https://www.slickcharts.com/sp500 are not avaiblabe in the data
data = qndata.stocks.load_spx_data(tail = 365 * 5)
d = data.asset.to_pandas().to_dict()
d['NAS:JPM']
KeyError Traceback (most recent call last)
Cell In[14], line 1
----> 1 d['NAS:JPM']KeyError: 'NAS:JPM'
This companies are not quoted in NASDAQ but they are quoated in NYSE,
Are this companies avaliable for the contest?
-
The symbols are all in there, but if they are listed on NYSE you have to prepend
NYS:
notNAS:
to the symbol. Also, I believe by 'BKR.B' you mean 'BRK.B'[sym for sym in data.asset.values if any(map(lambda x: x in sym, ['JPM', 'LLY', 'BRK.B']))]
['NYS:BRK.B', 'NYS:JPM', 'NYS:LLY']
You can also search for symbols in
qndata.stocks_load_spx_list()
and get a little more infos like this:syms = qndata.stocks_load_spx_list() [sym for sym in syms if sym['symbol'] in ['JPM', 'LLY', 'BRK.B']]
[{'name': 'Berkshire Hathaway Inc', 'sector': 'Finance', 'symbol': 'BRK.B', 'exchange': 'NYS', 'id': 'NYS:BRK.B', 'cik': '1067983', 'FIGI': 'tts-824192'}, {'name': 'JP Morgan Chase and Co', 'sector': 'Finance', 'symbol': 'JPM', 'exchange': 'NYS', 'id': 'NYS:JPM', 'cik': '19617', 'FIGI': 'tts-825840'}, {'name': 'Eli Lilly and Co', 'sector': 'Healthcare', 'symbol': 'LLY', 'exchange': 'NYS', 'id': 'NYS:LLY', 'cik': '59478', 'FIGI': 'tts-820450'}]
The value for the key 'id' is what you will find in
data.asset
-
Thanks