kiteconnect.exceptions.InputException: Invalid `price` while placing GTT order

Rajneesh_12
I place a GTT OCO order like this -
sl = 0.995*ltp 
target = 1.05*ltp
sl_price = tick_size * round(sl/tick_size)
target = target * round(target/tick_size)
    order_dict = [{"transaction_type": t_type_sl , "quantity": quantity, 
'order_type': kite.ORDER_TYPE_LIMIT, "product": product_type , "price": sl_price},
{"transaction_type": t_type_sl , "quantity": quantity,
'order_type': kite.ORDER_TYPE_LIMIT, "product": product_type , "price": target}
]
trigger_id = kite.place_gtt(kite.GTT_TYPE_OCO, symbol, exchange, [sl_price, target], ltp, order_dict)
Facing error kiteconnect.exceptions.InputException: Invalid `price`

This worked for some stocks like YESBANK etc. But gave the above error for RELIANCE.

Tagged:
  • rakeshr
    @Rajneesh_12
    Can you paste the complete debug log here for the above request?
    We are not able to generate the above inputException of Invalid `price` at our end.
    Also, re-check if you are sending correct values for transaction_type, product and quantity.
  • Rajneesh_12
    Traceback (most recent call last):
    File "D:\coolStuff\Zerodha\strategy_PSAR.py", line 106, in main
    placeGTTOrder(kite, ticker,"buy",quantity,sl, target, ltp_buy, exchange_type, trigger_id_gtt, product_type)
    File "D:\coolStuff\Zerodha\utils.py", line 127, in placeGTTOrder
    trigger_id = kite.place_gtt(kite.GTT_TYPE_OCO, symbol, exchange, [sl_price, target], ltp, order_dict)
    File "C:\Users\prama\.conda\envs\zerodha\lib\site-packages\kiteconnect\connect.py", line 727, in place_gtt
    return self._post("gtt.place", params={
    File "C:\Users\prama\.conda\envs\zerodha\lib\site-packages\kiteconnect\connect.py", line 830, in _post
    return self._request(route, "POST", url_args=url_args, params=params, is_json=is_json)
    File "C:\Users\prama\.conda\envs\zerodha\lib\site-packages\kiteconnect\connect.py", line 898, in _request
    raise exp(data["message"], code=r.status_code)
    kiteconnect.exceptions.InputException: Invalid `price`.
  • Rajneesh_12
    One thing that I found was -
    target = target * round(target/tick_size)
    should be
    target = tick_size* round(target/tick_size)
    So in case of REL already ltp was high and target got unreasonably higher due to this mistake.
    So this might be the issue.
Sign In or Register to comment.