Replies: 1 comment
-
There was a mistake, which I have now fixed, although the fix has not been released yet. But, nan is not due to that error. If you used the data in the repo, it's too short to run the GLFT example. Please see Data Preparation. If you have your own data collection, refer to Data for guidance on conversion. Alternatively, you can purchase data from Tardis.dev and use the conversion utility provided in the first document. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was trying to run the GLFT example (5 day backtest with grid orders), which uses -
and snapshot='data/ethusdt_20221002_eod.npz'
I couldn't find ethusdt data in the repo so I used the data preparation notebook to create btcusdt_20230405 and btcusdt_20230404_eod and tried running the notebook. I'm getting this error-
"=========== Summary ===========
Sharpe ratio: nan
Sortino ratio: nan
Risk return ratio: nan
Annualised return: 0.00 %
Max. draw down: -0.00 %
The number of trades per day: 0
Avg. daily trading volume: 0
Avg. daily trading amount: 0
/usr/local/lib/python3.10/dist-packages/hftbacktest/stat.py:310: RuntimeWarning: invalid value encountered in scalar divide
rrr = ar / mdd
TypeError Traceback (most recent call last)
in <cell line: 5>()
3 out = gridtrading_glft_mm(hbt, stat.recorder)
4
----> 5 stat.summary(capital=10_000)
/usr/local/lib/python3.10/dist-packages/hftbacktest/stat.py in summary(self, capital, resample, trading_days)
327 print('Avg. daily trading volume: %d' % dtq)
328 print('Avg. daily trading amount: %d' % dta)
--> 329 print('Avg. daily turnover (trading amount/capital): %.2f %%' % dta / capital * 100)
330 print('Return per trade (bp): %.2f' % ar / (dta * trading_days) * 10000)
331
TypeError: unsupported operand type(s) for /: 'str' and 'int' "
How can I create .npz files for ethusdt_20221003 (or any pair in general) so that I can replicate the backtest results?
This backtest engine is lit. Love the examples too. Definitely going to contribute once I get a hang of this.
Beta Was this translation helpful? Give feedback.
All reactions