Hi, I am trying to place a new order through POST /fapi/v1/order
using python requests.
Whenever I post, I get error code -2013 with the message “Order does not exist”.
The weird thing is that this error message seems like a message for GET /fapi/v1/order
when there is no order exists.
So I checked response.history
and response.request
, and noticed that there have been 301 redirection, and the request was GET.
What am I doing wrong?
Following is a snippet of my code.
headers = {'X-MBX-APIKEY': MY_API_KEY}
url = "https://binance.com/fapi/v1/order"
query = {
'symbol': 'BTCUSDT',
'side': 'BUY',
'type': 'MARKET',
'quantity': 0.001,
'timestamp': some_timestamp
}
query['signature'] = signature_of(query)
query_string = urlencode(query)
r = requests.post(url, params=query, headers=headers)
print(r.json()) // {'code': -2013, 'msg': 'Order does not exist.'}
print(r.history) // [<Response [301]]
print(r.request) // <PreparedRequest [GET]>