Navigation

    Quantiacs Community

    • Register
    • Login
    • Search
    • Categories
    • News
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Some top S&P 500 companies are not available?

    Support
    2
    3
    63
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      gjhernandezp last edited by gjhernandezp

      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?

      1 Reply Last reply Reply Quote 0
      • A
        antinomy last edited by antinomy

        The symbols are all in there, but if they are listed on NYSE you have to prepend NYS: not NAS: 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

        1 Reply Last reply Reply Quote 1
        • G
          gjhernandezp last edited by

          Thanks 🙏

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB | Contributors
          • Documentation
          • About
          • Career
          • My account
          • Privacy policy
          • Terms and Conditions
          • Cookies policy
          Home
          Copyright © 2014 - 2021 Quantiacs LLC.
          Powered by NodeBB | Contributors