I have already enabled the totp and regenerated the token.
Below is the full error message. not sure if i have overlooked something
Traceback (most recent call last): File "C:\Users\Ned\Desktop\Algo\test.py", line 29, in booksell_order() File "C:\Users\Ned\Desktop\Algo\test.py", line 21, in booksell_order kite.place_order(variety=kite.VARIETY_REGULAR, File "C:\Users\Ned\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 355, in place_order return self._post("order.place", File "C:\Users\Ned\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 841, in _post return self._request(route, "POST", url_args=url_args, params=params, is_json=is_json, query_params=query_params) File "C:\Users\Ned\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 913, in _request raise exp(data["message"], code=r.status_code) kiteconnect.exceptions.InputException: TOTP is mandatory to place orders on third-party apps. Learn how to set up TOTP for your account [here](https://support.zerodha.com/category/your-zerodha-account/login-credentials/login-credentials-of-trading-platforms/articles/time-based-otp-setup-mobile-only). [Finished in 3.1s]
We tried reproducing at our end using the same param. With TOTP enabled, the order is going fine for all the further requests. Make sure, you are using the same client id as added in the developer console.
If you want to place orders through Kite API, then you need to enable TOTP for your Zerodha account.
For TOTP setup refer this link
dir_path=os.path.normpath(os.getcwd() + os.sep + os.pardir)
dir_path2=os.path.dirname(os.path.realpath(__file__))
api_key=open(dir_path2 +"\\Access Details\\" +"api_key.txt","r").read()
access_token=open(dir_path2 +"\\Access Details\\" +"access_token.txt","r").read()
kite=KiteConnect(api_key=api_key)
kite.set_access_token(access_token)
def booksell_order():
kite.place_order(variety=kite.VARIETY_REGULAR,
exchange=kite.EXCHANGE_NSE,
tradingsymbol="ACC",
transaction_type=kite.TRANSACTION_TYPE_SELL,
quantity=1,
product=kite.PRODUCT_MIS,
order_type=kite.ORDER_TYPE_MARKET)
booksell_order()
Below is the full error message. not sure if i have overlooked something
Traceback (most recent call last):
File "C:\Users\Ned\Desktop\Algo\test.py", line 29, in
booksell_order()
File "C:\Users\Ned\Desktop\Algo\test.py", line 21, in booksell_order
kite.place_order(variety=kite.VARIETY_REGULAR,
File "C:\Users\Ned\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 355, in place_order
return self._post("order.place",
File "C:\Users\Ned\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 841, in _post
return self._request(route, "POST", url_args=url_args, params=params, is_json=is_json, query_params=query_params)
File "C:\Users\Ned\AppData\Local\Programs\Python\Python38\lib\site-packages\kiteconnect\connect.py", line 913, in _request
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.InputException: TOTP is mandatory to place orders on third-party apps. Learn how to set up TOTP for your account [here](https://support.zerodha.com/category/your-zerodha-account/login-credentials/login-credentials-of-trading-platforms/articles/time-based-otp-setup-mobile-only).
[Finished in 3.1s]
Make sure, you are using the same client id as added in the developer console.