1
$\begingroup$

I have coded a machine learning algo (sklearn) in Python, that uses different 'look back periods' for training a model, which is then used to predict future prices of a stock.

It has a 52% accuracy in predicting the future price. I now wish to build a simple strategy around this for backtesting. I am specifically interested in applying risk management, stoplosses, etc to test over a number of years.

Can anyone recommend a suitable Python-based backtesting platform for use with a sklearn ML algo that for each period looks back ata number of prior periods prices, trains a model, predicts future direction, and then issues orders to the backtesting platform?

Google has returned a whole range of options and so I am really after advice from anyone else that might have backtested a sklearn ML algo using a Python-based backtesting platform for recommendations...

Failing this, i might build a simple version myself.

Thank you!

$\endgroup$
1
  • $\begingroup$ I have heard of backtrader. Although it would be a good exercise in software development to write your own backtesting procedure :) $\endgroup$ Aug 2, 2022 at 20:37

1 Answer 1

1
$\begingroup$

MoonshotML is a backtesting framework specifically for machine learning strategies. It is part of QuantRocket. It supports rolling and expanding walk-forward optimization and integrates with scikit-learn among other Python ML libraries.

Disclaimer: I'm affiliated with QuantRocket.

$\endgroup$
1
  • $\begingroup$ Thanks Brian. I'm ideally looking for a free open source solution that I can run locally. $\endgroup$ Jul 3, 2022 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.