Automation of Trades need two things –
The Strategy – Mostly we use logic using programs like Amibroker, NinjaTrader, Python, etc. to make entry trade and exit trade when certain conditions are met. To get that conditions one will be needing access to live price. The strategy also might need access to previous orders, pending orders, portfolio, holdings, etc. to make decisions.
The Execution – The code needs to place the order through the broker.
Now, although there are many alternative ways of getting price; the broker is needed to place the order. There are again two ways –
- Zerodha is currently charging 2k/month for using their API. So You purchase that. Read the documentation and integrate your stuff.
- Use Browser Automation. If you can log in and place the order by yourself in a browser, there has to be a way that a program can do it too! But it will test your coding skills!
Or, You can use some broker like Alice Blue (Python) or 5Paisa (.NET) is charging nothing for their API. Alice Blue usually charges 500/month normally (varies region to region) but I negged them to give API for free to my trading community Unofficed.
Here goes some headstart for the strategy part:
- vsjha18/nsetools – You can get live quotes of stock from the NSE website for free. (Please fetch the code in every 3 minutes, or NSE will permanently ban your IP. Otherwise, solve it with IP rotator.)
- swapniljariwala/nsepy – Similar stuff but it is more advanced. The documentation is not updated for decades but it has an active community.
- If you’re bad at coding; You can create an entry scanner and exit scanner in Chartink and automate the results. Here goes an example in code on how to fetch scanner results.
Here goes some headstart for the execution part:
- How to automate Zerodha using Selenium Here you can find code that will allow you to log in to Zerodha from code itself. Now, if you learn using Selenium – Automation is not a big issue!
- How to automate the Simple Moving Average Strategy using Alice Blue Here you can find a sample working code of a strategy for Alice Blue.
iPython Walkthrough of Zerodha Kite connect:
Getting Started with Zerodha
Buy on RSI
Change Time frame
Conversion Code of Candles to Hikenashi
Historical Data Download
Stock Screener (GUPPY)
Technical Indicators of Indian Stock Market
Trading Live Bot #1
Trading Live Bot #2
Trading Live Bot #3
Trading Live Bot #4
Trading Live Bot #5
If you’re developing something cool, feel free to say me hi!