• Home
  • Products
    • Login
    • Product Info
    • User Guide
    • Pricing
  • Services
    • Stock Brokers
    • Freelancers
  • Help
    • Documentation
    • Knowledge Base
    • FAQ
  • Company
    • About Us
    • Contact Us
    • Terms & Conditions
  • Home
  • Products
    • Login
    • Product Info
    • User Guide
    • Pricing
  • Services
    • Stock Brokers
    • Freelancers
  • Help
    • Documentation
    • Knowledge Base
    • FAQ
  • Company
    • About Us
    • Contact Us
    • Terms & Conditions

AutoTrader Web

home/Documentation/AutoTrader Web
Expand All Collapse All
  • Index
  • Getting Started
  • Portfolio Management System (PMS)
  •  Copy Trading (Master-Child Auto-Copy)
    • Master-Child Copy - Performance
  • PMS vs Master-Child
  • Trading View
  •  Supported Brokers
    • Symphony XTS
    • Zerodha
    • Angel Broking
    • Dhan
    • Aliceblue
    • Fyers
    • Nuvama
    • IIFL
    • Zebu
    • Finvasia
    • Motilal Oswal
    • Kotak
    • Mastertrust
    • Five Paisa
    • Choice Broking
    • FlatTrade
    • Tradejini
    • Upstox
    • SAS Online
    • Profitmart
  •  Client Setup
    • Desktop Client
    • AmiBroker Library
    • Excel Library or Tools
    • Java Library
    • MetaTrader Library
    • C# Library
    • Python Library
    • HTTP REST
  •  User Interface
    • User Registration
    •   Settings
      • General
      • Trading Accounts
      • Pseudo Accounts
      • Group Accounts
      • API Key
    •   AutoTrader
      • Activity
      • Instruments
    •   Trading
      • Summary
      • Positions
      • Orders
      • Margins
      • Holdings
      • Trade
    •   User
      • Account
      • Profile
  •  API (Application Programming Interface)
    • Place Regular Order
    • Place Cover Order
    • Place Bracket Order
    • Place Advanced Order
    • Cancel Order
    • Cancel Child Orders
    • Cancel All Orders
    • Modify Order
    • Modify Order Price
    • Modify Order Quantity
    • Square-off Position
    • Square-off Portfolio
    • Read Orders
    • Read Positions
    • Read Margins
    • Read Holdings
    • Read Portfolio Summary
    • Fetch All Trading Accounts
    • Create or Update Trading Account
    • Validate Trading Account Credentials
    • API Parameters
    • API Rate Limits
    • Email Limits
    • Postman
  • Pricing
  • Precautions
  •  Broker Independence
    • API Functions
    • Pseudo Account
    • Instruments (Trading Symbols)
  • Quantity Multiplier
  • Architecture

C# Library

11213 views July 8, 2022 Pritesh 12

AutoTrader Web API C# library can be used for automated trading on Supports leading Indian Stock Brokers.

Following steps need to be taken in order to use the C# Library.

Download

The library is available on Nuget. So you can easily install it in your C# project.

See instructions on “How to install a package from Nuget?“

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>",
	AutoTrader.SERVER_URL);

You can find your API Key on AutoTrader Web.

Usage

Using the client is pretty straightforward, you invoke appropriate functions on the autotrader instance. All functions can be learned from API documentation. For example,

using com.dakshata.autotrader.api;
using com.dakshata.constants.trading;
using com.dakshata.data.model.common;
using com.dakshata.trading.model.platform;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace csharp_library_tests
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();

				// IMPORTANT : Add your autotrader api key here & use your Pseudo Account
				
                IAutoTrader autoTrader = AutoTrader.CreateInstance(
                    "f4xcxa1f-efd7-4587-ad8e-ce4743b25395",
                    "https://api.stocksdeveloper.in");

                //IOperationResponse<ISet<string>> result = autoTrader.FetchLivePseudoAccounts();
                //Console.WriteLine("Message: {0}", result.Message);
                //Console.WriteLine("Result: {0}", result.Result.Count);

                //IOperationResponse<bool?> r2 = autoTrader.CancelOrderByPlatformId("XX1234", "200831101595372");
                //Console.WriteLine("Message: {0}", r2.Message);
                //Console.WriteLine("Result: {0}", r2.Result);

                //IOperationResponse<bool?> r3 = autoTrader.CancelChildOrdersByPlatformId("XX1234", "200831000170161");
                //Console.WriteLine("Message: {0}", r3.Message);
                //Console.WriteLine("Result: {0}", r3.Result);

                // IOperationResponse<bool?> r4 = autoTrader.ModifyOrderByPlatformId("XX1234", "200831101805912",
                //    null, null, 279.2f, null);
                // Console.WriteLine("Message: {0}", r4.Message);
                // Console.WriteLine("Result: {0}", r4.Result);

                //IOperationResponse<string> r5 = autoTrader.PlaceRegularOrder("XX1234", "NSE", "SBIN", TradeType.BUY,
                //    OrderType.LIMIT, ProductType.INTRADAY, 2, 214.55f, 0);
                //Console.WriteLine("Message: {0}", r5.Message);
                //Console.WriteLine("Result: {0}", r5.Result);

                //IOperationResponse<string> r6 = autoTrader.PlaceBracketOrder("XX1234", "NSE", "SBIN", TradeType.SELL, 
                //    OrderType.LIMIT, 3, 220f, 0, 2, 3, 0);
                //Console.WriteLine("Message: {0}", r6.Message);
                //Console.WriteLine("Result: {0}", r6.Result);

                //IOperationResponse<string> r7 = autoTrader.PlaceCoverOrder("XX1234", "NSE", "SBIN", TradeType.SELL,
                //    OrderType.MARKET, 3, 0, 218.4f);
                //Console.WriteLine("Message: {0}", r7.Message);
                //Console.WriteLine("Result: {0}", r7.Result);

                //IOperationResponse<bool?> r8 = autoTrader.SquareOffPosition("XX1234", PositionCategory.DAY,
                //    PositionType.CO, "NSE", "SBIN");
                //Console.WriteLine("Message: {0}", r8.Message);
                //Console.WriteLine("Result: {0}", r8.Result);

                //IOperationResponse<bool?> r9 = autoTrader.SquareOffPortfolio("XX1234", PositionCategory.DAY);
                //Console.WriteLine("Message: {0}", r9.Message);
                //Console.WriteLine("Result: {0}", r9.Result);

                IOperationResponse<ISet<PlatformMargin>> r10 = autoTrader.ReadPlatformMargins("XX1234");
                Console.WriteLine("Message: {0}", r10.Message);
                foreach (PlatformMargin p in r10.Result)
                    Console.WriteLine("{0}", p);

                IOperationResponse<ISet<PlatformOrder>> r11 = autoTrader.ReadPlatformOrders("XX1234");
                Console.WriteLine("Message: {0}", r11.Message);
                foreach (PlatformOrder p in r11.Result)
                    Console.WriteLine("{0}", p);

                IOperationResponse<ISet<PlatformPosition>> r12 = autoTrader.ReadPlatformPositions("XX1234");
                Console.WriteLine("Message: {0}", r12.Message);
                foreach(PlatformPosition p in r12.Result)
                    Console.WriteLine("{0}", p);

                stopwatch.Stop();
                Console.WriteLine("Elapsed Time is {0} ms", stopwatch.ElapsedMilliseconds);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception caught: {0}", e);
            }
            Console.ReadLine();
        }
    }
}

API Functions

Note: 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.

Was this helpful?

12 Yes  No
Related Articles
  • Master-Child Copy – Performance
  • Tradejini
  • Dhan
  • FlatTrade
  • Supported Brokers
  • Symphony XTS

© 2025 Stocks Developer. All Rights Reserved.