Java Library

Place and manage orders from your own Java code, on any supported broker, with one set of functions.

Runs on the JVMDirect connectionAbout 5 minutesBroker independent
In short

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.

How clients reach your brokerTwo paths
DirectPython · Java · C# · HTTP REST
Your code
on your PC or a server
secure web
AutoTrader Web
the platform
Your broker
any supported broker
BridgeExcel · AmiBroker · MetaTrader
Your tool
spreadsheet / charts
request file
Desktop Client
runs on your PC
secure web
AutoTrader Web
then your broker

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

  1. Add the repository to your build.gradle file.
repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()

    maven {
        url "https://raw.githubusercontent.com/stocks-developer/autotrader-maven-repo/main"
    }
}
  1. Add the dependency.
dependencies {
    implementation 'com.dakshata:at-api:3.1.0'
}

Maven

  1. Add the repository to your pom.xml file.
<repositories>
    <repository>
        <id>stocks-developer</id>
        <url>https://raw.githubusercontent.com/stocks-developer/autotrader-maven-repo/main</url>
    </repository>
</repositories>
  1. 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

Was this page helpful?

Last updated 23 June 2026