enzoampil / fastquant

fastquant — Backtest and optimize your ML trading strategies with only 3 lines of code!
MIT License
1.48k stars 236 forks source link

Fix Shorting functionality #413

Closed mikeejazmines closed 2 years ago

mikeejazmines commented 2 years ago

Description

I noticed that shorting did not completely work yet. I fixed the shorting logic so that it follows the following steps:

If buy signal:

If sell signal:

Notebook under examples is labelled as 2022-03-01-backtest_crypto_short

Testing worked as expected:

Screen Shot 2022-03-04 at 2 43 12 PM

Long only orders: Screen Shot 2022-03-04 at 2 51 22 PM

Long and short orders: Screen Shot 2022-03-04 at 2 51 55 PM

General results: Screen Shot 2022-03-04 at 2 52 20 PM

Checklist