Class CapacityCurve

java.lang.Object
com.quantfinlib.alpha.CapacityCurve

public final class CapacityCurve extends Object
Strategy capacity: net Sharpe ratio against book size.

The same factor and construction are backtested at each capital level with AlphaBacktester, so the square-root impact (microstructure.MarketImpactModel, cost per unit traded growing with √(shares/ADV)) and the participation cap (unfilled trades carried forward, so a large book tracks its target late) both act as the book grows. Gross Sharpe does not depend on capital without a cap; net Sharpe falls as impact grows, and the capacity at a Sharpe floor is where the curve crosses it (Ratcliffe, Miranda and Ang 2017, "Capacity of Smart Beta Strategies from a Transaction Cost Perspective", J. Index Investing 8(3), use the same construction of cost against AUM).

  • Method Details

    • compute

      public static CapacityCurve compute(AlphaContext ctx, AlphaFactor factor, AlphaBacktester.Config base, AlphaBacktester.WeightBuilder builder, double[] capitals, double maxParticipation)
      Runs the backtest at each capital (ascending, each > 0) with the given construction.
      Parameters:
      maxParticipation - per-bar fraction of ADV (0 = no cap)
    • compute

      public static CapacityCurve compute(AlphaContext ctx, AlphaFactor factor, AlphaBacktester.Config base, AlphaBacktester.RiskOptions options, double[] capitals, double maxParticipation)
    • size

      public int size()
    • capital

      public double capital(int i)
    • netSharpe

      public double netSharpe(int i)
    • grossSharpe

      public double grossSharpe(int i)
    • impactDrag

      public double impactDrag(int i)
      Cumulative impact cost, fraction of equity.
    • totalCostDrag

      public double totalCostDrag(int i)
      Cumulative cost of every kind, fraction of equity.
    • trackingGap

      public double trackingGap(int i)
      Mean distance from target while working trades under the cap.
    • capitalsCopy

      public double[] capitalsCopy()
    • netSharpeCopy

      public double[] netSharpeCopy()
    • capacityAt

      public double capacityAt(double floor)
      Largest capital at which net Sharpe is still at least floor, interpolating linearly in log capital between grid points. NaN when the smallest capital already misses the floor; the largest capital when no grid point misses it (a lower bound).
    • format

      public String format()
      A plain-text table.
    • toString

      public String toString()
      Overrides:
      toString in class Object