Java Library
Place and manage orders from your own Java code, on any supported broker, with one set of functions.
The Java library lets you place and manage orders from your own Java code. Add it through Gradle or Maven, create one AutoTrader instance with your API key, then call functions like placeRegularOrder. The same code works on any supported broker.
What it is
The Java library is a broker independent trading client for Indian stock exchanges. You write your strategy once in Java and run it against any broker that AutoTrader Web supports. The same function calls work everywhere, so changing broker does not mean rewriting your code.
It is a good fit if you build on the JVM, want full control over your logic, or run your strategy on a server.
How it connects
Java is a direct client. Your code calls AutoTrader Web over a secure web connection, and AutoTrader Web passes each instruction on to your broker. Nothing extra needs to run on your computer.
Because Java is direct, you can skip the Desktop Client. Spreadsheet and charting tools use the bridge path instead.
Before you begin
Have these ready first:
- A Java project built with Gradle or Maven.
- An AutoTrader Web account. Your strategy runs through it.
- An API key. Generate it in your account settings, then keep it private.
- At least one broker account added, so your orders have somewhere to go.
Install
Install the library in the way that matches your build system.
Gradle
- Add the repository to your
build.gradlefile.
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
maven {
url "https://raw.githubusercontent.com/stocks-developer/autotrader-maven-repo/main"
}
}
- Add the dependency.
dependencies {
implementation 'com.dakshata:at-api:3.1.0'
}
Maven
- Add the repository to your
pom.xmlfile.
<repositories>
<repository>
<id>stocks-developer</id>
<url>https://raw.githubusercontent.com/stocks-developer/autotrader-maven-repo/main</url>
</repository>
</repositories>
- Add the dependency.
<dependency>
<groupId>com.dakshata</groupId>
<artifactId>at-api</artifactId>
<version>3.1.0</version>
</dependency>
Initialize
Create one AutoTrader instance and share it across your application. Pass your API key, which you can find in your account settings.
IAutoTrader autotrader = AutoTrader.createInstance("<your-api-key>");
You do not need to create it again and again. One instance is enough for the whole application.
A minimal working example
This places one regular order. Replace the placeholder values with your own account and instrument.
// Place a regular order
final IOperationResponse<String> response = autotrader.placeRegularOrder(
"ACC_NAME", "<exchange>", "SBIN",
TradeType.BUY, OrderType.MARKET, ProductType.INTRADAY,
1, 0f, 0f);
The same instance also handles bracket and cover orders, modify, cancel, square-off, and reading orders, positions and margins. Each function is documented with examples in the API reference.
Shutdown
You can call shutdown() just before your application exits. This is optional but recommended.
autotrader.shutdown(); Next steps
Thanks for the feedback. Still stuck? Contact support.
Last updated 23 June 2026