As I can retrieve the yahoo-symbol from any ISIN with
def get_symbol_for_isin(isin):
url = 'https://query1.finance.yahoo.com/v1/finance/search'
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36',
}
params = dict(
q=isin,
quotesCount=1,
newsCount=0,
listsCount=0,
quotesQueryId='tss_match_phrase_query'
)
resp = requests.get(url=url, headers=headers, params=params)
data = resp.json()
if 'quotes' in data and len(data['quotes']) > 0:
return data['quotes'][0]['symbol']
else:
return None
I wonder if it is possible to write a function in the other direction to receive an ISIN fram a yahoo symbol?
I did google the net for any function of "import yfinance" but did nothing find.