使用pip 安裝 alpha_vantage及pandas套裝工具
pip install alpha_vantage pandas
# 查詢美股台積電ADR TSM之每小時股價:
from alpha_vantage.timeseries import TimeSeries
import matplotlib.pyplot as plt
ts = TimeSeries(key='CHID7JX0RQCD5RHJ', output_format='pandas')
data, meta_data = ts.get_intraday(symbol='TSM',interval='60min', outputsize='full')
data['4. close'].plot()
plt.title('Intraday Times Series for the TSM stock (1 hr)')
plt.show()