至少对于ISIN,您可以使用函数,该函数返回一个pandas.DataFrame ,其中包含(以及其他信息)该ISIN 代码的符号。investpy
stocks.search_stocks
import investpy
df = investpy.stocks.search_stocks(by='isin', value='US0126531013')
print(df)
# country name full_name isin currency symbol
# 0 mexico Albemarle Albemarle Corp US0126531013 MXN ALB
# 1 united states Albemarle Albemarle Corp US0126531013 USD ALB
# 2 germany Albemarle Albemarle Corporation US0126531013 EUR ALLE
from pandas_datareader import data as pdr
symbol = df.loc[df['country']=='united states','symbol'].values[0]
print(symbol) # ALB
stock = pdr.DataReader(symbol, data_source="yahoo", start="2021-01-01", end="2021-10-30")
print(stock.head())
Open High Low Close Adj Close Volume
Date
2021-01-04 152.899994 156.759995 150.289993 152.630005 151.645477 2898700
2021-01-05 152.669998 166.779999 152.669998 162.929993 161.879028 2628000
2021-01-06 165.500000 178.589996 165.500000 175.100006 173.970535 3335500
2021-01-07 183.479996 187.250000 180.550003 184.000000 182.813126 2947800
2021-01-08 184.490005 186.929993 178.660004 184.100006 182.912491 1659400