简体   繁体   English

如何导入外汇数据并使用 yfinance 和 pandas 数据阅读器读取?

[英]how to import forex data and read it using yfinance and pandas data reader?

hello guys, hope you're doing well.大家好,希望你们一切都好。 i used a code that plots renko and counts the bars by importing the data of stocks from yahoo finance and it worked great, but i want to use forex data from yahoo finance in the code but it is not working.我使用了一个代码,该代码通过从 yahoo Finance 导入股票数据来绘制 renko 并计算条形图,效果很好,但我想在代码中使用来自 yahoo Finance 的外汇数据,但它不起作用。

Stocklist=['AAPL']
start='2016-1-1'
for stock in StockList:
data[stock]=pdr.get_data_yahoo(stock, start)

that's how i get stocks data and use it, but its not working for forex, for example EURUSD=X这就是我获取股票数据并使用它的方式,但它不适用于外汇,例如 EURUSD=X

start_date = dt.datetime.today()- dt.timedelta(4000) 
end_date = dt.datetime.today()
stock ="USDJPY=X"
data = yf.download(stock, start_date, end_date)

it worked in this way guys伙计们,它以这种方式工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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