How to activate the API in Alice Blue for Automated Trading
Getting Started with Alice Blue API
Alice Blue API is a set of rest APIs that provide data required to build a complete investment and trading platform. Execute orders in real-time, manage user portfolios, stream live market data (using Websocket), and more, with the easy-to-understand API collection.
The AliceBlue App
To be able to use AliceBlue APIs you need to create an App in the Developer Console and generate your apiKey
and apiSecret
. You can use a redirect URL which will be called after the login flow.
It is highly recommended that you do not include the apiSecret
in your code while sharing in public places like GitHub. It will make your app vulnerable to threats and potential issues.
In this article, We shall discuss How to create an app in the Developer Console. Once the app is created, Your API is called “activated”.
Steps for Getting the API Key
Step 1: Head over to the Developer Console. Use Your credentials to login there.
Step 2: Click on “Authorize” and authorize it. So, this app is authorized to trade and perform other tasks on your behalf [Read the permissions listed above].
Step 3: Once You authorize, it will ask you to create Mpin. Its a 4 digit pin of extra security (or, You can call extra headache). Now, the main dashboard will appear –
Note that – It allows us to create multiple apps. You can use multiple apps to structure your different strategies and other plans.
Step 4: Click “Create New App”.
Step 5: As You can see in the image below there are several fields. You can put anything in the Vendor Name and other fields except Redirect URL
and Post Back URL
unless You’re a developer yourself who knows how the OAuth Authorization System works (You can google this term. This is the name of the mechanism which is being discussed here).
Enter the Redirect URL
and Post Back URL
as https://ant.aliceblueonline.com/plugin/callback.
Step 6: Click “Save”.
You will see the old dashboard page again with our newly created app.
Step 7: Click on “Edit”.
Step 8: Copy the ‘App Code’ and ‘Secret Key’.
If You have accidentally leaked your ‘App Secret’ in public like me, You can just regenerate them or delete and re-create the app.
API Secret and Secret Key is the same thing! Anyways, Congratulations, Your Trading API is now activated.
Well –
- If You’ve opened your Aliceblue account with us, We will provide you with lots of sample code and tools developed over this Trading API.
- If You have any questions, feel free to ask in our forum.
- If you have spotted any issues in the wrapper, nudge in the Github.