An Indian market portfolio intelligence and risk terminal
Chanakya translates historical market data into portfolio-level risk metrics, sector exposures, and explicit data-freshness transparency.
Portfolio Overview: Captured portfolio analytics from a synthetic demo portfolio showing AnswerBand risk driver headline, total market value, unrealised P&L, annualised volatility, beta against NIFTY 50, sector exposure, and risk contribution breakdown across six holdings.
The problem and product goal
In Indian retail and semi-professional investing, portfolio tracking usually stops at total valuation, unadjusted profit and loss, and simple allocation percentages. What remains invisible is where the actual variability lives: which holdings contribute disproportionately to portfolio variability, how closely the basket tracks or diverges from NIFTY 50, and whether the underlying price data has accounted for corporate actions and stale market sessions.
I am building Chanakya as an Indian equity portfolio intelligence and risk terminal. Rather than providing buy or sell signals or automated trading, Chanakya focuses on analytical clarity: transforming historical daily equity prices and multi-factor macro inputs into portfolio-level risk metrics with defensible accounting and explicit data-freshness reporting.
Turning market data into portfolio-level answers
Chanakya aggregates multi-year historical NSE price records and macro series into a unified workspace. For any recorded portfolio, the analytics engine computes key structural figures from historical sessions:
- Portfolio Market Value & Unrealised P&L: Derived from adjusted daily closes against recorded purchase lots.
- Annualised Volatility & Market Beta: Calculated over 252 trading sessions against the NIFTY 50 benchmark with regression \(R^2\).
- Effective Position Count: Inverse Herfindahl-Hirschman concentration index (\(1 / \sum w_i^2\)) measuring true diversification versus nominal holding count.
- Sector Exposure: Market value decomposition across standard Indian equity sectors.
- Contribution to Modelled Portfolio Volatility: Marginal risk decomposition identifying which holdings drive portfolio variability—distinguishing weight from actual volatility impact.
As captured in the verified terminal overview using a synthetic six-holding demo basket, the interface highlights how a holding can carry a disproportionate share of total portfolio volatility relative to its capital weight. Clear mathematical disclaimers accompany each figure: metrics apply current holdings to past prices over 252 sessions rather than reconstructing historical cash flows or promising future returns.
Holdings workspace and position workflow
The holdings workspace provides an authenticated environment where users record, edit, and review equity portfolio positions. Each holding tracks quantity, average purchase price, reference closing price, total position value, portfolio weight, and unrealised returns.
To eliminate browser-side inconsistencies, calculations are performed server-side by the portfolio engine: weights, pricing, and profit-and-loss metrics are transmitted directly from the pricing layer rather than recalculated on the client.
Holdings Workspace: Synthetic demo portfolio showing multi-holding entry and CSV import, position pricing at latest session close, weighted portfolio allocation, and server-side unrealised P&L calculation.
How the data moves
A high-level view of how raw market archives flow through session-validated ingestion, persistent time-series storage, and analytical engines into the terminal interface.
Market & Macro Sources
NSE historical equity archives, index series, and macroeconomic factor feeds
Ingestion & Validation
Session date validation, stale-archive rejection, and trading calendar reconciliation
Historical Market Store
Time-series equity and factor partitions in PostgreSQL / TimescaleDB
Portfolio & Risk Engines
Position aggregation, 252-day covariance, market beta, and risk contribution
FastAPI Application
Async API layer serving authenticated portfolio state and factor freshness
React Terminal
Dark workspace, AnswerBand summaries, holdings grid, and freshness popovers
Validated Ingestion
Date-stamped archive validation rejecting non-trading day stale downloads
Corporate Actions
Strict split and bonus handling with fail-closed behavior when an entitlement cannot be safely represented
Risk & Beta Decomposition
252-session returns, NIFTY 50 beta, and marginal volatility contributions
Independent Factor Clocks
Per-factor publish tracking distinguishing Current, Lagging, and Unknown states
Financial data is messy: defending the ingestion layer
A core lesson from building financial pipelines is that upstream data providers rarely fail with simple errors. Instead, they fail silently with plausible data.
During the engineering audit of the historical pipeline, we observed that archive requests made on non-trading dates could return previous-session data rather than a clean HTTP 404 or empty response. If accepted naively, the pipeline would duplicate records or attach previous session prices to weekend and holiday dates.
To defend against this, Chanakya enforces an explicit ingestion validation rule: every downloaded archive payload must contain an internal trading-session date matching the expected calendar session before any row is committed to storage. Furthermore, this defensive calendar reconciliation successfully identified and preserved legitimate special Saturday trading sessions, including Budget-day sessions, without corrupting the continuous daily return series.
Today, the historical market store holds over 3 million historical NSE equity price records dating back to 2020, providing the unbroken foundation required for rolling volatility and beta calculations.
Corporate actions require accounting precision
Stock splits and bonus issues alter share quantities and historical cost bases. In consumer portfolio trackers, corporate actions are frequently handled with loose approximations, leading to distorted performance charts and broken average purchase costs.
Chanakya treats corporate action processing as an accounting invariant rather than a cosmetic adjustment. Historical price series use formal split- and bonus-adjusted closes, while portfolio holding lots track corporate action application directly.
Crucially, the system follows a defensive design principle: when an entitlement cannot be safely represented, the accounting layer fails closed instead of silently rounding or inventing a result.
Independent factor clocks and data freshness
In retail finance apps, a single global “Updated today” badge is standard practice. In reality, that label is misleading. Financial sources publish on fundamentally different schedules: NSE equities close at 15:30 IST, derivatives final settle later, currency fixings report on independent banking hours, and international macroeconomic feeds publish on US or global schedules.
Chanakya replaces global status stamps with independent per-factor freshness tracking. Each market factor is evaluated against its own publication calendar:
Market Data Freshness: Independent factor clocks showing per-source publication dates, latency, and explicit Current, Lagging, and Unknown statuses over the synthetic demo portfolio view.
As shown in the popover inspection, factors display distinct statuses:
- Current: Within that factor’s own expected publication/freshness window.
- Lagging: Behind that factor’s expected source-specific cadence.
- Unknown: Freshness cannot be confidently classified under the available source/calendar contract.
These statuses are intentional product transparency, not error states. A risk terminal should state clearly what it knows and what is lagging, rather than presenting a veneer of universal freshness.
Research discipline: when the complex model did not win
A key research milestone in Chanakya was evaluating whether a multi-factor event-analysis challenger would improve upon a simpler expanding-window historical frequency baseline.
Rather than adjusting parameters after the fact, the evaluation protocol and promotion threshold were fixed before the rerun. When evaluated against the held-out validation set, the complex challenger failed to clear the required threshold.
Rather than promoting the more complex model for marketing appeal, the system retained the simpler historical baseline, and predictive validation remains unestablished. Research results are allowed to say that the complex model did not win—this discipline preserves engineering integrity and prevents unverified claims from entering the terminal.
Current terminal versus in-development capabilities
Because Chanakya is in active development, maintaining strict separation between shipped functionality, backend research engines, and planned roadmap items is essential for transparency.
Verified Interactive Features
- Authenticated multi-portfolio workspace
- Holdings entry and CSV lot import
- Portfolio analytics (value, P&L, volatility, beta, effective positions)
- Marginal risk contribution decomposition
- Independent per-factor market data freshness monitor
- Corporate-action-aware accounting layer
- 3M+ historical NSE equity data pipeline
Code-Verified & Experimental Surfaces
- What-If scenario stress-testing engine
- Reverse What-If portfolio factor solver
- BANKNIFTY macro scenario models
- Ask Chanakya natural-language explanation interface
- Bayesian event-analysis models (predictive validation unestablished)
Explicitly not available: Chanakya is not an automated trading bot, buy/sell alert provider, or public subscription SaaS. Unimplemented roadmap concepts—such as Telegram notifications, BSE cash ingestion, complete mutual fund look-through, and live tick streaming—are strictly excluded from current product claims.
My role and workflow
I am building Chanakya as a Software Developer & Product Builder, guiding the product from mathematical problem definition through data pipeline construction to terminal interface implementation.
My workflow focuses on product architecture and verification: defining product requirements and expected financial behavior, directing AI-assisted implementation and debugging across Python, database schemas, and React frontends, reviewing generated code, and rigorously testing edge cases against historical exchange anomalies. I make the architecture and product decisions, operate the cloud deployment, and iterate the terminal based on direct runtime verification.
Technical snapshot
- Role
- Software Developer & Product Builder
- Core Stack
- Python, FastAPI, PostgreSQL / TimescaleDB, Redis, React, TypeScript
- Market Coverage
- National Stock Exchange of India (NSE Equities, 3M+ historical daily records dating back to 2020)
- Analytics
- Portfolio variance decomposition, beta to NIFTY 50, sector exposure, effective position count, per-factor freshness tracking
- Status
- In Development (private cloud deployment, actively developed).
Interested in market intelligence systems?
Tell me what you need, your timeline, and what is already in place. Smaller scoped work is welcome too.