Finance Fluent

Quantitative Analysis in Finance:From Raw Data to a Signal You Can Trust

How quantitative analysis works: handling market data properly, the statistics that earn their place, factor models, and the four ways a backtest lies to you.

A scatter of 150 forward returns against factor exposure, with the fitted least-squares line and its standard errorA scatter of 150 forward returns against factor exposure, with the fitted least-squares line and its standard error
Quantitative AnalysisA scatter of 150 forward returns against factor exposure, with the fitted least-squares line and its standard error

Quantitative analysis is the practice of turning market data into rules you can test. Instead of judging a trade by feel, you write down what you believe, measure whether it held historically, and estimate what it would have cost to trade. If the rule survives honest testing, you run it. If it does not, you discard it and keep the finding.

That is the whole discipline. Everything below is detail.

The detail matters, because the ways market data misleads you are specific, unglamorous and easy to skip. This article covers the method, with worked examples drawn from Indian equities where a concrete case helps, though every principle here applies wherever you trade. For the two other lenses on the same problem, see fundamental analysis, which asks what a business is worth, and technical analysis, which asks when price may move.

What separates a quant approach from a discretionary one

The difference is not mathematics. It is falsifiability.

A discretionary view can absorb any outcome. If the trade works the thesis was right, and if it fails the market was irrational. A quantitative rule cannot do this. It says: rank the NIFTY 50 by twelve-month return, buy the top ten, rebalance monthly. That statement produces a specific series of positions over any historical period, and either that series made money after costs or it did not.

This is why quants seem obsessed with process. The process is the only thing standing between a real edge and a story fitted to noise.

The quantitative research pipeline: data, cleaning, signal, backtest, sizing, execution, with a feedback loop from backtest back to signal Data Clean Signal Backtest Size Execute most of your time is spent here
The pipeline is linear on paper. In practice the dashed loop is where the work happens, and the honest version of that loop is the hardest part of the job.

The data problems that break naive analysis

Most quant tutorials are written against US data, where decades of clean, survivorship-adjusted history are a paid API call away. Work anywhere else and the data is perfectly usable but will mislead you in three specific ways if you take it at face value. The examples below use Indian equities because they make the problems concrete, and all three appear in every market.

Corporate actions are not optional. A bonus issue or a stock split changes the price series without changing anyone's wealth. A 1:1 bonus halves the quoted price overnight. If your dataset is unadjusted, your return series records a 50 percent single-day loss that never happened, and any volatility or drawdown measure computed on it is wrong. Adjust for splits, bonuses, rights issues and dividends before computing a single return.

Index membership changes, and your universe changes with it. The NIFTY 50 is reconstituted semi-annually, with changes generally effective from the last trading day of March and September, based on six months of data ending January and July. The index methodology document sets out the eligibility rules, including the impact-cost threshold that governs liquidity. If you backtest "the NIFTY 50" using today's constituent list across ten years of history, you have built a portfolio of companies selected because they survived and grew large enough to still be in the index. That is survivorship bias, and it inflates returns in a way that looks like skill.

Weighting is free-float, not full market cap. The NIFTY 50 weights constituents by free-float market capitalisation, so promoter holdings do not count toward index weight. Indian promoter stakes are often large. If you reconstruct index weights from total market cap, your replication will drift from the published index and you will spend a day hunting a bug that is really a specification error.

None of this is difficult. It is just work that has to happen before the interesting part, and skipping it produces results that are confidently wrong rather than obviously wrong.

The statistics that earn their place

You need fewer statistical tools than most curricula suggest. These five do the majority of the work.

Concept What it tells you Where it misleads
Log returns Additive over time, so multi-period aggregation is clean Diverge from simple returns at large moves
Volatility Standard deviation of returns, the usual risk proxy Assumes symmetry that equity returns do not have
Correlation How two assets move together Rises toward 1 in a crisis, exactly when you need it low
Autocorrelation Whether past returns predict future ones Weak and unstable; easy to find by accident
t-statistic Whether an effect is distinguishable from chance Meaningless once you have tested a hundred variants

The one worth dwelling on is volatility, because the assumption underneath it is false in a way that matters. Standard deviation treats returns as roughly normal. Equity index returns are not normal. They have fat tails, meaning extreme moves happen far more often than a normal distribution predicts, and they are skewed, meaning the large moves cluster on the downside.

A standard normal distribution compared with a Student-t distribution rescaled to the same variance. The t distribution has a higher peak, thinner shoulders, and visibly more density in both extreme tails. normal fat-tailed mean large losses large gains
A standard normal against a Student-t rescaled to the same variance, both plotted from their actual densities rather than drawn by hand. Note the shape: the fat-tailed curve peaks higher, dips below the normal through the shoulders, and crosses back above it around 2.8 standard deviations. At four standard deviations its density is roughly sixteen times the normal one. Same variance, entirely different tail risk, which is why standard deviation alone is a poor description of how bad a bad day can be.

The practical consequence is that a position sized to a normal-distribution assumption is too large. How much too large depends on the instrument and the period, which is precisely why this belongs in your own testing rather than in a rule of thumb you read somewhere. Risk management covers the measures that address this directly.

Factors, and what changes between markets

A factor is a characteristic that explains differences in returns across a group of stocks. Value, momentum, size, quality and low volatility are the classical set, and they are well documented across many markets.

Two things change once you leave the deepest, widest markets, and Indian equities illustrate both clearly.

The first is universe size. A long-short factor portfolio wants enough liquid names to form meaningful top and bottom buckets. Below the NIFTY 100 or so, impact cost rises quickly, and a strategy that looks profitable on paper becomes a strategy that moves the price against itself on entry. Test the same rule on the top 50, the top 100 and the top 200. If the edge only exists in the smallest and least liquid names, you have found an illiquidity premium and named it alpha.

The second is concentration. Indian indices carry substantial sector concentration, particularly in financials. A value screen on the NIFTY 50 will often hand you a portfolio that is mostly banks. That is a sector bet wearing a factor costume, and it will behave like one when rates move. Neutralise by sector, or at least measure how much of your return came from the sector tilt rather than the factor. Portfolio construction deals with this properly.

The four ways a backtest lies to you

If you torture the data long enough, it will confess to anything. Ronald Coase

Every one of these has cost someone real money, and the first three are avoidable with discipline alone.

Look-ahead bias. Using information that was not available at decision time. In Indian data this hides in reported fundamentals: a quarterly result belongs to the date it was published, not the quarter it describes. If you rank on March-quarter earnings using March dates, you are trading on numbers that did not exist for weeks afterward.

Survivorship bias. Covered above, and worth repeating because it is the most common single error in amateur Indian backtests. Build your universe as it existed on each historical date, not as it exists now.

Cost naivety. This is where most retail backtests quietly break. A round trip on Indian equities carries brokerage, exchange transaction charges, GST, stamp duty, SEBI turnover fees and securities transaction tax. Individually they look small. On a strategy that rebalances weekly, they compound into the difference between a good result and a losing one. Rates change with each Budget, so rather than reproduce a table that will be stale within a year, take the current figures from the NSE securities transaction tax page and put real numbers into your own cost model.

The discipline that follows is simple: compute your strategy's annual turnover first, multiply by a realistic round-trip cost, and see what is left of the edge. If a 4 percent annual edge disappears under 3 percent of costs, no amount of model refinement will save it. Better to learn that in an afternoon than after six months of live trading.

Overfitting. The subtlest one, because it feels like work. Every parameter you tune and every variant you test uses up some of the information in your sample. Test enough combinations and one will look excellent purely by chance. Guard against it by deciding your rules before you look, keeping a holdout period you touch once, and treating a t-statistic from the hundredth variant you tried as the meaningless number it is.

Deflating a Sharpe ratio for the number of tries

The more strategies you test, the better the best one looks by pure chance. A deflated Sharpe ratio corrects for that: it asks whether your best result beats the best you would expect from the same number of strategies with no skill at all. Without that correction, a long enough search always finds something that looks like an edge.

How large the effect is surprises most people. Here is the best annualised Sharpe ratio you should expect from strategies with zero true skill, each backtested on five years of daily data:

Strategies tried, none with any skill Expected best Sharpe ratio Chance the best shows 1.0 or more
1 0.00 1 percent
10 0.69 12 percent
100 1.12 about 70 percent
1,000 1.45 virtually certain

Computed by simulation, 20,000 runs per row, and checked against a full day-by-day simulation of the returns. Try a hundred variants of an idea that does not work, and the winner will probably show a Sharpe ratio above 1, a figure many people would trade.

The correction comes from David Bailey and Marcos López de Prado, The Deflated Sharpe Ratio in the Journal of Portfolio Management (2014). It compares your observed Sharpe ratio with the expected maximum for the number of trials, and also allows for how short the track record is and for returns that are skewed or fat-tailed, both of which make a Sharpe ratio less reliable than it looks. What comes out is a probability that the result reflects real skill rather than the luck of the search, which is the question you actually wanted answered.

A companion measure, the probability of backtest overfitting (Bailey, Borwein, López de Prado and Zhu, Journal of Computational Finance), works directly from the returns of every variant you tested. It splits the history into many in-sample and out-of-sample halves and counts how often the in-sample winner finishes below the median out of sample. A high probability means your selection process is picking noise.

Both depend on one habit: write down every variant you test, not just the one you keep. Correlated variants count for less than independent ones, since ten near-identical parameter settings are closer to one trial than ten, but nobody can deflate a number they did not record.

Position sizing, which decides more than the signal

Two traders with the same signal and different sizing rules get different outcomes. Sizing is not an implementation detail bolted on afterward; it is a large part of the strategy.

Approach Idea Trade-off
Fixed fractional Risk a set percentage of equity per position Simple, but ignores that volatility changes
Volatility targeting Scale position by target volatility divided by asset volatility Keeps portfolio risk stable; needs a volatility estimate that is not itself stale
Kelly fraction Size by edge divided by variance Growth-optimal in theory, uncomfortably aggressive in practice

In practice most systematic traders run a fraction of Kelly, often a quarter or less, because full Kelly assumes you know your edge exactly. You do not. You have an estimate from a finite sample, and it is probably optimistic.

Tooling

Python has effectively won this space, on ecosystem rather than language design. pandas and NumPy for data handling, statsmodels and scikit-learn for modelling, matplotlib for research plots that only you will see.

For pricing and risk specifically, I maintain quantflow-finance, an open-source library covering options pricing, risk analytics and portfolio tools. It is MIT licensed and the source is on GitHub, so you can read exactly what any function does rather than trusting a number it returns. That is worth insisting on generally: a risk figure you cannot derive yourself is a risk figure you do not really have.

Where to go from here

Quantitative analysis is not a set of formulas. It is a habit of writing down what you believe precisely enough that the data can contradict you, then giving it every opportunity to do so.

The foundations here lead in three directions. Portfolio construction takes single-asset signals and combines them into something with a coherent risk profile. Risk management turns the tail-risk problem sketched above into measures you can act on. And machine learning for stock selection extends factor thinking to models that find relationships you did not specify, along with all the extra ways those models can fool you.

Start with data hygiene and honest costs. Almost everyone who fails at this fails there, long before the modelling gets difficult.

Read next

The rest of the shelf

Everything else on the site, newest first. On a wide screen this index travels sideways as you scroll. Tab into it and it becomes an ordinary grid, so nothing you are focused on is ever parked off-screen.

Income each year from a five-rung bond ladder and from a single bond when rates fall two points, against an unchanged-rate baseline

Portfolio Management

Income Portfolio Construction

Build a portfolio for cash flow rather than headline yield: duration and reinvestment, yield traps, REITs and InvITs, and stress-testing the income itself.

22 Jun 202515 min

A simulated macro composite score with its regimes shaded, and beneath it the capped factor tilt it implies a month later

Portfolio Management

Macro-Driven Factor Rotation

How to turn liquidity, PMI and yield-curve data into modest factor tilts, with guardrails, honest measurement, and the case that timing often fails.

14 Jun 202513 min

A year of simulated daily returns tested against a normal-model 99 percent VaR, with the exceptions marked and placed on the Basel traffic light

Risk Management

Monte Carlo Value-at-Risk, Step by Step

How Monte Carlo VaR works end to end: covariance, Cholesky shocks, full revaluation, fat tails, convergence, backtesting and expected shortfall.

06 Jun 202518 min

A simulated price series above its RSI and MACD panels, with the bars where both indicators agree marked

Technical Analysis

RSI and MACD Confluence, Tested Honestly

How RSI and MACD are computed, what combining them can and cannot add, and how to test a confluence rule against overfitting, costs and data snooping.

30 May 202516 min

The z-score of a simulated pair spread crossing its two-standard-deviation entry bands and reverting to zero

Quantitative Analysis

Statistical Arbitrage and Pairs Trading

How pairs trading works, why cointegration beats correlation, how half-life and z-score thresholds set the trade, and why costs and breaks decide the result.

24 May 202514 min

The payoff of a long call butterfly at expiry, with the maximum at the middle strike, both breakevens and the debit marked

Options & Trading

Butterfly Option Structures Explained

How butterfly options work: the payoff, how a butterfly settles at expiry, why iron and long butterflies are the same trade, and the risk in a broken wing.

16 May 202513 min

An iron condor payoff at expiry, showing the two credit zones, the flat band of net credit and the capped loss on each wing

Options & Income

Credit Spreads and Iron Condors

How credit spreads and iron condors work, what the premium compensates you for, the margin reality, and the payoff shape that catches option sellers out.

11 May 202511 min

A walk-forward validation split: six folds of expanding training data, each with a one month embargo and a twelve month test window

Machine Learning

Machine Learning for Stock Selection

Machine learning for stock selection without fooling yourself: which models to try, walk-forward validation, where data leakage hides, and what survives costs.

06 May 202513 min

A protective put payoff drawn against the unhedged portfolio line, with the floor, the breakeven and the constant cost of the premium

Options & Hedging

Hedging a Portfolio with Index Options

How to hedge an equity portfolio with index options: how much of it to hedge, sizing the contracts, what puts and collars really cost, and when not to bother.

29 Apr 202512 min

An equity curve against its high-water mark with the underwater plot beneath, and the gain the deepest drawdown demands to recover

Risk Management

Risk Management Essentials

Why drawdowns are harder to recover than they look, what Value at Risk does and does not tell you, and how to size positions so a bad month stays survivable.

22 Apr 202510 min

A two-asset efficient frontier, the straight line it would be if the assets were perfectly correlated, and the minimum-variance point

Portfolio Management

Portfolio Construction: Theory and Process

What portfolio construction is, the theory behind it, the process step by step, and why mean-variance optimisers build portfolios nobody should hold.

13 Apr 202513 min

A price series with its 50-bar moving average, and a dimension line measuring how many bars later the average turns

Technical Analysis

An Introduction to Technical Analysis

Technical analysis explained honestly: what the charts actually show, which claims survive testing, and how to check whether an indicator works at all.

25 Mar 202511 min

The balance sheet identity drawn as two stacked columns of equal height, assets on one side and liabilities plus equity on the other

Fundamental Analysis

Fundamental Analysis Explained

Fundamental analysis in practice: which financial statement to trust, what the ratios really answer, and the governance red flags that precede most failures.

24 Mar 20259 min

One subject, worked out in full rather than summarised.

Open the full index