Hello! I have seen a few other posts here related to this, but none of the answers seemed to help me.
I have a CSV that is hosted at a URL, and it has prices for a signal on a 5 minutes interval. The first few rows are something like:
Date,Value
2017-08-01 03:45:00,207.79
2017-08-01 03:50:00,208.02
2017-08-01 03:55:00,208.55
2017-08-01 04:00:00,209.75
2017-08-01 04:05:00,213.84
2017-08-01 04:10:00,213.35
2017-08-01 04:15:00,212.61
2017-08-01 04:20:00,212.58
Right now, I am simply trying to read the data and have it respect the correct times within the dataframe.
I have the code:
import pandas
def initialize(context):
fetch_csv('https://myserver/my.csv',
date_column='Date',
usecols=['Value'],
symbol='sig',
date_format='%Y-%m-%d %h:%m:%s')
def handle_data(context, data):
current_sig_price = data.current('sig', 'Value')
print current_sig_price
record(sig=current_sig_price)
As you can see, I have date_format='%Y-%m-%d %h:%m:%s'
, which appears to me to match the date(s) `2017-08-01 03:45:00, however, my printed statements in the logs show only the price being change being updated on a new date:
...
2017-08-01 15:56 PRINT 225.73
2017-08-01 15:57 PRINT 225.73
2017-08-01 15:58 PRINT 225.73
2017-08-01 15:59 PRINT 225.73
2017-08-01 16:00 PRINT 225.73
2017-08-02 09:31 PRINT 217.92
2017-08-02 09:32 PRINT 217.92
2017-08-02 09:33 PRINT 217.92
2017-08-02 09:34 PRINT 217.92
...
Does anyone have any idea how to get each dataframe sent to handle_data()
to properly respect the correct timestamps in my CSV? Is my date_format
correct?
Any help would be super appreciated! Thanks!