LUCIT-Systems-and-Development / unicorn-binance-rest-api

A Python SDK by LUCIT to use the Binance REST API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, us, tr) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-rest-api.docs.lucit.tech
Other
61 stars 17 forks source link

Futures Rest Api throws errors on placing STOP or TAKE_PROFIT or STOP_MARKET or LIMIT orders #14

Closed djangoengine closed 2 years ago

djangoengine commented 2 years ago

Hi Oliver, Thanks for your prompt response on UBWA, I quickly looked up your rest-API which is similar to python-binance. I was using the futures_create_order method to place STOP order or TAKE_PROFIT as order type to modify positions.

I have been through Binance futures documentation at https://binance-docs.github.io/apidocs/futures/en/#new-order-trade provided all required mandatory parameters However which ever way I modify the code, it throws errors.

Have you had this kind of issue?

binance.exceptions.BinanceAPIException: APIError(code=-1102): A mandatory parameter was not sent, was empty/null, or malformed.

` traded_order=self.client.futures_create_order(symbol= self.symbol, \

newClientOrderId=clientorderId,

                    side= "BUY",  
                    positionSide= "LONG",           
                    # timeInForce= 'GTC', \
                    quantity= qty,\
                    type="TAKE_PROFIT",

                    # price= price ,\  not mandatory

                    stopPrice= price, \
                    workingType= 'MARK_PRICE',  

                    priceProtect='TRUE',\
                    timeInForce='GTC',
                    # callbackRate= 'float' ,\
                    # activationPrice= 'float', \

                    newOrderRespType= 'ACK',\
                    timestamp=timestamp

    )`
djangoengine commented 2 years ago

Solved the issue, was not using price as manadatory parameter

oliver-zehentleitner commented 2 years ago

I have seen A mandatory parameter was not sent, was empty/null, or malformed. so many times :D

Its a response from Binance and is allways related to submitted parameters....