I'd like to use vectorbt to backtest pairs trading strategies and need a way for an Indicator/Signal to go long on one pair and short on the other when the Indicator/Signal is true. From what I've seen the portfolio opens up a position for both pairs (i.e. both go long) when I need equal and opposite positions to be opened.
Example flow:
- Start portfolio with two pairs BTCUSD & ETHUSD
- The two pairs diverge beyond a given threshold. At this point the Indicator/Signal fires
- What I'd like is to create a SHORT position on BTCUSD & a LONG position on ETHUSD at the same time. From what I've seen by default vectorbt will either open a LONG on both pairs or a SHORT on both pairs.
- When the pairs converge close both positions
lose both positions.
It's step 3 above where I'm asking for help/guidance on what to do. I'm hoping there's an callback I can hook into or a way to target a given position direction at a given pair.
Thanks