PiotrBenedysiuk / PortfolioVisualizer

Visualization tool for stock portfolios.
1 stars 0 forks source link

PV - 2 | Symbol matcher #2

Open PiotrBenedysiuk opened 3 years ago

PiotrBenedysiuk commented 3 years ago

Yahoo finance and Degiro use different symbols, we need to match them to each other.

Match via isin using the yahoo endpoint "https://query2.finance.yahoo.com/v1/finance/search"

PiotrBenedysiuk commented 3 years ago

` def get_ticker(product_info) -> Ticker: url = "https://query2.finance.yahoo.com/v1/finance/search" params = {'q': f'{product_info.isin}', 'quotesCount': 1, 'newsCount': 0}

r = requests.get(url, params=params)
data = r.json()

return Ticker(data['quotes'][0]['symbol'])

`