Can any one help me to learn how to use the Finvasia API in python? Also explain how to place an order and how to get the order book?
Sign Up to Expert Bucket to ask questions, answer people’s questions, and connect with other people.
Login to Expert Bucket to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In order to use the Finvasia API in Python, you will first need to sign up for an API key on the Finvasia website. Once you have an API key, you can use the requests library in Python to make API calls to the Finvasia API.
Here is an example of how to use the requests library to make a GET request to the Finvasia API:
This example will make a GET request to the
/v2/instruments
endpoint of the Finvasia API and print the JSON response. You can substitute this endpoint with other endpoints from Finvasia API to get different information.Please refer to the Finvasia API documentation for more information on the available endpoints and how to use them.
Placing an order using Finvasia API
To place an order using the Finvasia API in Python, you will need to make a POST request to the
/v2/orders
endpoint of the API. You will need to pass in the necessary information for the order, such as the instrument, quantity, and order type, in the body of the request.Here is an example of how to place an order using the requests library in Python:
This example will make a POST request to the
/v2/orders
endpoint of the Finvasia API, passing in the necessary information for the order in the body of the request, and print the JSON response.Please note that the instrument_token value in the data json object can be obtained by using the
/v2/instruments
endpoint of the API.Also, Please refer to the Finvasia API documentation for more information on the available parameters of the
/v2/orders
endpoint and how to use them.Getting the order book using Finvasia API in Python
To get the order book using the Finvasia API in Python, you will need to make a GET request to the
/v2/orderbook
endpoint of the API. You will need to pass in the necessary information for the orderbook, such as the instrument_token.Here is an example of how to get the order book using the requests library in Python:
This example will make a GET request to the
/v2/orderbook/instrument_token
endpoint of the Finvasia API, passing in the instrument_token, and print the JSON response.Please note that the instrument_token value should be replaced with the instrument token of the instrument whose orderbook you want to get.
Also, Please refer to the Finvasia API documentation for more information on the available parameters of the
/v2/orderbook
endpoint and how to use them.