python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

Unable to get a FULL response from create an order

Open Bamorem opened this issue 4 years ago • 8 comments

Describe the bug I create an order via client.create_order() with the parameter newOrderRespType = 'FULL', but the result or when I get the order via client.get_all_orders() the order structure is 'RESULT'

To Reproduce resultSell = client.create_order(symbol='BTCUSDT', side='SELL', type='LIMIT', timeInForce='GTC', quantity=QUANTITY, price=PRICE, newClientOrderId = persoOrderId, newOrderRespType = 'FULL') // result is : {'symbol': 'BTCUSDT', 'orderId': XXXX, 'orderListId': -1, 'clientOrderId': 'XXXX', 'price': 'XXXX', 'origQty': 'XXXX', 'executedQty': 'XXXX', 'cummulativeQuoteQty': 'XXXX', 'status': 'FILLED', 'timeInForce': 'GTC', 'type': 'LIMIT', 'side': 'BUY', 'stopPrice': 'XXXX', 'icebergQty': 'XXXX', 'time': XXXX, 'updateTime': XXXX, 'isWorking': True, 'origQuoteOrderQty': 'XXXX'}

Expected behavior So the issue is that i don't get the array 'fills' which contain the commission price/asset;

Environment (please complete the following information):

  • Python version: 3.6.1
  • OS: Mac / Ubuntu
  • python-binance version 0.7.5

Bamorem avatar Apr 19 '20 06:04 Bamorem

@Bamorem I have reading the source code, I found the request client.create_order() is a plain post to binance API service. you can use curl to reproduce the result, see the different.

xiaods avatar Apr 26 '20 06:04 xiaods

Hi @xiaods , yes i did create an order with curl and I see that it get's the fills parameters. image

Is python-binance use the v3 by default or maybe i need to specify somewhere ?

Bamorem avatar Apr 27 '20 06:04 Bamorem

I snippet from python-binance source code.

   PUBLIC_API_VERSION = 'v1'
    PRIVATE_API_VERSION = 'v3'
    WITHDRAW_API_VERSION = 'v3'
    MARGIN_API_VERSION = 'v1'
    FUTURES_API_VERSION = 'v1'

xiaods avatar Apr 27 '20 06:04 xiaods

@xiaods, just tested again and yes the create.order return me the fills parameter, but when i do a get order from the orderId once it has been FILLED I don't get the fills parameter anymore... is the fills param only of not completed orders ?

Bamorem avatar Apr 27 '20 08:04 Bamorem

@Bamorem I think you need carefully compare the binance api result json. it is not python-binance's bug anymore I think so.

xiaods avatar Apr 27 '20 12:04 xiaods

Hey guys, came across this string and I cannot get any response from an order let alone 'FULL'. I can't seem to find an example in the docs. What am i not grasping? If i print lmt_order i just get an empty dictionary. Any help appreciated! lmt_order = client.create_test_order( symbol = 'BTCUSDT', side = 'BUY', type = 'LIMIT', timeInForce = 'GTC', quantity = foo, price = bar, newOrderRespType = 'FULL' )

cjd33g8n avatar Sep 18 '20 04:09 cjd33g8n

Hey guys, came across this string and I cannot get any response from an order let alone 'FULL'. I can't seem to find an example in the docs. What am i not grasping? If i print lmt_order i just get an empty dictionary. Any help appreciated! lmt_order = client.create_test_order( symbol = 'BTCUSDT', side = 'BUY', type = 'LIMIT', timeInForce = 'GTC', quantity = foo, price = bar, newOrderRespType = 'FULL' )

Upon further troubleshooting, the python-binance uses the requests library in case anyone finds this useful. print(client.response.json())

cjd33g8n avatar Sep 18 '20 22:09 cjd33g8n

Hey guys, came across this string and I cannot get any response from an order let alone 'FULL'. I can't seem to find an example in the docs. What am i not grasping? If i print lmt_order i just get an empty dictionary. Any help appreciated! lmt_order = client.create_test_order( symbol = 'BTCUSDT', side = 'BUY', type = 'LIMIT', timeInForce = 'GTC', quantity = foo, price = bar, newOrderRespType = 'FULL' )

Upon further troubleshooting, the python-binance uses the requests library in case anyone finds this useful. print(client.response.json())

You saved my life man! 4 hours of googling just to find your answer that FINALLY shows how to fking print the response to work with it further. Some of us want to save the order data into database guys at python-binance.

PLEASE add the response handling code into the official read-me

ghost avatar Apr 22 '21 00:04 ghost