C# Library
Place and manage orders from your own .NET code, on any supported broker, with one set of functions.
The C# library lets you automate trading from your own .NET code. Install it from NuGet, create one AutoTrader instance with your API key, then call functions like place order, modify order, or read positions. The same code works on any supported broker.
What it is
The C# library is a broker independent trading client for Indian stock exchanges. You write your strategy once in .NET 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 in C#, want full control over your logic, or run your strategy on a server.
How it connects
C# 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 C# 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 .NET project where you can add a NuGet package.
- 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
The library is published on NuGet, so you can add it to any C# project.
- Package: StocksDeveloper.AutoTraderWeb.Api
- Help installing: Install and use a NuGet package in Visual Studio
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>",
AutoTrader.SERVER_URL);
A minimal working example
This reads the live positions for one account, then prints them. The same instance handles placing, modifying and cancelling orders too.
using com.dakshata.autotrader.api;
using com.dakshata.trading.model.platform;
IAutoTrader autoTrader = AutoTrader.CreateInstance(
"<your-api-key>",
AutoTrader.SERVER_URL);
// Read live positions for a pseudo account
IOperationResponse<ISet<PlatformPosition>> response =
autoTrader.ReadPlatformPositions("ABC123");
Console.WriteLine("Message: {0}", response.Message);
foreach (PlatformPosition p in response.Result)
Console.WriteLine("{0}", p);
To place an order instead, call PlaceRegularOrder with your account, "<exchange>", a symbol such as "SBIN", the trade type, order type and product type. Each function is documented with examples in the API reference. Common ones: place a regular order, modify an order, cancel an order, read positions, and square off a position.
Next steps
Thanks for the feedback. Still stuck? Contact support.
Last updated 19 June 2026