【发布时间】:2020-06-15 02:43:55
【问题描述】:
我目前正在使用 Alpha-Vantage 以 1 分钟的间隔获取财务数据。
amd=ts.get_intraday(symbol=symbol, outputsize='full', interval=interval)
amd=pd.DataFrame(amd[0])
amd.drop(amd.index[-1])
我得到以下输出
...
2020-03-02 09:37:00 46.1000 46.1265 45.7427 45.7427 701690.0
2020-03-02 09:36:00 46.0700 46.0700 45.9300 46.0500 725661.0
2020-03-02 09:35:00 46.1100 46.1100 46.1100 46.1100 484583.0
2020-03-02 09:34:00 46.7500 46.8000 46.3000 46.3447 614596.0
2020-03-02 09:33:00 46.9642 47.2300 46.6800 46.7400 528517.0
2020-03-02 09:32:00 47.6100 47.6100 46.7000 46.9800 770555.0
2020-03-02 09:31:00 47.4000 47.6800 47.1000 47.5500 3504998.0
2020-02-28 16:00:00 45.1500 45.5300 45.1400 45.4700 895713.0
2020-02-28 15:59:00 45.0900 45.1600 45.0100 45.1500 411553.0
2020-02-28 15:58:00 44.8750 45.0900 44.8400 45.0800 434739.0
2020-02-28 15:57:00 44.8400 44.9100 44.8100 44.8560 327619.0
2020-02-28 15:56:00 44.7500 44.9100 44.6800 44.8450 363272.0
2020-02-28 15:55:00 44.4800 44.7700 44.4604 44.7400 305512.0
...
如您所见,日期从 2 月 28 日跳到 3 月 2 日,这是理所当然的。但是,在 matplotlib 中绘制时...
amd['4. close'].plot()
plt.title('AMD')
plt.show()
...我得到下图,其中 mathplotlib compensates for the lack of data in weekends and at closed market 从一个数据点到另一个数据点画一条直线。
如何获得显示类似于 Yahoo Finance 或 Google Finance 股票图表的结果,它会忽略丢失的数据 (as in this example?
【问题讨论】:
标签: python pandas matplotlib plot stock