Kucoin / kucoin-futures-python-sdk

MIT License
7 stars 3 forks source link

400-{"code":"100000","msg":"JSON parse error: Cannot deserialize value of type `java.lang.Long` from String \"12.0\": not a valid `java.lang.Long` value; "} #43

Open WooKaiZen opened 1 year ago

WooKaiZen commented 1 year ago

Hi, as soon as I use "create_limit_order" with a floating-point quantity (/order size) I get the error: 400-{"code":"100000","msg":"JSON parse error: Cannot deserialize value of type java.lang.Long from String \"12.5\": not a valid java.lang.Long value; "} whereas with size 12 the order goes through. That's an issue when trading coins with a relatively high price if you can't trade decimal positions. Thanks for any help Wkz

DarkSquirr3l commented 1 year ago

I believe this is to do with the interpretation of your "size" input, and the minimum position size for the ticker. For example with ETHUSDTM, the minimum position size is 0.01ETH. order = client.create_limit_order(symbol='ETHUSDTM', side='buy', lever='1', size='1', price='1000') The above would create an order for 0.01 ETH. Size minimum order size. Whereas ; order = client.create_limit_order(symbol='ETHUSDTM', side='buy', lever='1', size='100', price='1000') Size is set at 100, but will place an order for 1ETH, 100 0.01(min size). You'll need to check the minimum order size per ticker, and adjust your size value accordingly.

WooKaiZen commented 1 year ago

Hi thank you Yes it seems so, in the futures API in contract list (https://docs.kucoin.com/futures/#get-open-contract-list), the 'multiplier' parameter returns the factor by which the quantity is multiplied when posting an order. E.g. if you post an order with size 1 for SHIB, it opens a position on 100000 SHIB, as you said.