What is the format of datetime in btcsvData?
-
@backtrader I am running btrun. The format of datetime is "%YYYY-%mm-%dd %HH:%MM:%SS" or "%YYYY-%mm-%ddT%HH:%MM:%SS", I used minutes level data, the datetime of first line is "2016-06-01T00:01:00", but the stanstat result display the datetime is "%YYYY-%mm-%dd 23:59:59.999989".
Id,bitfinex_BTCUSD_min_20160601_20160803_2,len,datetime,open,high,low,close,volume,openinterest,TestStrategy,len,datetime,Broker,len,cash,value,BuyS ell,len,buy,sell,Trades - Net Profit/Loss,len,pnlplus,pnlminus 1,bitfinex_BTCUSD_min_20160601_20160803_2,1,2016-06-01 23:59:59.999989,530.68,530.69,530.68,530.69,5.16764001,7.7e-05,TestStrategy,1,736116.99999999 99,Broker,1,10000.0,10000.0,BuySell,1,,,Trades - Net Profit/Loss,1,, code_text
What is the format of datetime in btcsvData?
-
Your problem is
timeframe
andcompression
, not being specified. -
My script is:
btrun --csvformat btcsv \ --data bitfinex_BTCUSD_min_20160601_20160803_2.csv \ --cash 10000 \ --commission 0.0035 \ --margin 10000 \ --cerebro \ --strategy ema_mean_reversion_strategy.py:TestStrategy:printlog=True,emaperiod=747,upper=31,lower=-28,trailpercent=12 \ --fromdate 2016-06-01T00:01:00 \ --todate 2016-08-03T02:02:00 \ --analyzer :SharpeRatio \ --writer csv=True > ~/Python-for-Finance1/automate_backtest_result.csv \ --timeframe minutes \ --compression 1
My csv file is:
Datetime,Open,High,Low,Close,Volume,openinterest 2016-06-01T00:01:00,530.68,530.69,530.68,530.69,5.16764001,7.7e-05
the result is the same.
I understanded the reason. the datetime column should be split to date and time columns. the datetime in result is correct. -
Went back to the drawing board and checked the format for
BacktraderCSVData
Date,Time,Open,High,Low,Close,Volume;OpenInterest
Where date has to look like this:
YYYY-MM-DD
(the separator can actually be anything)
And
time
has to look like this:HH:MM:SS
(again, the separator can be anything)
GenericCSVData
was not there whenbtrun
was written. Write a short script and use it. -
Thank you very much.