Class AlphaBacktester.Traced
java.lang.Object
com.quantfinlib.alpha.AlphaBacktester.Traced
- Enclosing class:
AlphaBacktester
A run with its per-bar trace: the book held over each close-to-close
bar, each name's P&L, the cost and the financing, all as fractions
of equity at the start of the bar. Per bar,
Σ_i namePnl + cost + financing equals the net return exactly
(cost and financing are signed P&L, so normally negative).-
Method Summary
Modifier and TypeMethodDescriptiondoublecost(int s) Trading cost P&L of steps(≤ 0).doublefinancing(int s) Financing P&L of steps.doubleheld(int s, int i) Weight of nameiheld over steps, after any fill at the step's opening close.double[]heldCopy(int s) doublenamePnl(int s, int i) P&L of nameiover steps, fraction of equity at the step start.double[]namePnlCopy(int s) doublenetReturn(int s) Net return of stepsfrom the equity curve.result()intContext bar index of trace step 0; stepscoversclose(start + s) → close(start + s + 1).intsteps()Number of traced bars.
-
Method Details
-
result
-
startIndex
public int startIndex()Context bar index of trace step 0; stepscoversclose(start + s) → close(start + s + 1). -
steps
public int steps()Number of traced bars. -
held
public double held(int s, int i) Weight of nameiheld over steps, after any fill at the step's opening close. -
heldCopy
public double[] heldCopy(int s) -
namePnl
public double namePnl(int s, int i) P&L of nameiover steps, fraction of equity at the step start. -
namePnlCopy
public double[] namePnlCopy(int s) -
cost
public double cost(int s) Trading cost P&L of steps(≤ 0). -
financing
public double financing(int s) Financing P&L of steps. -
netReturn
public double netReturn(int s) Net return of stepsfrom the equity curve.
-