Disable Leverage.
Dear Catalyst Maintainers,
is it possible to disable leverage/margin trading?
Any update on this for crypto assets?
I've tried setting context.max_leverage() (from #481 ), which results in an error:
'ExchangeTradingAlgorithmBacktest' object has no attribute 'max_leverage'.
There's no reference in the documentation about leverage either (with the exception of a brief mention in the code here.
I'm just trying to avoid the negative cash that arises when buying and selling 100% of a position with order_target_percent(context.asset, x).
Edit: Tried a few more things, which didn't work either:
-
Through some bumbling around, I found references to max leverage controls in
catalyst/algorithm.py. -
Imported
from catalyst.api import set_max_leverage, but runningset_max_leverage(1.0)(also tried0.0) ininitializeresults in the error:AccountControlViolation: Account violates account constraint MaxLeverage({'max_leverage': 1.0}).(or0.0) -
Imported
from catalyst.finance.controls import MaxLeverageand setMaxLeverage(1.0), (also tried0.0), neither of which had any effect.
Not really sure where to go from here. Any help would be appreciated.
Sorry but currently the max_leverage does not work and therefore has no effect or mentioning in the API docs. We are aware of your problematic situation, however, we are swamped at the moment with other important tasks and it will take some time until we will get to this one. any contribution will be appreciated.
All good, just good to know what's going on. Thanks for letting us know. If I come up with anything I'll post it here.