簡體   English   中英

來自單個 API 調用 yfinance Python 的多個報價

[英]Multiple Quotes from single API call yfinance Python

我想要使​​用雅虎財經通過一個 API 調用獲得多個股票代碼的報價。

import yfinance as yf

t = yf.Tickers('msft aapl goog')
print(t.info)

雅虎財經 API 已停止使用

我建議使用 Financial Modeling Prep API 作為替代方案。

https://financialmodelingprep.com/api/v3/historical-price-full/MSFT,AAPL,GOOG

返回您要查找的數據。

完整的 API 文檔可以在 這里找到

這是下載帶有數據的 json 的示例代碼:

import json
import requests

url = "https://financialmodelingprep.com/api/v3/historical-price-full/MSFT,AAPL,GOOG"
session = requests.session()
request = session.get(url, timeout=15)
stock_data = request.json()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM