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

标签 python pandas algorithm yahoo-finance algorithmic-trading

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.

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

最佳答案

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

伙计们,它就是这样工作的

关于python - 如何导入外汇数据并使用 yfinance 和 pandas 数据阅读器读取它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72473338/

相关文章:

python - 为什么 Sphinx/pythonhosted.org 中没有显示数学公式?

python - 如何查找频率表键列是否包含列表中的所有值

python - 比较行,然后在必要时取出行

c# - 向最大值呈指数增长

python - 通过命令行选项从 Python 程序运行 unittest

python - 使用 python 根据公共(public)字段合并 2 个 csv 文件

python - 打印具有一组有效数字的 float (非科学)

python - 使用 pandas 将行转换为列

Python-将类似坐标的字符串附加到列表中

algorithm - 遍历给定大小的所有树