Getting "Missing or empty field `exchange`" while placing order request

rameshsencha7
rameshsencha7 edited February 14 in Python client
I am trying to place order with https://api.kite.trade/orders/regular but unable to. Here is details :
Headers : {'X-Kite-Version': '3', 'Authorization': 'token XXXXXXXXX:XXXXXXXXXXX'} # Have masked api key and token
Body : {"exchange": "NSE", "tradingsymbol": "BANKNIFTY24FEB45900PE", "transaction_type": "BUY", "order_type": "SL-M", "quantity": "15", "price": 0, "product": "MIS", "validity": "DAY", "disclosed_quantity": 0, "trigger_price": "764.14", "squareoff": 0, "stoploss": 0, "trailing_stoploss": 0, "variety": "regular", "user_id": "XXXXX"} # Masked the user id
Endpoint : https://api.kite.trade/orders/regular
Request Method : POST

Here is my Python code :

url = "https://api.kite.trade/orders/regular"
payload = { "exchange" : "NSE",
"tradingsymbol" : f"{tradingsymbol}",
"transaction_type" : f"{txn_type}",
"order_type" : f"{order_type}",
"quantity" : f"{quantity}",
"price" : 0,
"product" :"MIS",
"validity" : "DAY",
"disclosed_quantity" : 0,
"trigger_price" : f"{trigger_price}",
"squareoff": 0,
"stoploss" : 0,
"trailing_stoploss" : 0,
"variety" : "regular",
"user_id" : "XXXXX"
}

payload_json = json.dumps(payload)
response = requests.request("POST", url, headers=headers, data=payload_json)


I am not sure what I am missing but any help is appreciated. Thanks in advance.
Sign In or Register to comment.