0

I have a csv file with 5m ohlc data, it looks like this:

T,O,H,L,C

2018-01-01 00:00:00+00:00, 13838.5, 13961, 13838, 13873

2018-01-01 00:05:00+00:00, 13873, 13920, 13800, 13800

2018-01-01 00:10:00+00:00, 13800, 13800.5, 13675, 13771.5

2018-01-01 00:15:00+00:00, 13771.5, 13795, 13711, 13769

I've found a script to download 1m and 5m data from Bitmex, but it seems like you can't directly download 15m candles, I've seen some similar questions where people tried to convert other timeframes but none of them worked for me.

I've tried resample('15Min').ohlc() but I get an error

TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'Index'.

Maybe I'm doing something wrong while reading my csv file:

ohlcv5 = pd.read_csv('5m.csv', names=['T', 'O', 'H', 'L', 'C'], index_col=0, parse_dates=[0])
Pavel
  • 3
  • 4
  • try remove `names=['T', 'O', 'H', 'L', 'C'],` and then use solution from dupe. – jezrael Jul 06 '20 at 11:21
  • @jezrael removed, this output looks a bit unhealthy now lol O ... C open high low ... high low close T 2020-07-01 04:30:00+00:00 9151.0 9152.0 9150.0 ... 9152.0 9150.0 9150.0 2020-07-01 04:45:00+00:00 9150.0 9154.5 9150.0 ... 9154.5 9154.0 9154.5 – Pavel Jul 06 '20 at 11:38
  • hmmm, if there is csv header is not possible use `name` paramater, because then get first row by original csv header. So it is reason why I suggest remove `names` – jezrael Jul 06 '20 at 11:39
  • I don't find that answer helpful, what is 'dr5minute', I changed it to a variable name to which I assigned csv data, and assigned s = 3, cuz I need 5 to 15m tf, but it runs forever @jezrael – Pavel Jul 06 '20 at 12:30

0 Answers0