/** * The month by month table, bucketed in UTC from bar times. * * **UTC, and it says so on the type.** A calendar month in the instrument's own * timezone would need the session machinery and the instrument's calendar, and * a table that silently buckets a trade into the wrong month is worse than one * that states the basis it used. No timezone library, and no pretence of the * instrument's calendar. */ import type { EquityPoint } from './equity.js'; import type { Money } from './shapes.js'; import type { Trade } from './trades.js'; /** One calendar month of the run, in UTC. */ export interface MonthlyReturn { readonly year: number; /** 1 to 12, UTC. */ readonly month: number; readonly netProfit: Money; /** Against the equity at the month's first bar. */ readonly returnPercent: number; readonly trades: number; } /** * The months a run passed through, in the order it passed through them. * * **A month holds the change in equity across the closes inside it.** The first * point of the curve has nothing before it to be compared with, so it opens the * table rather than contributing to it, and every later point contributes what * it moved from the point before. The consequence is an identity rather than a * claim: the months add up to the equity at the last point less the equity at * the first, and nothing that happened during the warmup is attributed to a * month it did not happen in. * * `returnPercent` is that change over the equity at the month's first bar, * which is the basis this table states and the reason the figure is a fraction * rather than a fraction times a hundred: `drawdownPercent` beside it is * `drawdown / peak`, and one report with two conventions is a report a reader * has to check every figure of. * * `trades` counts the trades that closed inside the month, by the time they * closed. An open trade is in no month, because the month it will be counted in * is not decided yet. * * **A point with no time is in no month.** A bucket is a calendar fact and a * bar with no time states no calendar, so such a point carries its change into * the month in force rather than opening one, and where none is in force it is * outside the table altogether. That is the honest reading: bucketing it by the * month that happened to come before would put money in a month on the strength * of nothing. */ export declare function monthlyOver(equity: readonly EquityPoint[], trades: readonly Trade[]): readonly MonthlyReturn[]; //# sourceMappingURL=monthly.d.ts.map