catalyst icon indicating copy to clipboard operation
catalyst copied to clipboard

Disable Leverage.

Open sekamaneka opened this issue 8 years ago • 3 comments

Dear Catalyst Maintainers,

is it possible to disable leverage/margin trading?

sekamaneka avatar Jan 13 '18 17:01 sekamaneka

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 running set_max_leverage(1.0) (also tried0.0) in initialize results in the error: AccountControlViolation: Account violates account constraint MaxLeverage({'max_leverage': 1.0}). (or 0.0)

  • Imported from catalyst.finance.controls import MaxLeverage and set MaxLeverage(1.0), (also tried 0.0), neither of which had any effect.

Not really sure where to go from here. Any help would be appreciated.

apovall avatar Nov 10 '18 21:11 apovall

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.

AvishaiW avatar Nov 12 '18 08:11 AvishaiW

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.

apovall avatar Nov 12 '18 20:11 apovall