kraken.spot.Trade.create_order
: Ability to use floats as trade amounts or prices
#94
Labels
Could
Something that could be cool bit is not really important
enhancement
New feature or request
Spot
Topic related to Spot trading
Milestone
The Kraken create_order API only allows string amounts and volumes, since it strictly enforces how many decimal points can be used in a way that is different per trade pair.
Python-Kraken-SDK's create_order on the other hand, says it allows float arguments, which is really nice as it seems to abstract away this pesky detail. However, if you try to use it with arbitrary float arguments, for example float(1/9), the Kraken API gives an error that there is an invalid number of decimal places provided.
So, we "kinda" support float arguments, but not really because they have to be a specific subset of float arguments that have the precice number of decimal places provided.
I'm not entirely sure what the "best" behavior would be. On one hand, I would like to be able to pass .5000000001 to create_order, and it knows to truncate it to .500000000. On the other hand, it might be considered "wrong" to place any order that isn't precicely what was asked for.
Maybe there can be a 'truncate' flag to create_order that truncates the amounts appropriately? Maybe by default it's not enabled, just so we don't confuse anyone, but a simple truncate=True would truncate the amounts to the correct number of decimal places.
I'm using this code currently as a work-around. It could be adapted pretty easily to create this Truncate feature, but before I offer a pull request, I want to make sure we agree this is an improvement.
truncate.py
tradeable_asset_pairs_get.py ( this is referenced by another issue too)
The text was updated successfully, but these errors were encountered: