top of page
My photo

TechBobbles
@Siddartha

  • Writer's pictureAdmin

How to start Trading with Kotak Neo Trade API?


k

Hey everyone! So, I recently dipped my toes into trading using Kotak's new API. Today, let's chat about diving into the nitty-gritty of Kotak Neo API login and how to kick-start your trading journey with it.




The below is the python script, we will discuss step by step.


pip install: This is the command used to install Python packages from the Python Package Index (PyPI) or from other sources.


Importing Libraries:

'neo_api_client' is a custom library that provides functionality to interact with the Neo trading API.


Defining Callback Functions:


These callback functions handle various events that may occur during the API interaction. For instance, on_message is triggered when a message is received, on_error is called in case of an error, on_open signifies the opening of a connection, and on_close indicates the closure of a connection.


Initializing the NeoAPI Client:

Here, we create an instance of the NeoAPI class from the neo_api_client library. We provide it with necessary authentication details such as consumer_key and consumer_secret, which are typically obtained when registering for access to the Neo trading API. The environment parameter specifies whether we're connecting to a production or a testing environment.


Logging in to the API:



This line initiates a login process to the Neo trading API using the provided mobile number and password.


Handling Two-Factor Authentication (2FA):

This section deals with the two-factor authentication (2FA) process, which provides an additional layer of security. The session_2fa method is used to submit the one-time password (OTP) received via SMS or you can use the PIN also.


Search Scrip:

Here, we search for a specific scrip (a financial instrument) within the Neo trading API. We specify parameters such as exchange segment, symbol, expiry date, option type, and strike price to narrow down the search.


Placing an Order:

This section attempts to place an order through the Neo trading API. We specify various parameters like exchange segment, product type, order type, quantity, validity, trading symbol, transaction type, and more to define the characteristics of the order.


This script provides a glimpse into the process of interacting with the Neo trading API using Python, covering essential steps such as authentication, handling 2FA, searching for scrips, and placing orders.


Reference:






Thanks for visiting 

Bangalore,

Siddartha1192@gmail.com

+919148014455

  • Linkedin
  • Wix Facebook page
  • Wix Twitter page
Subscribe to get exclusive updates

Thanks for visiting 

Bangalore,

Siddartha1192@gmail.com

+919148014455

  • Linkedin
  • Wix Facebook page
  • Wix Twitter page
Subscribe to get exclusive updates
bottom of page