Skip to content

Financial machine learning

Financial machine learning joins learning algorithms to dated financial decisions: labels, information availability, dependent outcomes, research selection, execution and monitoring.

Financial machine learning is the use of learning algorithms within financial research and decision processes, with the data, targets, evaluation and implementation designed around the financial task. A forecast can help select trades, estimate risk, size positions or organise a portfolio. Its usefulness depends on what could be known and done when the decision is made, and on the resulting economic outcome.

In investment research, the discipline connects a question about markets to an implementable policy. Predicting a price direction, choosing an exposure and earning a net profit are different steps. Better prediction accuracy does not, by itself, establish a better strategy.

The financial question defines the target

Suppose the hypothesis is that a temporary selling shock creates a rebound that remains available after the signal can be processed. A supervised model needs a label that describes the relevant future outcome. A positive close-to-close return may be the wrong target if the first feasible entry is the following opening auction and most of the rebound occurs overnight.

For a simple long trade without distributions or corporate actions, a gross return label can be

ri=PxiPei−1,r_i=\frac{P_{x_i}}{P_{e_i}}-1,

where eie_i and xix_i are declared feasible entry and exit references, and both prices use the same currency and share basis. A return-sign label might record whether this return is positive. A policy with a stop, profit target and maximum holding time needs a target that respects those exits, such as a triple-barrier label. A barrier touch still does not guarantee a fill at that barrier price.

The target can instead be a return magnitude, risk quantity or the success of a proposed trade. The choice determines the meaning of the model's score. Training a classifier on gross direction does not make its output a probability of positive net profit. Position sizes, payoff magnitudes and costs still matter. The full Labels and Overlapping Outcomes lesson develops this target contract and the dependence it creates. Its preview is public; the full lesson requires membership.

Every input and outcome has a clock

A feature must be available by the decision. For economic data, the observation period, publication time and revision vintage are separate facts. A value describing an earlier month can be released later, then revised again. The St. Louis Fed's ALFRED retrieves vintages available on historical dates; a release date alone may still need an intraday availability time and delivery delay for a particular trading policy.

Consider an original synthetic clock. An observation belongs to Session 1, is first released during Session 5 and is revised during Session 9. Assume the first release is received and processed during Session 5. At a decision before Session 6 opens, the first release can be used if it has arrived; the later revision cannot. This is a point-in-time data requirement, not a choice of learning algorithm.

There is a second clock for training. An old candidate was decided in Session 3, entered in Session 4 and exits in Session 8. A fit before Session 6 opens cannot use its completed return label. Dating the row “Session 3” does not make the future outcome known. In this example outcomes become usable just after their exits; fitting and prediction finish before the next stated entry.

Synthetic session clock: economic observation at session 1, first release 5, decision and fit before session 6, entry 7, revision 9 and exit 10. An old training candidate decided at 3 and entered at 4 exits at 8, so its target is unavailable at the fit cutoff.
Synthetic session clock: economic observation at session 1, first release 5, decision and fit before session 6, entry 7, revision 9 and exit 10. An old training candidate decided at 3 and entered at 4 exits at 8, so its target is unavailable at the fit cutoff.
Original synthetic session timeline. Numbers index sessions rather than calendar dates. The older candidate's outcome is unavailable at the fit cutoff; the revision is unavailable at the decision.

Preprocessing has the same discipline. Scaling, imputation, feature selection and probability calibration learn from data too. Fit them within the information allowed by the research design. A historical universe must also retain the securities and failures eligible then, rather than silently selecting today's survivors.

A later test needs more than a later row date

Labels can share future price increments. Here the older candidate spans entry in Session 4 to exit in Session 8, while a test trade spans Sessions 7 to 10. Both use the price movement from Session 7 to 8. The old candidate must not train the model that makes the Session 6 test decision. It is unfinished at that cutoff, and it overlaps the test outcome.

Purging removes training observations whose outcome information overlaps the evaluation outcomes. Weighting redundant completed labels can change their influence inside training; it cannot remove information already shared across training and test. An embargo can add a dependence buffer after a held-out block when the validation design allows later observations in training. A strictly past-only fit has no post-test training rows to embargo. Neither a buffer nor a weight proves independence.

Within earlier development data, compare models and tune the permitted procedure. Reserve a later test for the frozen policy, including its preprocessing, refitting schedule, sizing and execution assumptions. Time-Ordered Train, Validation and Test Design shows how to reproduce that learning schedule; the full lesson requires membership and has a public preview.
Chronology addresses information flow. Research selection is another problem. Trying many features, label horizons, thresholds or model families and reporting the best curve creates overfitting opportunities even when every fit respects time. Keep the trial history and a simple baseline. Once test results influence a revision, that period has become development information. Bailey and co-authors' backtest-overfitting paper explains why the selection process matters beyond the winning strategy's standalone statistics.

From a forecast to USD 5

Now suppose the frozen policy is evaluated on a previously untouched chronological test interval. The following is a hypothetical single completed long trade, not a fitted model result or evidence of predictive skill. It is the test trade on the clock above: decide before Session 6 opens, enter during Session 7 and exit during Session 10 under a precommitted exit rule.

Start with USD 10,000 cash and no holdings. Buy and later sell 10 shares. Assume full fills, no other trades, distributions, corporate actions, financing, taxes or interest. The modeled costs consist only of adverse execution relative to the stated references and explicit fees.

ItemEntryExit
Reference price (USD per share)100.00102.00
Assumed fill price (USD per share)100.50101.50
Fee (USD per fill)2.502.50

At the reference prices, gross profit is 10(102−100)=2010(102-100)=20 USD. Paying 0.50 USD more per share at entry and receiving 0.50 USD less at exit costs 10(0.50)+10(0.50)=1010(0.50)+10(0.50)=10 USD relative to those references. Fees total 5 USD. Thus

Net profit=20−10−5=5 USD.\text{Net profit}=20-10-5=5\text{ USD}.

The same answer follows directly from fills: 10(101.50−100.50)−5=510(101.50-100.50)-5=5 USD. Cash after buying and paying the entry fee is USD 8,992.50; after selling and paying the exit fee it is USD 10,005, with no remaining inventory. Subtracting the USD 10 execution shortfall again from this fill-based profit would double count it.

One hypothetical 10-share long trade earns USD 20 at reference prices. USD 10 of modeled adverse execution and USD 5 of fees leave USD 5 net. A separate fill ledger gives the same USD 5 result.
One hypothetical 10-share long trade earns USD 20 at reference prices. USD 10 of modeled adverse execution and USD 5 of fees leave USD 5 net. A separate fill ledger gives the same USD 5 result.
Original hypothetical completed test trade. All bridge amounts are USD; reference and fill prices in the table are USD per share. The cash ledger independently reconciles the same net result.

The aggregate modeled costs are USD 15. Holding reference profit fixed, another USD 5 of costs would erase the net result. This is an accounting sensitivity, not evidence that changing size or execution leaves reference profit and fills unchanged. Larger orders can alter market impact, fill rates and feasible positions.

No classification accuracy can be inferred from this ledger. Across many forecasts, accuracy counts correct labels without measuring the amounts won and lost, the capital committed or the costs paid. Evaluate the complete policy's net results, exposures, drawdowns, benchmark and uncertainty alongside appropriate prediction metrics.

The distribution keeps changing

An untouched historical test remains one market history. Liquidity, participant behaviour, volatility and the relationship between features and outcomes can change. More observations do not guarantee that old relationships remain relevant, and a complex learner cannot create independent evidence from overlapping labels.

Prospective monitoring should keep separate records of input quality, predictions against matured outcomes, actual fills and net P&L. A cost increase can reduce profit while predictive performance remains stable; a feed revision can change inputs before enough outcomes mature to assess accuracy. Predeclare investigation and risk-limit responses, and treat a revised model or retraining policy as a version requiring evaluation. Model Decay and Monitoring develops those separate records and responses; its public preview leads to a membership lesson.

Sources

  • Marcos López de Prado, Advances in Financial Machine Learning (Wiley, 2018), §§3.1–3.4 on labels; §§4.2–4.4 on overlap; §§7.3–7.4 on validation leakage; §§11.2–11.4 on backtest assumptions and selection; §§12.1–12.3 on historical and scenario evaluation. The timeline and cash ledger here are original hypothetical illustrations.
  • Federal Reserve Bank of St. Louis, ALFRED, the official archive of economic data vintages available on historical dates.
  • David H. Bailey, Jonathan M. Borwein, Marcos López de Prado and Qiji Jim Zhu, The Probability of Backtest Overfitting, February 2015 revision, introduction and discussion of multiple strategy trials and holdout limitations.
Last updated
  • financial machine learning
  • labels
  • point in time data
  • validation
  • execution
  • research selection
← Back to the glossaryBack to top ↑