@backtrader as a workaround could I import the same data twice and give it two different names?
Latest posts made by davider80
-
RE: How to combine leveraged and unleveraged position
-
RE: How to combine leveraged and unleveraged position
@backtrader Thank you for the feedback. So the closest I could get is to setup two instruments:
- Inst 1: BTCUSD (no leverage)
- Inst 2: BTCUSD (leverage 3x)
And use 70% of the cash to buy inst 1 and 30% on inst 2?
-
How to combine leveraged and unleveraged position
I would like to test a strategy that trades bitcoin with leveraged and unleveraged positions.
The strategy would run on bitfinex based on trend signal:Long signal:
- 100% of the USD is used to buy BTC with no leverage
- 30% of the bought BTC is used to open a margin long BTCUSD position with 3x leverage and 10% stop loss
Short signal:
- 100% of collateral is in USD
- 30% of the USD collateral is used to open a margin short position with 3x leverage and 10% stop loss
I have hard time to figure how to handle the long scenario. I could create two commissions with leverage=1 and leverage=2 on two instruments based on the same BTCUSD price.
But how can I tell the broker to use the bought BTC (instrument 1) as a collateral for the leverage position (instrument 2)?
I'm a bit confused about this point.
-
How to setup matplotlib for "retina" display (DPI 2x)
Just getting started on backtrader and I'm loving in it. I have a 4k display and I would double the matplotlibe resolution for a "retina" display. How can I do that? Thank you