Skip to content

About

A hobby algorithmic-trading, technical-analysis & strategy-execution playground for the Indian equity markets.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

iTrading Application

A hobby algorithmic-trading, technical-analysis & strategy-execution playground for the Indian equity markets

Multi-broker connectivity · Real-time market data streaming · Rule-based automated analysis · Laddering, averaging & basket strategies

A weekend hobby project — built in 2024 and largely untouched since. I built this when I was 14 (I'm 16 now), to manage my family's three demat accounts from a single screen. It is shared as-is for learning and reference. The broker APIs it uses have almost certainly changed since, the code is admittedly messy in places, and none of the trading logic is tested, backtested or proven. Please don't use it with real money.

Platform .NET .NET Language UI Database


Table of Contents

  1. Overview
  2. Feature Catalogue
  3. Trading Strategies in Detail
  4. Solution Architecture
  5. Component Responsibilities
  6. Runtime Data Flow
  7. Design Patterns & Technical Highlights
  8. Technology Stack
  9. Repository Structure
  10. Getting Started
  11. Configuration
  12. Extensibility & Deployment
  13. License
  14. Disclaimer

1. Overview

iTrading Application is a Windows desktop trading terminal I built as a hobby to unify market data, technical analysis, and order execution for the National Stock Exchange (NSE) and Bombay Stock Exchange (BSE). The whole reason it exists is simple: my family holds three separate demat accounts, and juggling three broker apps to place the same orders was tedious — so I wrote one cockpit to research, screen, and execute across all of them from one place.

The platform pairs a WinForms / Syncfusion desktop experience with a layered domain + data-access core, a set of broker integration SDKs (Upstox and ICICI Direct Breeze), and a .NET 8 Worker Service for unattended background processing. A shared .NET Standard 2.0 domain library is consumed by both the .NET Framework desktop client and the modern .NET 8 worker — a single source of truth for entities and persistence.

Project status & honest notes

  • Built in 2024, effectively frozen since. No meaningful changes have been made after the initial build, so treat everything here as a snapshot in time.
  • A learning project by a teenager. I wrote the first version at 14 and I'm 16 now — so expect the enthusiasm (and the rough edges) of someone teaching themselves as they went.
  • The broker APIs are probably outdated. Upstox and ICICI Direct Breeze evolve their endpoints, auth flows and payloads regularly. Expect signatures, versions and responses in this repo to no longer match the live APIs — you'll need to update them before anything works end to end.
  • It's a hobby project, not a product. There are no guarantees, no support, and no promise of correctness.
  • The code is messy — that's known. It grew organically to scratch a personal itch. Naming, structure and commented-out experiments reflect that. Please read it in that spirit rather than as production reference code.

2. Feature Catalogue

Area Feature What it does
Dashboard Home & Watchlists Central cockpit with live quotes, watchlists, and navigation to every module.
Analysis Automated Analysis Scans a configurable scrip universe and flags trading signals based on indicators and candlestick patterns.
Analysis Technical Analysis Engine Ingests OHLC candles (broker history API or CSV) and computes momentum/trend indicators and candlestick patterns.
Strategy Price Laddering Generates a ladder of staggered sell orders across a price range to systematically scale out of a position.
Strategy Switch Plan Swaps an active laddering plan for a saved alternative for the same scrip.
Strategy Portfolio Averaging Places buy orders sized as a percentage of holdings at a discount to LTP, to average down cost.
Strategy Basket Buying Builds and executes a reusable basket of instruments as a coordinated multi-order operation.
Strategy Bulk Selling Sells across many holdings at once from a single screen.
Orders Order Management Place, modify, review, and track pending orders backed by a persisted order book.
Portfolio Funds & Holdings Margin, funds, holdings, positions, and MTF (Margin Trade Facility) instrument handling.
Market Data Real-Time Streaming WebSocket streaming of live quotes and order updates via the Upstox feeders.
Connectivity Multi-Broker Pluggable connectivity to Upstox and ICICI Direct Breeze.
Reporting Export & Docs PDF (iTextSharp) and Excel (Syncfusion XlsIO) export; built-in PDF viewer and notepad utilities.
Automation Background Worker A .NET 8 Worker Service host for scheduled / unattended tasks.

3. Trading Strategies in Detail

The platform's differentiator is its strategy modules, which turn discretionary intent into structured, multi-order execution plans. Each strategy is a dedicated feature module with its own screen, domain entities, and DAO-backed persistence.

3.1 Price Laddering (SellingStrategies/FrmLaddering)

A systematic scale-out strategy. The trader defines a price range and the engine builds a ladder of limit sell orders.

  • Inputs: scrip, From price, To price, Interval (step), shares per order, and an optional iteration cap.
  • Order generation: starting at From, orders are created at each price += Interval up to To (bounded by the iteration limit), each with the configured quantity.
  • Exchange awareness: enforces the NSE/BSE tick size (5 paisa for scrips priced above Rs. 250) and validates that ladder prices align to the tick.
  • Portfolio context: displays total quantity and the portfolio average so the ladder can be planned relative to cost basis.
  • Persistence: ladders are saved as reusable plans (ItLadderingSellingPlans) with their generated orders (ItLadderingSellingOrders), including plan notes.
  • Execution: selected ladder rows are pushed to the broker as live orders in one action.

3.2 Switch Plan (SellingStrategies/FrmSwitchPlan)

A companion to laddering that lets the trader swap the active plan for a scrip. It loads all saved laddering plans for the selected scrip/user (ItLadderingSellingPlansDAO), presents them with full metrics (range, interval, shares/order, order count, quantity, average price, total amount), and applies the chosen plan.

3.3 Portfolio Averaging (BulkStrategies/FrmAveraging)

An average-down strategy driven off current holdings.

  • Inputs: a discount percentage (below LTP) for the limit price and an averaging percentage of the existing holding quantity.
  • Computation: for each holding it derives LimitPrice = LTP - (LTP x discount%), snaps it to the correct tick size (0.01 or 0.05 depending on price band), and sizes the order as HoldingsQuantity x averaging%.
  • Live summary: recomputes limit prices, quantities, and an order summary on the fly as inputs change.
  • Execution: selected rows are submitted as buy orders to average the cost basis of the portfolio.

3.4 Basket Buying (BulkStrategies/FrmBasketBuying + FrmSelectBasket)

A basket order strategy for coordinated multi-instrument entries.

  • Baskets are named, reusable collections (ItBasketMaster) of instruments with per-instrument orders (ItBasketOrders) and notes.
  • On load, each basket line is enriched with live quotes (LTP and previous close) pulled via the Breeze getQuotes API.
  • Baskets can be created, edited, and re-executed, enabling repeatable thematic or index-style entries.

3.5 Bulk Selling (BulkStrategies/FrmBulkSelling)

A mass-exit screen that lets the trader liquidate across many holdings simultaneously from one grid, rather than placing individual orders per position.

3.6 Automated Analysis (Automation/FrmAutomatedAnalysis + TechnicalAnalysis)

The signal-generation engine that underpins strategy selection.

  • Iterates the scrip universe (ItScripMaster) and, for each instrument, runs TechnicalAnalysis.Analysis().
  • Sources candles from the Upstox History API or imported CSV files, using the instrument key derived from ISIN + exchange (NSE_EQ|..., BSE_EQ|...).
  • Computes indicators via Skender.Stock.Indicators and detects candlestick patterns, producing an AnalysisResult with a set of Indications.
  • Results are persisted (ItAutomatedAnalysisDAO) and surfaced for review, with auto-trade configuration held in ItAutoTradeConfig.

3A. Automated Trading (Experimental — Hobby Only)

Read this before anything else in this section. The automated-trading capability described below was an experiment for personal, hobby use only. It is not tested, not backtested, and not proven to be profitable or even correct. It was never intended to run unattended on real capital, and the wiring that would actually fire live orders is deliberately left commented out in the code. Do not treat any of this as a working trading bot or as financial advice.

3A.1 What it tries to do

The idea was to close the loop between the Automated Analysis engine (Section 3.6) and order placement: scan a universe of scrips, score each one against a bundle of technical signals, and — where an ItAutoTradeConfig profile opts in — stage an order sized and priced from that analysis. In practice it stops short of autonomously trading; a human is meant to review every suggestion before anything is sent to a broker.

3A.2 Signals it combines

TechnicalAnalysis.Analysis() blends several classic indicators (all computed with Skender.Stock.Indicators) into a set of Indications per scrip:

Signal Roughly how it's used
Long-term trend Higher-timeframe candles classified Bullish / Bearish / Neutral to set overall bias.
Intraday 3-EMA trend Short/medium/long EMA alignment for intraday direction.
RSI (14) Both an intraday and a long-term over-bought / over-sold read.
Stochastic (14,3,3) Momentum confirmation / reversal hints.
Parabolic SAR Trailing trend-flip signal.
SuperTrend (10, 3) ATR-based trend filter.
5/20 EMA crossover Intraday entry/exit crossover trigger.
ATR (14) Volatility measure used to derive stop-loss / take-profit distances.

The indications are combined (with the higher-timeframe trend acting as a gate) to decide whether a scrip is a candidate, and ATR is used to derive a suggested stop and target around the entry.

3A.3 How an order would be placed

When a candidate passes and its ItAutoTradeConfig is enabled, the intent was to submit a GTT (Good-Till-Triggered) order through the Upstox OrderApi — sized by the config's share count and priced from the analysis, with the ATR-derived stop and target attached. The plain market/limit PlaceOrder paths exist too but are commented out as a safety measure. Everything is logged and persisted so the run can be reviewed after the fact.

3A.4 Why technical analysis alone isn't enough

This matters enough to spell out. Technical indicators describe the past; they do not predict the future. A pile of green signals is not an edge. Real, sustainable trading decisions also need to account for things this project deliberately ignores or only glances at:

  • Fundamentals & valuation — earnings, balance sheet, sector health.
  • News, events & sentiment — results, policy, global cues, corporate actions.
  • Liquidity & microstructure — spreads, slippage, impact cost, and whether your order size even fills.
  • Risk & position sizing — portfolio-level exposure, correlation, drawdown limits.
  • Costs & taxes — brokerage, STT, and the reality that frequent trading erodes returns.
  • Robust validation — out-of-sample backtesting, walk-forward testing, and paper trading, none of which this project does.

Indicators can be one small input into a disciplined process, but on their own they are closer to pattern-matching noise than to a strategy. Treat the automation here as a learning exercise in wiring indicators to orders, not as something to point at your savings.


4. Solution Architecture

The system is a layered, modular monolith delivered across five .NET projects, separating presentation, domain logic, data access, and external integrations.

+----------------------------------------------------------------------+
|                          Presentation Layer                          |
|     iTradingApplication (WinForms + Syncfusion MDI Desktop Client)    |
|   Home . Orders . Automation . Bulk/Selling Strategies . Funds        |
+---------------+---------------------------------------+--------------+
				|                                        |
				v                                        v
+-------------------------------+        +------------------------------+
|   Domain & Data-Access Layer  |        |    Background Processing      |
|  iTradingApplication.Utilities|        |  iTradingApplication.         |
|   - Entities (domain models)  |        |  WorkerService (.NET 8)       |
|   - DAOs (repository pattern)  |        |  - BackgroundService host     |
|   - SqlServerDataAccessor      |        +------------------------------+
+---------------+---------------+
				|
				v
+-------------------------------+        +------------------------------+
|    Persistence (SQL Server)   |        |   Broker Integration SDKs     |
|      IT_* trading schema       |<------>|  - UpStoxClient (REST + WS)   |
+-------------------------------+        |  - BreezeConnect (ICICI)      |
										 +------------------------------+

Projects

Project Target Framework Responsibility
iTradingApplication .NET Framework 4.8.1 WinForms/Syncfusion MDI desktop client — all user-facing screens, the technical-analysis engine, and orchestration of broker calls.
iTradingApplication.Utilities .NET Standard 2.0 Reusable domain core: entity models, Data Access Objects (repository pattern), the SqlServerDataAccessor micro-ORM, registry helpers, and conversion utilities.
iTradingApplication.WorkerService .NET 8 Generic-host Worker Service (BackgroundService) for scheduled / unattended background jobs.
UpStoxClient .NET Framework / .NET Standard 2.0 Upstox brokerage SDK — Swagger-generated REST clients (Orders, Portfolio, Market Quotes, History, Charges, User) plus protobuf-based WebSocket market & portfolio feeders.
BreezeConnect .NET Framework ICICI Direct Breeze connectivity library for quotes, orders, and session handling.

5. Component Responsibilities

5.1 Presentation Layer — iTradingApplication

A Multiple Document Interface (MDI) WinForms application themed with Syncfusion Metro controls, organized by feature module:

Module Screens Purpose
Bootstrap Program.cs, FrmSelectAccount, FrmMainMDI Startup, TLS/culture setup, license registration, account selection, MDI shell.
Home FrmHome Central dashboard: watchlists, live quotes, navigation hub.
Automation FrmAutomatedAnalysis, TechnicalAnalysis Scans the scrip universe and runs the indicator/pattern analysis engine.
Bulk Strategies FrmBasketBuying, FrmAveraging, FrmBulkSelling, FrmSelectBasket Multi-instrument order construction, averaging, and bulk exits.
Selling Strategies FrmLaddering, FrmSwitchPlan Systematic scale-out via price ladders and plan switching.
Orders FrmOrders, FrmModiyOrder, FrmReviewOrders Order placement, modification, and review.
Funds FrmFunds Margin, funds, and holdings views.
Misc FrmFullQuote, FrmPdfViewer, FrmNotepad, FrmInputDate Supporting utilities and dialogs.

Cross-cutting bootstrap concerns (Program.cs): global exception handling, enforced TLS 1.2/1.3, en-IN culture with Indian number formatting, and shared application state (data accessor, current user, scrip master, stock cache, MTF instruments).

5.2 Domain & Data-Access Layer — iTradingApplication.Utilities

The reusable heart of the system.

  • Entities/ — POCO domain models mirroring the IT_* schema: ItPendingOrders, ItBasketMaster, ItBasketOrders, ItLadderingSellingPlans, ItLadderingSellingOrders, ItWatchlistMaster, ItScripMaster, ItApiUsers, ItAutoTradeConfig, ItAutomatedAnalysis, MtfInstrument, plus view/list models (OrderList, BasketList, PlanList, StockPortfolio).
  • DataAccess/ — one DAO per aggregate (*DAO), all deriving from a shared ImsDAO base exposing the configured SqlServerDataAccessor. DAOs contain hand-authored, parameterized SQL for CRUD operations.
  • Data/ — data-access primitives:
    • SqlServerDataAccessor — a micro-ORM over ADO.NET providing ExecuteNonQuery, GetScalarValue, dataset/reader helpers, transaction management, and command timeouts.
    • DbParameter — a lightweight, provider-agnostic parameter abstraction.
    • DbConnectionException — typed connectivity failure signaling.
  • Helpers — ConvertDBToList (result-set to entity mapping), MyRegistry (Windows Registry config), GetStockScriptList, and Utils.

5.3 Background Processing — iTradingApplication.WorkerService

A .NET 8 Generic Host application. Worker derives from BackgroundService and runs a cancellation-aware loop, structured for scheduled/unattended trading-support tasks. Uses Microsoft.Extensions.Logging and appsettings.json for configuration.

5.4 Integration Layer

UpStoxClient — a Swagger-generated + hand-extended SDK for the Upstox brokerage:

  • Api/ — typed REST clients: OrderApi/OrderV3Api, PortfolioApi, MarketQuoteApi/V3, HistoryApi/V3, ChargeApi, UserApi, LoginApi, OptionsApi, PostTradeApi, TradeProfitAndLossApi, WebsocketApi.
  • Client/ — ApiClient, Configuration, ExceptionFactory, accessor interfaces handling auth, serialization, and error mapping.
  • Model/ — request/response DTOs for orders, quotes, holdings, positions, brokerage, GTT, option chains, and P&L.
  • Feeder/ — protobuf-based WebSocket streaming: MarketDataStreamer/MarketDataFeeder and PortfolioDataStreamer/PortfolioDataFeeder deliver real-time MarketUpdate and OrderUpdate events.

BreezeConnect — ICICI Direct Breeze connectivity library for quotes (getQuotes), order routing, and session handling — a second broker back-end behind the same trading workflows.

5.5 Persistence — SQL Server

A relational IT_* schema stores the full trade lifecycle: users/API config, scrip master, watchlists, baskets and basket orders, laddering plans and orders, pending orders, and automated-analysis records. Access is exclusively through the DAO layer.


6. Runtime Data Flow

Analysis & Signal Generation

Scrip Universe (ItScripMaster)
   -> TechnicalAnalysis.Analysis()
	  -> History/Quote data (UpStoxClient REST | CSV import)
	  -> Indicators (Skender.Stock.Indicators) + Candlestick patterns
	  -> AnalysisResult (indications)
   -> Persisted via ItAutomatedAnalysisDAO -> presented in FrmAutomatedAnalysis

Strategy Order Execution

User (Laddering / Averaging / Basket / Bulk screen)
   -> Strategy engine builds order set (tick-size + quantity rules)
   -> Domain validation + entity build (ItLaddering* / ItBasket* / ItPendingOrders)
   -> Broker SDK (UpStoxClient OrderApi | BreezeConnect)
   -> Exchange (NSE / BSE)
   -> Order status <- WebSocket OrderUpdate feed
   -> Persisted via *DAO -> reflected in FrmReviewOrders

Real-Time Market Data

UpStox WebSocket -> MarketDataStreamer (protobuf decode)
   -> MarketUpdate events -> StockCache / live UI grids (FrmHome, FrmFullQuote)

7. Design Patterns & Technical Highlights

  • Layered / N-tier architecture — presentation, domain, data-access, and integration concerns are physically separated into distinct assemblies, keeping the WinForms client thin and the domain reusable across the client and the worker.
  • Repository (DAO) pattern — every aggregate is fronted by a dedicated *DAO deriving from a shared ImsDAO base, isolating SQL from business logic.
  • Micro-ORM data access — SqlServerDataAccessor centralizes ADO.NET connection management, parameterization (DbParameter), transactions, and command timeouts; ConvertDBToList maps result sets to strongly-typed entities.
  • Adapter / abstraction over brokers — the domain interacts with brokerages through the UpStoxClient and BreezeConnect SDKs, enabling multiple broker back-ends behind consistent workflows.
  • Strategy-oriented feature modules — automation, bulk, and selling strategies are grouped into cohesive UI + logic + persistence modules.
  • Real-time streaming — protobuf-encoded WebSocket feeders deliver low-latency quotes and order updates.
  • Domain-accurate exchange rules — tick-size enforcement (0.01 / 0.05 bands) and instrument-key derivation from ISIN + exchange.
  • Resilient host — global exception handlers in the desktop client and structured ILogger logging in the worker.
  • Modern TLS & localization — enforced TLS 1.2/1.3 for API calls and en-IN culture with Indian number formatting.

8. Technology Stack

Category Technologies
Languages / Runtimes C#, .NET Framework 4.8.1 / 4.7.x, .NET Standard 2.0, .NET 8
Desktop UI Windows Forms, Syncfusion Essential Studio (Metro theming, grids, XlsIO)
Data & Persistence Microsoft SQL Server, ADO.NET (System.Data.SqlClient)
Market Analytics Skender.Stock.Indicators, Candlestick-Patterns, Trady, YahooQuotesApi
Broker Integrations Upstox (REST + protobuf WebSocket), ICICI Direct Breeze
Serialization / Interop Newtonsoft.Json, System.Text.Json, Protocol Buffers, RestSharp, CsvHelper
Reporting iTextSharp (PDF), Syncfusion XlsIO (Excel)
Background Services .NET Generic Host, BackgroundService, Microsoft.Extensions.Logging

9. Repository Structure

iTradingApplication.sln
|
+-- iTradingApplication/                 # WinForms desktop client (presentation)
|   +-- Automation/                      #   Automated analysis + TechnicalAnalysis engine
|   +-- BulkStrategies/                  #   Averaging, Basket Buying, Bulk Selling, Select Basket
|   +-- SellingStrategies/               #   Laddering, Switch Plan
|   +-- Orders/                          #   Place / Modify / Review order screens
|   +-- Misc/                            #   Full quote, PDF viewer, notepad, input dialogs
|   +-- Program.cs                       #   Application entry point & bootstrap
|
+-- iTradingApplication.Utilities/       # Domain core (.NET Standard 2.0)
|   +-- Entities/                        #   Domain models (IT_* schema)
|   +-- DataAccess/                      #   DAO repositories
|   +-- Data/                            #   SqlServerDataAccessor, DbParameter, exceptions
|
+-- iTradingApplication.WorkerService/   # .NET 8 background worker
|
+-- UpStoxClient/                        # Upstox brokerage SDK (REST + WebSocket feeders)
|   +-- Api/  Client/  Model/  Feeder/
|
+-- Breeze/                              # ICICI Direct Breeze connectivity library
|
+-- Db_Config_Script.sql                 # SQL Server schema — creates all IT_* tables
+-- LICENSE                              # MIT license
+-- .gitignore                           # Ignored build output, IDE files, secrets
+-- README.md                            # You are here

10. Getting Started

Prerequisites

  • Windows 10/11
  • Visual Studio 2022 / 2026 with .NET desktop development and .NET 8 workloads
  • Microsoft SQL Server (local or remote) with the IT_* trading schema
  • Valid API credentials for Upstox and/or ICICI Direct Breeze
  • A licensed Syncfusion Essential Studio key

First-run checklist

  1. Create the database & schema. Create an empty SQL Server database, then run Db_Config_Script.sql against it to create all IT_* tables:

    # Using sqlcmd (adjust -S server / -d database as needed)
    sqlcmd -S localhost -d iTrading -i .\Db_Config_Script.sql

    Or open Db_Config_Script.sql in SQL Server Management Studio / Visual Studio and execute it against your target database.

  2. Configure app-level settings (registry) and add your demat accounts (the IT_ApiUsers table) — see Section 11. Configuration for the exact values and copy-paste snippets.

  3. Build & run:

    # Restore and build the full solution
    dotnet restore iTradingApplication.sln
    msbuild iTradingApplication.sln /p:Configuration=Debug
    
    # Launch the desktop client from Visual Studio (set iTradingApplication as startup project)
    # Launch the background worker
    dotnet run --project iTradingApplication.WorkerService
  4. Pick an account in the startup screen (FrmSelectAccount) and log it in to obtain a live session token.


11. Configuration

Runtime settings are resolved from the Windows Registry (via MyRegistry) and app configuration. There are two layers to configure: app-level settings (in the Windows Registry) and per-account settings (rows in the SQL Server IT_ApiUsers table). The three demat accounts this was built for are simply three rows in that table.

11.1 App-level settings (Windows Registry)

On first run, Program.cs reads these from HKEY_CURRENT_USER\SOFTWARE\Oshnic\iTradingApplication. Create the key and values yourself (Registry Editor, or the snippet below):

Value name Type Purpose
Lov_ConnectionString String SQL Server connection string used in Debug builds.
Lov_ConnectionStringPro String SQL Server connection string used in Release builds.
UpStoxAPIKey String Your Upstox app's API key (from the Upstox developer console).
UpStoxAPISecret String Your Upstox app's API secret.

A quick way to set them (adjust to your server / credentials):

$base = 'HKCU:\SOFTWARE\Oshnic\iTradingApplication'
New-Item -Path $base -Force | Out-Null
Set-ItemProperty -Path $base -Name 'Lov_ConnectionString'    -Value 'Server=localhost;Database=iTrading;Trusted_Connection=True;TrustServerCertificate=True;'
Set-ItemProperty -Path $base -Name 'Lov_ConnectionStringPro' -Value 'Server=localhost;Database=iTrading;Trusted_Connection=True;TrustServerCertificate=True;'
Set-ItemProperty -Path $base -Name 'UpStoxAPIKey'    -Value '<your-upstox-api-key>'
Set-ItemProperty -Path $base -Name 'UpStoxAPISecret' -Value '<your-upstox-api-secret>'

Getting Upstox API credentials: create a free developer app at the Upstox developer portal, which gives you an API key and API secret. Set the app's redirect URL to whatever the login flow in this project expects. (Upstox has changed its OAuth flow since 2024, so double-check the current docs.)

The Syncfusion license is registered inline in Program.cs and the worker's log levels live in appsettings.json:

Setting Location Purpose
Syncfusion License Program.cs Syncfusion runtime license registration — replace with your own community/licensed key.
Worker logging appsettings.json Log levels for the background service.

11.2 Per-account settings (the IT_ApiUsers table)

Make sure you've already created the schema by running Db_Config_Script.sql (see First-run checklist). Each demat account is then one row in IT_ApiUsers. FrmSelectAccount lists every active account at startup so you can pick which one to trade from — this is exactly how the three-account workflow works.

Column What to put in it
UserFullName A friendly label for the account (e.g. "Mum – Upstox"), shown in the account picker.
UserLoginId The broker login / client ID for that account.
UserApiKey Per-account API key (where the broker issues one per account).
UserSecretKey Per-account API secret.
UserApiSessionKey The access/session token obtained after login — refreshed by the app's login flow.
UserApiSessionExpiry When that session token expires (accounts are only offered if this is in the future).
UserFavGlobalScrip Optional default/favourite scrip for the account.
IsActive 1 to make the account selectable, 0 to hide it.

Add your three accounts with something like:

INSERT INTO IT_ApiUsers
    (UserFullName, UserLoginId, UserApiKey, UserSecretKey, UserApiSessionKey, UserApiSessionExpiry, UserFavGlobalScrip, IsActive)
VALUES
    ('Account 1 – Upstox', '<login-id-1>', '<api-key-1>', '<secret-1>', '', GETDATE(), '', 1),
    ('Account 2 – Upstox', '<login-id-2>', '<api-key-2>', '<secret-2>', '', GETDATE(), '', 1),
    ('Account 3 – Upstox', '<login-id-3>', '<api-key-3>', '<secret-3>', '', GETDATE(), '', 1);

UserApiSessionKey / UserApiSessionExpiry start empty and are populated when you log the account in through the app. The rest of the IT_* schema (scrip master, watchlists, baskets, laddering plans, pending orders, analysis records) is populated as you use the corresponding screens.

Secrets that may appear in source history are illustrative only. Provide your own credentials and connection strings, and never commit real keys.


12. Extensibility & Deployment

Extensibility points

  • Add a broker — implement a new integration assembly mirroring UpStoxClient/BreezeConnect and wire it behind the existing order/quote workflows.
  • Add an indicator or pattern — extend TechnicalAnalysis with additional Skender.Stock.Indicators calculations or candlestick detectors.
  • Add a strategy — create a new feature module (screen + logic) alongside BulkStrategies / SellingStrategies, plus its supporting entity and DAO.
  • Add a background job — register additional hosted services in the Worker Service host.

Deployment topology

+-----------------------------+         +------------------------------+
|  Trader Workstation (Win)   |         |   Server / Scheduled Host     |
|  iTradingApplication.exe    |         |  iTradingApplication.         |
|  (WinForms desktop client)  |         |  WorkerService (.NET 8)       |
+--------------+--------------+         +---------------+--------------+
			   |                                          |
			   +--------------+---------------------------+
							  v
				 +----------------------------+
				 |  SQL Server (IT_* schema)  |
				 +----------------------------+
							  ^
							  | REST + WebSocket
			  +---------------+----------------+
			  |  Upstox API   .   ICICI Breeze  |
			  +--------------------------------+

13. License

Released under the MIT License — see LICENSE for the full text. In short: you're free to use, copy, modify, and distribute this code, with no warranty of any kind.

Note: the bundled broker SDKs carry their own terms — e.g. the ICICI Direct Breeze library under Breeze/ has its own LICENSE. Third-party NuGet packages (Syncfusion, Skender.Stock.Indicators, iTextSharp, etc.) remain under their respective licenses; you must supply your own Syncfusion license key.


14. Disclaimer

This is a hobby project, provided as-is for educational and personal purposes only. It is not investment advice, not a product, and comes with no warranty or support of any kind.

  • It was built in 2024 and has not been maintained since — the Upstox and ICICI Direct Breeze APIs it relies on are very likely outdated, and the integration will need updating before it functions.
  • The automated-analysis and automated-trading logic is experimental, untested and unproven. Technical analysis alone is not a trading strategy (see Section 3A).
  • Trading in financial instruments involves substantial risk of loss. The author accepts no liability for any financial losses, damages, or other consequences arising from use of this software.
  • If you experiment with it, do so only against broker sandbox / paper-trading environments with credentials you control — never with real money you can't afford to lose.

Built with C# · .NET · Syncfusion · SQL Server

About

A hobby algorithmic-trading, technical-analysis & strategy-execution playground for the Indian equity markets.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages