Error when Reading in Custom CSV Data
-
data = btfeeds.GenericCSVData(dataname='Data/ES_15min.csv',
time=1,
open=2,
high=3,
low=4,
close=5,
volume=-1,
openinterest=-1,
dtformat='%m-%d-%Y %H%M')This code gives me the following error: "re.error: redefinition of group name 'H' as group 6; was group 4 at position 133"
I cannot figure this out. Anyone else seen this? -
Full Error code:
-
Here is my data:
Loading in data:data = btfeeds.GenericCSVData(dataname='Data/ES_15min.csv', name='ES', fromdate=dt(2019, 1, 1), todate=dt(2019, 12, 31), time=1, open=2, high=3, low=4, close=5, volume=-1, openinterest=-1, dtformat=('%m-%d-%Y %H:%M'), tmformat=('%H:%M'))
-
Hello.
I think you should specify the datetime param:
data = btfeeds.GenericCSVData(dataname='Data/ES_15min.csv', name='ES', fromdate=dt(2019, 1, 1), todate=dt(2019, 12, 31), datetime=0, time=1, open=2, high=3, low=4, close=5, volume=-1, openinterest=-1, dtformat=('%m-%d-%Y %H:%M'), tmformat=('%H:%M'))
Read more here:
-
dataname (None)
-
name ()
-
compression (1)
-
timeframe (5)
-
fromdate (None)
-
todate (None)
-
sessionstart (None)
-
sessionend (None)
-
filters ([])
-
tz (None)
-
tzinput (None)
-
qcheck (0.0)
-
calendar (None)
-
headers (True)
-
separator (,)
-
nullvalue (nan)
-
dtformat (%Y-%m-%d %H:%M:%S)
-
tmformat (%H:%M:%S)
-
datetime (0)
-
time (-1)
-
open (1)
-
high (2)
-
low (3)
-
close (4)
-
volume (5)
-
openinterest (6)
-
-
@Parth-Patel said in Error when Reading in Custom CSV Data:
data = btfeeds.GenericCSVData(dataname='Data/ES_15min.csv',
name='ES',
fromdate=dt(2019, 1, 1),
todate=dt(2019, 12, 31),
time=1,
open=2,
high=3,
low=4,
close=5,
volume=-1,
openinterest=-1,
dtformat=('%m-%d-%Y %H:%M'),
tmformat=('%H:%M'))The problem is that you've specified the time format for both date and time columns
According to your data format, the date and time columns are separate, so the format of the date column should be
'%m-%d-%Y'
and the format of the time column should be'%H:%M'
(No need to specify
datetime=0
- it is a default )So the code may look like:
data = btfeeds.GenericCSVData(dataname='Data/ES_15min.csv', name='ES', fromdate=dt(2019, 1, 1), todate=dt(2019, 12, 31), time=1, open=2, high=3, low=4, close=5, volume=-1, openinterest=-1, dtformat='%m-%d-%Y', tmformat='%H:%M')
-
@vladisld I tried that already but then get the following error.
-
@Yaroslav-Horyslavets I tried that as well but no luck
-
please try:
dtformat='%m/%d/%Y'
-
@vladisld -_- wow I'm an idiot thank you