Why is Zerodha throwing Invalid params error in GTT?

29 views Asked by At

I am trying to place GTT order in Python without KiteConnect but constantly getting 'Invalid order params' error. Please tell what I am doing wrong as GET request is working perfectly but not POST.

def place_gtt_order(self):
  orders = [{
  "exchange": "NSE",
  "tradingsymbol": "INFY",
  "transaction_type": "SELL",
  "quantity": 1,
  "order_type": "LIMIT",
  "product": "CNC",
  "price": 702.5
  }]
  params = {}
  params["orders"] = orders
  params["type"] = 'single'
  params["condition"] = {
    "exchange": 'NSE',
    "tradingsymbol": 'INFY',
    "trigger_values": [702.0],
    "last_price": self.ltp("NSE:" + 'INFY')
  }

  response = self.session.post("https://api.kite.trade/gtt/triggers",
                               data=params, headers=self.headers).json()
  return response

Response comes out to be

{'status': 'error', 'message': 'Invalid order params.', 'data': None, 'error_type': 'InputException'}

TIA

0

There are 0 answers