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.
Download
You need to download the library jar.
Setup Java Project
Add the downloaded jar to your application’s classpath.
Initialize
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.
Usage
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);
Shutdown
You can invoke a shutdown() method just before your application exits. This is not mandatory, but recommended.
autotrader.shutdown();
API Functions
A detailed explanation is provided for each function along with examples in the API documentation.
GitHub
If you are interested to look at the code of this library, it is available on GitHub.