Finnhub-Stock-API / finnhub-python

Finnhub Python API Client. Finnhub API provides institutional-grade financial data to investors, fintech startups and investment firms. We support real-time stock price, global fundamentals, global ETFs holdings and alternative data. https://finnhub.io/docs/api
https://finnhub.io/
Apache License 2.0
584 stars 101 forks source link

symbol lookup is not returning useful results #43

Open Commod0re opened 2 years ago

Commod0re commented 2 years ago

the API docs show the following example:

import finnhub
finnhub_client = finnhub.Client(api_key="")

print(finnhub_client.symbol_lookup('apple'))

with a sample response:

{
  "count": 4,
  "result": [
    {
      "description": "APPLE INC",
      "displaySymbol": "AAPL",
      "symbol": "AAPL",
      "type": "Common Stock"
    },
    {
      "description": "APPLE INC",
      "displaySymbol": "AAPL.SW",
      "symbol": "AAPL.SW",
      "type": "Common Stock"
    },
    {
      "description": "APPLE INC",
      "displaySymbol": "APC.BE",
      "symbol": "APC.BE",
      "type": "Common Stock"
    },
    {
      "description": "APPLE INC",
      "displaySymbol": "APC.DE",
      "symbol": "APC.DE",
      "type": "Common Stock"
    }
  ]
}

but I am currently getting wildly different results, and AAPL is not among them:

{'count': 22,
 'result': [{'description': 'Apple',
   'displaySymbol': 'A19C0M.DU',
   'symbol': 'A19C0M.DU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'APC5.BE',
   'symbol': 'APC5.BE',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A2R7JV.BE',
   'symbol': 'A2R7JV.BE',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A3KUT4.BE',
   'symbol': 'A3KUT4.BE',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A1HKKY.HA',
   'symbol': 'A1HKKY.HA',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A3KUT3.DU',
   'symbol': 'A3KUT3.DU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'APCU.HM',
   'symbol': 'APCU.HM',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A2R7JV.MU',
   'symbol': 'A2R7JV.MU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A3KUT6.DU',
   'symbol': 'A3KUT6.DU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'APCU.MU',
   'symbol': 'APCU.MU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A3KUT6.MU',
   'symbol': 'A3KUT6.MU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A2R7JT.BE',
   'symbol': 'A2R7JT.BE',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A3KUT5.DU',
   'symbol': 'A3KUT5.DU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'APCL.HM',
   'symbol': 'APCL.HM',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A3KUT5.MU',
   'symbol': 'A3KUT5.MU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A3KUT3.MU',
   'symbol': 'A3KUT3.MU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'APC5.DU',
   'symbol': 'APC5.DU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'APCU.DU',
   'symbol': 'APCU.DU',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'APCA.HM',
   'symbol': 'APCA.HM',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A1HKKY.BE',
   'symbol': 'A1HKKY.BE',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'APCT.BE',
   'symbol': 'APCT.BE',
   'type': ''},
  {'description': 'Apple',
   'displaySymbol': 'A1HKKY.MU',
   'symbol': 'A1HKKY.MU',
   'type': ''}]}

I don't have access to any of these symbols under my current plan, and even if I did, none of these results are expected

Commod0re commented 2 years ago

I should also note that the sample used to be representative of what this API returned, but this is no longer the case

abh1nh commented 1 year ago

Sorry this is extremely late but I was having the same issue and I'm new to finnhub. Did you figure out what the issue was?

Commod0re commented 1 year ago

The response I eventually got from Finnhub was to not use symbol_lookup at all, and instead use stock_symbols to build my own daily lookup table