一个美股行情工具包,可以用来获取美股股票列表、实时行情、历史 k 线数据。
pip install openstock
from openstock.stock.client import StockClient
token = '8aa9be32f402301d'
stock_client = StockClient(token)
stock_list = stock_client.get_stock_list()
print(stock_list)
stock_quote = stock_client.get_stock_quote(query=['BABA','JD'])
print(stock_quote)
stock_bars = stock_client.get_stock_bars(query=['BABA','JD'])
print(stock_bars)