Python Library

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

Python 3.6 or higherDirect connectionAbout 5 minutesBroker independent
In short

The Python library lets your own code place and manage orders through AutoTrader Web. It talks to the platform directly over a secure web connection, so you do not need the Desktop Client. Install it with pip, add your API key, and the same code works on any supported broker.

What it is

The Python library is a broker independent trading client for Indian stock exchanges. You write your strategy once in Python 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 already build in Python, want full control over your logic, or run your strategy on a server.

How it connects

Python 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 Python is direct, you can skip the Desktop Client. Spreadsheet and charting tools use the bridge path instead.

Before you begin

Have these ready first:

  • Python 3.6 or higher, installed and available on your command line.
  • 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 with pip. The first command installs it. The second upgrades an existing install to the latest version.

# Install
python -m pip install AutoTrader-Web-API-Stocks-Developer

# Upgrade to the latest version
python -m pip install --upgrade AutoTrader-Web-API-Stocks-Developer

You can also download it manually from the package index, but pip is easier because it also pulls the one dependency (requests) for you.

Initialize

Create one AutoTrader instance and share it across your application. Pass your API key, which you can find in your account settings.

from com.dakshata.autotrader.api.AutoTrader import AutoTrader

autotrader = AutoTrader.create_instance('<your-api-key>', AutoTrader.SERVER_URL)

A minimal working example

This places one limit order, then prints the platform response. Replace the placeholder values with your own account and instrument.

from com.dakshata.autotrader.api.AutoTrader import AutoTrader

autotrader = AutoTrader.create_instance('<your-api-key>', AutoTrader.SERVER_URL)

# Place a regular limit order
response = autotrader.place_regular_order(
    'ABC123',        # your account
    '<exchange>',    # your exchange segment code
    'SBIN',          # trading symbol
    'BUY', 'LIMIT', 'INTRADAY',
    1, 330.35, 0.0)

print(response)

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.

Next steps

Was this page helpful?

Last updated 19 June 2026