scrtlabs / catalyst

An Algorithmic Trading Library for Crypto-Assets in Python
http://enigma.co
Apache License 2.0
2.49k stars 726 forks source link

order_target_value crashes on small deltas #412

Open avolution opened 6 years ago

avolution commented 6 years ago

When a position already exists and the delta between existing position and and the new value is too small you will get an

catalyst.exchange.exchange_errors.CreateOrderError: Unable to create order on exchange bitfinex bitfinex {"message":"Invalid order: minimum size for BTC/USD is 0.002"}.

In my opinion the function should not submit an order when the amount is below the exchange limit otherwise i have to implement my own "min order amount handling" what makes these function complete useless, cause then I have to reimplement the complete delta logic.

The same applies to catalyst.api.order_target_percent.

An idea would be a special parameter(for example: ignore_small_deltas, delta_threshold etc.) or a special exception type.

lenak25 commented 6 years ago

Thanks @avolution for bringing this up. We will look at it.