Margin Calculation Error Response 400

neel2323
neel2323 edited January 2021 in General
Hey!

I used https://curl.trillworks.com/ to convert curl to python as below.
import requests

headers = {
'X-Kite-Version': '3',
'Authorization': 'token api_key:access_token',
'Content-Type': 'application/json',
}

data = '[ { "exchange": "NSE", "tradingsymbol": "INFY", "transaction_type": "BUY", "variety": "regular", "product": "CNC", "order_type": "MARKET", "quantity": 1, "price": 0, "trigger_price": 0 } ]'

response = requests.post('https://api.kite.trade/margins/orders', headers=headers, data=data)
I get 'Response [400]' error when I execute the above. What is the error?
  • rakeshr
    @neel2323
    Everything seems to be correct. Can you print the response text and paste it here?
    print(response.text)
  • neel2323
    Hi Rakesh!

    I was new to using Response command and hence when I used to print response I used to get Response [400]. Worked when I did response.text. Thank you!
This discussion has been closed.