import type { EquityPoint } from './equity.js'; import type { Contract, Money } from './shapes.js'; import type { Trade } from './trades.js'; /** What the whole run came to. */ export interface Summary { readonly capital: Money; readonly currency: string; readonly netProfit: Money; /** Sum of winning trades, before charges. */ readonly grossProfit: Money; /** * The losing trades' gross, as a magnitude, and it can come out at or below * zero. * * A trade wins or loses on its net after charges and contributes its gross * here, so a trade whose gross was positive and whose charges took it under * lands in the losses carrying a positive gross, which lowers this figure and * with few enough trades beside it takes it to zero or past it. `tallyOf` * says why that is preferred to counting one trade as a loser in one figure * and a winner in another. It is written here because it was documented as a * positive magnitude and is not one, and a reader dividing by it was handed a * negative profit factor with nothing saying that could happen. */ readonly grossLoss: Money; readonly charges: Money; /** `netProfit / capital`, a fraction and not a figure times a hundred. */ readonly returnPercent: number; /** Closed only. */ readonly tradeCount: number; readonly openTradeCount: number; readonly wins: number; readonly losses: number; /** Exactly zero net. */ readonly scratches: number; /** wins / (wins + losses), null when none closed. */ readonly winRate: number | null; readonly averageWin: Money; /** Positive magnitude. */ readonly averageLoss: Money; /** Money per closed trade. */ readonly expectancy: Money; readonly expectancyStandardError: Money; /** * Gross profit over gross loss, or null where there is no ratio to take. * * Null when the gross loss is not above zero: a run with no losing trade has * nothing to divide by, and one whose losses cost less in gross than their * charges has a denominator at or below zero. A profit factor is a * non-negative ratio everywhere it is used, so a negative one is not a * surprising value, it is a number nobody can act on. It used to be * reported: two trades, one charged into a loss on a positive gross, gave a * profit factor of -0.5. */ readonly profitFactor: number | null; /** Zero or negative, the same sign the curve states it with. */ readonly maxDrawdown: Money; /** The deepest point's own fraction, not the worst fraction of any point. */ readonly maxDrawdownPercent: number; /** A bar time, never an index. */ readonly maxDrawdownAt: number | null; readonly longestDrawdownBars: number; /** * Zero or positive, the mirror of `maxDrawdown` and read against it. * * The pair is the point of it. A run that made ten and gave back nine is a * different strategy from one that made one and never gave any of it back, * and the two report the same net. Neither figure says that on its own. */ readonly maxRunUp: Money; /** The highest point's own fraction, not the best fraction of any point. */ readonly maxRunUpPercent: number; /** A bar time, never an index, and not the bar `maxDrawdownAt` addresses. */ readonly maxRunUpAt: number | null; readonly averageBarsHeld: number | null; readonly barsInMarket: number; readonly barCount: number; } /** * The whole run in one shape, folded from its trades and its own curve. * * The curve is passed in rather than recomputed, because a summary that folded * its own would be a second equity curve with a second set of rounding, and the * first disagreement between them would be a drawdown figure that no point in * the reported curve ever reached. */ export declare function summaryOf(trades: readonly Trade[], equity: readonly EquityPoint[], contract: Contract, capital: Money): Summary; //# sourceMappingURL=statistics.d.ts.map