sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
6.07k stars 2.21k forks source link

Futures Create Order sends error response on placing STOP or TAKE_PROFIT orders. #1085

Open djangoengine opened 2 years ago

djangoengine commented 2 years ago

Describe the bug I have been using the marker order function with no issues. I tried to use STOP or TAKE_PROFIT functionality to take profit or prevent losses.

binance.exceptions.BinanceAPIException: APIError(code=-4014): Price not increased by tick size.

To Reproduce Code snippet to reproduce the behavior:

` timestamp=datetime.timestamp(datetime.now()) traded_order=self.client.futures_create_order(symbol= self.symbol, \

                    side= "BUY",  
                    positionSide= "LONG",           
                    quantity= qty,\
                    type="STOP",            
                    stopPrice= stopprice, \
                                            price=price,
                    workingType= 'MARK_PRICE', 
                    priceProtect='TRUE',\
                    timeInForce='GTC',
                    newOrderRespType= 'ACK',\
                    timestamp=timestamp

    )`
Chan0920 commented 2 years ago

Hi, i faced this issue before. This has nothing to do with the functionality but its with regards to either the prices over the ticker price or something similar.

vinxayak-xii commented 2 years ago

Hi, i faced this issue before. This has nothing to do with the functionality but its with regards to either the prices over the ticker price or something similar.

hey, i couldn't find how to get open futures trades or how to open a futures trade in the documentation, could you please link it for me.

djangoengine commented 2 years ago

client.futures_create_order is the method to open futures trade

mhawry commented 2 years ago

This happens when the limit or stop price isn't rounded to the required tick size. See the answers to #1116 for examples on how to round a limit or stop price for a given symbol.