Is it possible to backtest a pairs trade? #317
Unanswered
tankorsmash
asked this question in
Q&A
Replies: 1 comment
-
Shorting an instrument is like going long its inverse. Therefore, if you have BTCUSD and ETHUSD and want to buy BTC and short ETH, let's say, you need to buy a derived instrument:
You can pass this Alternatively, you could run two backtests, sync their signals, and afterwards combine their result |
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'd like to short one symbol and go long another at the same time.
I've got all the OLHC data for both combined into one dataframe as separate columns, but it doesn't seem like the library supports going long and shorting at the same time, since they're different prices/columns during the same bar/row.
backtesting.py
'slast_price()
usesself.data._Close
so it doesn't look like it supports any sort of customization there.A solution that seems I could try on my own is to run two backtests and then combine their results somehow.
Beta Was this translation helpful? Give feedback.
All reactions