blankly-finance / blankly

🚀 💸 Easily build, backtest and deploy your algo in just a few lines of code. Trade stocks, cryptos, and forex across exchanges w/ one package.
https://package.blankly.finance
GNU Lesser General Public License v3.0
2.03k stars 261 forks source link

Backtest results as pickle save or an other serialization format #227

Closed femtotrader closed 1 year ago

femtotrader commented 1 year ago

Hello,

when running a very long backtest it could be interesting to have "out of the box" a save (maybe a pickle object) of backtest results so it could be possible to watch backtest results but also watch any others actions what was performed during backtest (orders especially). This kind of mechanism is used by other backtester such a zipline.

Kind regards

PS : other serialization format could also be considered (cPickle, JSON, BSON, HDF5, Feather, Parquet, Jay...)

EmersonDove commented 1 year ago

I believe we have this functionality, all the information gathered from a backtest is returned after .backtest() completes as a BacktestResult object, which can be pickled I believe.

femtotrader commented 1 year ago

maybe the default behavior should be to output this pickled object (similar to bot.hml which is generated "by default")

EmersonDove commented 1 year ago

I"m not sure it should be default behavior but i could see better support for a pickle

femtotrader commented 1 year ago

An interesting use case could be to run a strategy compared to an other one (for example a strategy compared to buy and hold strategy). So we could draw a relative account plot in % (relative account plot, account plot relative to reference strategy ie benchmark % returns)

EmersonDove commented 1 year ago

Oh i agree with that. Originally the platform had this functionality, hopefully that can be self-hosted soon!