Missing value error while placing GTT order

Amit2308
Amit2308 edited August 2020 in Python client
I am getting following error:
Traceback (most recent call last):
File "C:\Users\amits\OneDrive\Desktop\Avant Garde\alicetest.py", line 77, in
trigger_id= kite.place_gtt(trigger_type=kite.GTT_TYPE_OCO, tradingsymbol=ci, exchange='NFO', trigger_values=TRIGGER, last_price=y1, orders=ORDER)
File "C:\Users\amits\AppData\Local\Programs\Python\Python37\lib\site-packages\kiteconnect\connect.py", line 725, in place_gtt
condition, gtt_orders = self._get_gtt_payload(trigger_type, tradingsymbol, exchange, trigger_values, last_price, orders)
File "C:\Users\amits\AppData\Local\Programs\Python\Python37\lib\site-packages\kiteconnect\connect.py", line 694, in _get_gtt_payload
raise ex.InputException("`{req}` missing inside orders".format(req=req))
kiteconnect.exceptions.InputException: `quantity` missing inside orders
[Finished in 1.9s with exit code 1]

while placing the following order:

token= 256265

x=kite.ohlc(token)
o=float(x[str(token)]['ohlc'].get('open'))

a=o//100
call_strike=int(a*100)
put_strike=call_strike+100

expiry_date= '20806'

instrument= 'NIFTY'
ci= instrument + expiry_date + str(call_strike) + 'CE'
pi= instrument + expiry_date + str(put_strike) + 'PE'
call_instrument= 'NFO:' + instrument + expiry_date + str(call_strike) + 'CE'
put_instrument= 'NFO:' + instrument + expiry_date + str(put_strike) + 'PE'

#print(call_instrument)

call_x=kite.ltp(call_instrument)
#print(call_x)
call_token=str(call_x[call_instrument].get('instrument_token'))

put_x=kite.ltp(put_instrument)
#print(put_x)
put_token=str(put_x[put_instrument].get('instrument_token'))
#print(call_token)
#print(put_token)
x=kite.ltp(call_token)
y1=float(x[str(call_token)].get('last_price'))
ORDER= [
{
"exchange":"NFO",
"tradingsymbol": ci,
"transaction_type": kite.TRANSACTION_TYPE_SELL,
"quantity": 75,
"order_type": "LIMIT",
"product": "NRML",
"price": 225.0
},
{
"exchange":"NFO",
"tradingsymbol": ci,
"transaction_type": kite.TRANSACTION_TYPE_SELL,
"quantity": 75,
"order_type": "LIMIT",
"product": "NRML",
"price": 200.0
}
]


trigger_id= kite.place_gtt(trigger_type=kite.GTT_TYPE_OCO, tradingsymbol=ci, exchange='NFO', trigger_values=[200.0,225.0], last_price=y1, orders=ORDER)

Can anyone please help me with spotting the error??
Sign In or Register to comment.