perpetual futures equivalent on backtrader
First of all, thanks for this awesome platform and this community forum. I have been a silent reader up until now but could need some help with the issue below to continue my algo trading journey:
What I want to do:
Test various trading strategies on perpetual future contracts as offered on Binance.
What I can do:
I understand the basic platform concepts (as far as i know, please correct me on this one if I'm mistaken) and can code up strategies for stock like assets, code up indicators, load data etc.
What doesn't work / what I'm unsure about:
I would like to configure the platform in a way that most accurately replicates cryptocurrency future trading on Binance. The discussion given in https://community.backtrader.com/topic/2132/unable-to-figure-out-leverage didn't help me to figure out what exactly i need in my case.
From my understanding I need the following settings:
(we don't actually receive cash when we buy perpetual short contracts on Binance)
cerebro.broker.setcommission(commission=0.0015, margin = None, mult = 2)
(indicates the commission for futures trades and the "leverage" on binance which is actually a multiplier if I get that right.)
Has anyone configured the platform for this case before? I'm running into trouble with rejected orders especially when trading several assets. On Binance, if I have 100$ and set the leverage to 2X that means that I can buy future contracts with a value of 110$ without any risk of rejection. It seems like this doesn't work on backtrader (using target_order_value or target_order_percent) with my current settings. If required, I will provide a code example but I presume this is a fairly general problem that is better described without example.
Thanks for your help,