gpt4 book ai didi

Python yFInance api如何获取收盘价而不是调整后的收盘价?

转载 作者:行者123 更新时间:2023-12-03 08:16:38 29 4
gpt4 key购买 nike

我正在尝试从 Devon DVN 的 yFinance API 获取收盘价。问题在于,API 在响应数据中将调整后的收盘价作为收盘价提供,而有时可能会有所不同。

据雅虎财经显示,天地网络2021年9月9日收盘股价为28.45,调整后收盘股价为27.96

enter image description here

在 yFinance 的 API 响应中,我得到的收盘股价为 27.96,这应该是调整后的值,而不是收盘值。

enter image description here

现在如何从 yFinance 获取收盘价而不是调整后的股价?

最佳答案

使用雅虎财经的下载功能,您可以同时获取收盘价和调整后的收盘价。

import yfinance as yf
data = yf.download("DVN", start='2021-09-01', end='2021-09-11')

data
Open High Low Close Adj Close Volume
Date
2021-08-31 29.660000 30.320000 29.420000 29.549999 29.041054 11534800
2021-09-01 29.400000 29.590000 27.670000 28.240000 27.753616 20559000
2021-09-02 28.600000 29.969999 28.600000 29.320000 28.815016 11711300
2021-09-03 29.209999 29.799999 29.000000 29.170000 28.667601 7305300
2021-09-07 28.900000 29.330000 28.730000 29.059999 28.559494 5939700
2021-09-08 29.250000 29.620001 28.030001 28.230000 27.743790 8874000
2021-09-09 28.010000 29.080000 27.730000 28.450001 27.960001 9205700
2021-09-10 28.700001 29.030001 28.020000 28.070000 28.070000 6581800

关于Python yFInance api如何获取收盘价而不是调整后的收盘价?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69192215/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com