0

我正在尝试使用以下代码从 yfinance 获取真实的 rime 数据。但我只是得到相同的收盘/高/低/开盘结果。我开始认为 yfinance 是不可能的。有没有免费的和欧洲的替代品?

非常感谢提前!!

#import libraries
import schedule
import time
import alpaca_trade_api as tradeapi
import yfinance as yf
import pandas as pd

# Ask what stocks you want to check
pd = pd.DataFrame()
n = int(input("Enter the size of the list "))
print("\n")
numList = list(num for num in input("Enter the list numbers separated by space ").strip().split())[:n]
print("User List: ", numList)

# Get info for every stock chosen. 
def get_data():
    for ticker in numList:
        ticker_yahoo = yf.Ticker(ticker)
        data = ticker_yahoo.history(period = "1d", interval="1m")
        data = (data.tail(1).iloc[0])
        pd[ticker] = data 
    
    print(pd)
    
get_data()
4

0 回答 0