Skip to main content
Pro Feature. Requires a Pro or Ultra subscription. Get started at api.mathematicalcompany.com
A complete alpha research workflow using AFML (Advances in Financial Machine Learning) techniques: triple-barrier labeling, feature importance with purged cross-validation, alpha decay measurement, and PnL attribution.

Full Code

How It Works

  1. Triple-barrier labeling classifies each trade as win/loss/timeout based on price barriers
  2. Meta-labeling evaluates whether a primary model’s signals are correct (sizing layer)
  3. MDA importance measures each feature’s contribution by shuffling it and observing accuracy drop
  4. SFI importance measures each feature’s standalone predictive power
  5. Alpha decay tracks how quickly your signal’s information coefficient degrades over time
  6. PnL attribution decomposes returns by market, time period, and risk factors

Time-Based Attribution

Break down PnL by hour, day, or custom periods:

Factor Attribution

Decompose PnL by risk factors:

Run It

See Alpha Research and Bars & Labeling for the full AFML reference.