使用熊猫数据帧分析时间序列数据

我有一些下面的时间序列数据,我想对它们做一些具体的分析

"timestamp","epic","closeprice_bid","closeprice_ask","last_traded_volume"
"2020-03-24 12:00:00","KA.D.BARC.DAILY.IP","91.17","91.38","7836277"
"2020-03-24 13:00:00","KA.D.BARC.DAILY.IP","90.33","90.66","8001075"
"2020-03-24 14:00:00","KA.D.BARC.DAILY.IP","89.96","90.22","11490520"
"2020-03-24 15:00:00","KA.D.BARC.DAILY.IP","91.62","91.89","9014323"
"2020-03-24 16:00:00","KA.D.BARC.DAILY.IP","93.84","94.23","7270054"
"2020-03-24 16:00:00","KA.D.BARC.DAILY.IP","93.84","94.23","7270054.0"
"2020-03-25 08:00:00","KA.D.BARC.DAILY.IP","109.47","109.89","25414762.0"
"2020-03-25 08:00:00","KA.D.BARC.DAILY.IP","109.47","109.89","25414762

我想模拟一种基本的交易策略,借此使用pandas数据框,我可以通过以下方法分析时间序列数据:1)检查最后一个closeprice_bid与今天的第一个closeprice_bid之间是否存在≥1%或≤1%的差异2)每隔一小时的数据检查closeprice_bid是否为开盘closeprice_bid的≥3%或≤3%。

有人可以提供一些有关如何使用熊猫进行上述分析的指导吗?

我已使用以下代码将数据加载到df中:

cols = ['timestamp', 'epic', 'closeprice_bid', 'closeprice_ask','last_traded_volume']
stock_data = pd.read_csv('barc.csv', header=0, names=cols)
stock_data['closeprice_bid'] = pd.to_numeric(stock_data['closeprice_bid'], errors='coerce')
评论