简体   繁体   中英

Multiple Quotes from single API call yfinance Python

I want a quote for multiple stock symbols with one API call using Yahoo Finance.

import yfinance as yf

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

Yahoo Finance API is being discontinued .

I would suggest using the Financial Modeling Prep API as an alternative.

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

Returns the data you are looking for.

Full API Documentation can be found here

Here's a sample code downloading a json with the data:

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM