AutoTrader Web API Java library can be used for automated trading on Zerodha, Upstox, AliceBlue, Finvasia, Angel Broking.
Following steps need to be taken in order to use the Java Library.
You need to download the library jar.
Setup Java Project
Add the downloaded jar to your application’s classpath.
You need to make an instance of com.dakshata.autotrader.api.AutoTrader class. See the sample code below:
IAutoTrader autotrader = AutoTrader .createInstance("<your-api-key>", IAutoTrader.SERVER_URL);
You can find your API Key on AutoTrader Web.
You must share this instance across all of your application. There is no need to create an instance again and again.
Using the client is pretty straightforward, you invoke appropriate functions on the autotrader instance. For example,
// Place a regular order final IOperationResponse<String> response = autotrader .placeRegularOrder("ACC_NAME", "NSE", "BANKNIFTY_25-JUN-2020_FUT", TradeType.BUY, OrderType.MARKET, ProductType.INTRADAY, 20, 0f, 0f);
You can invoke a shutdown() method just before your application exits. This is not mandatory, but recommended.
A detailed explanation is provided for each function along with examples in the API documentation.
If you are interested to look at the code of this library, it is available on GitHub.