Skip to content

Changelog

What changed in each release of py-beacon. The newest release is first.

The format follows Keep a Changelog and the version numbers follow Semantic Versioning. Before 1.0, a breaking change raises the middle number, as in 0.1 to 0.2.

Unreleased

[0.10.0] - 2026-11-01

A run's analysis is a library of its own, beacon.analysis: performance, portfolio, risk and attribution figures for a finished or a stored run, and 103 statistics in eight reports that a backtest can ask for (Backtest.run(analysis=...), and analysis on the API's backtest) and a stored run can be asked for again later. A run whose names span more than one country is analysed with a global factor model, with country, sector and currency factors. A stored run keeps what it needs to rerun its analysis exactly, and its market inputs and index results are kept once for every run on the same data store: at 6,000 names a run keeps 3.0 MB of its own, and a repeat run on the same data adds nothing else. Figures change: the Sharpe ratio and the information ratio are measured on mean daily returns everywhere, active attribution explains the fund's compounded return less the comparator's, and trades carry the reasons they were made. Deleting a data store answers 200 rather than 204, synthetic prices are in whole cents, and beacon.risk.factors and beacon.analysis.comparison are gone.

Added

  • A run's large tables are kept beside its record as Parquet files, with a small manifest saying what is there: beacon.analysis.panels writes and reads them (write_panels, read_panels, read_manifest), and they read back exactly. A strategy's backtest record now keeps the fund's weight in every name on every day, unabridged, where the JSON record keeps only the last 1,000 days. A record saved before has no tables, and still opens. Deleting a strategy removes its tables with its record. On a 7-year backtest over 6,000 names, writing them adds about a second.
  • Each name's daily total return in one currency: beacon.data.returns.name_returns. A day's return is the close times any split ratio, plus cash paid per share on its ex-date (gross of withholding, at that day's rate), over the previous close, less one; mergers, spin-offs and cancelled actions are left out, and a day without a close is empty with the next close running from the last. A strategy's backtest record keeps these returns for every name the fund, its index or its benchmark held, in the book's currency, so its analysis can be rerun later without the data store. On days without trades they explain the fund's return exactly. On a 7-year backtest over 6,000 names, reading and writing them adds about 5 seconds.
  • A run's costs by day and kind: beacon.backtest.breakdown.daily_costs gives the fixed trading costs, market impact, futures roll costs and creation fees (what dealing investors paid into the fund) on every day of the NAV, each column summing to the run's total of its kind. A strategy's backtest record keeps it beside the JSON. Each trade now records how much of its cost was market impact (Transaction.impact_cost, TradeInstruction.impact), so the breakdown never charges the fixed rate to a trade booked at no cost, such as a delisting's settlement.
  • A run's cash, income, fees and flows by day: beacon.backtest.breakdown.daily_cash gives the cash, dividends receivable, fees payable and futures exposure at each day's end; the cash that moved, by kind (interest, dividends received, distributions, subscriptions, redemptions, fees paid, futures, swap and hedge settlements); and the dividends owed on their ex-dates gross, the tax withheld from them, the fee charged and the flows dealt. The engine now records each ex-date's gross dividends and withholding, at that day's exchange rates, as BacktestResult.dividends_entitled. A strategy's backtest record keeps the table beside the JSON.
  • The comparators' daily weights are kept beside a backtest record too: the index's, the optimised index's when the run tracked one, and the benchmark's when it holds names.
  • The grouping fields of every name a run held (sector, industry group, industry, sub-industry, region, countries of listing and domicile, currency and exchange), as they stood at each rebalance of the fund or its index: beacon.analysis.snapshots.reference_snapshots, kept beside a backtest record, so a later rerun of its analysis groups names as they were then even after the data store is refreshed.
  • Each name's characteristics at each rebalance: beacon.analysis.snapshots.characteristics_snapshots gives the market cap (close times shares outstanding, in the book's currency), P/E and P/B (the pe_ratio and pb_ratio features in force on the date), trailing dividend yield (ordinary dividends over the year, over the close) and momentum (the total return from 252 to 21 sessions before, through splits and dividends). A name that has stopped trading has no row. A backtest record keeps them beside the JSON. FeatureData.table_as_of reads a feature for many names on many dates at once, with value_as_of's point-in-time rules.
  • Each name's average daily traded value at each rebalance and month end, as the liquidity screens measure it (close times volume in the book's currency over its last 63 days with a volume): beacon.analysis.snapshots.traded_value_snapshots, kept beside a backtest record for liquidity over the run.
  • beacon.analysis.RunData: everything a run's analysis reads, in one object, from a finished run (RunData.from_result) or a stored one (RunData.from_record): the fund's daily returns as its metrics measure them, its NAV and units, the comparators' levels, the currency and assumptions, and every table above. write keeps it in a folder it reads back from exactly. A strategy's backtest record is now kept this way, so its analysis can be rerun later, and a record kept before loads with what it has, saying for each table it lacks why.
  • A stored run keeps its closes, in each name's own currency, packed as whole numbers at the fewest decimals that hold them (beacon.analysis.packing), with the names' currencies, the exchange rates and the corporate actions, and works its name returns out again from them the first time they are asked for, by the same calculation on the same numbers, so they come back exactly. On a 6,000-name run the name returns' 62 MB became 13 MB of closes.
  • A stored run keeps each book's holdings on the days they changed, rather than its daily weights, and works the weights out again from them and the closes the first time they are asked for (beacon.analysis.holdings). The fund's weights come back exactly from its quantities and daily totals. An index records its weights at single precision from units that were themselves rounded, so about a quarter of its cells differ from the rebuilt value by one step in the last place; those cells are kept as recorded and put back, so the index's weights also come back exactly. On a 6,000-name run the fund's 45 MB of weights became 1.4 MB of holdings, and the index's 26 MB became 7.8 MB, nearly all of it the kept cells.
  • A stored run reads each table the first time it is asked for, not when the run is opened. On a 6,000-name run, its tables now 30 MB rather than 138.6 MB, opening it for its performance figures takes 0.03 seconds, and reading every table, including working out the name returns and the weights, about 2.6 seconds.
  • beacon.data.prices.wide_columns reads several market-data columns for many names in one pass.
  • beacon.analysis.performance.formulas: the formulas behind every performance figure, as pure functions of returns and levels, one definition each: the headline figures (total, annualised and compounded return, volatility, Sharpe ratio, drawdown and maximum drawdown), returns by calendar period and hit rates, and the relative figures (tracking error and difference, annualised relative return, both information ratios, correlation and beta), the money-weighted return and an exchange investor's return. Each is the arithmetic the figure was computed with, so a figure moved onto it is unchanged to the last bit. Two figures were measured two ways, and both are kept under their own names: the information ratio as the mean active return over its spread (information_ratio) and as the annualised relative return over the tracking error (annualised_information_ratio); and correlation and beta take the threshold below which a series counts as not varying.
  • beacon.analysis.performance.PerformanceAnalytics(run, settings): a run's performance figures from its RunData, a finished run's or a stored one's, so a stored run gives the figures its backtest did: the headline figures, the monthly hit rate, the tracking error, tracking difference and information ratio against the tracked index, and the money-weighted return. AnalysisSettings changes what they are measured over and with: a window (start, end, measured from the close before the window's first day), the periods a year, the risk-free rate, and the comparator tracking is measured against.
  • RunData keeps the level a run's total return and drawdown are measured along and what it starts from (performance, performance_start), and a run's investor cash flows (investor_flows), so a stored run's figures are its backtest's. A finished run's tables are built the first time one is asked for.
  • PerformanceAnalytics.comparison(comparator) gives the run against a comparator, by name or by its levels: the comparator's own figures and the run's relative ones (beacon.analysis.performance.comparisons.Comparison). PerformanceAnalytics.periods(frequency) gives the run's figures in each calendar year, quarter or month, with each comparator's own and relative figures in it (Period). RunData.of_returns gives a run known only by its returns, for these figures.
  • A run's return figures through PerformanceAnalytics (beacon.analysis.performance.return_figures): the returns over the last 1, 3 and 6 months and 1, 3, 5 and 10 years, for the month, quarter and year to date and since inception (trailing_returns), each from the close on or before the same date that many months before the last day, annualised as well when longer than a year and missing when longer than the run; the best and worst day, week, month, quarter and year with their dates, each period marked when the run covered only part of it (best_and_worst); the share of positive days, months and years (positive_shares); the average gain and loss and their ratio, over days or months (gains_and_losses); the longest runs of months that all gained and all lost (longest_streaks); and the arithmetic and geometric mean daily return, and each a year (means). Since inception is the summary's total and annualised return. At 6,000 names over seven years they take about 0.1 seconds together.
  • A run's drawdowns through PerformanceAnalytics.drawdowns(worst=5) (beacon.analysis.performance.drawdowns): the deepest, each with the day of its peak, its trough and its recovery, its depth, and the trading days to the trough, to recover and in all; the current drawdown; the average depth and length; the share of days below a peak and the longest time below one; the recovery factor (total return over the size of the deepest drawdown); and the ulcer and pain indexes (the root mean square and the mean size of the daily drawdown). A drawdown not recovered by the last day has no recovery date. The deepest is the summary's maximum drawdown. PerformanceAnalytics.levels() gives the dated level the figures are measured along, and drawdown_series() how far below its peak it stood each day.
  • A run's risk-adjusted ratios through PerformanceAnalytics.ratios() (beacon.analysis.performance.ratios), each over the daily returns in excess of the daily rate that compounds to the risk-free rate: Sortino (the mean excess return over the downside deviation, every day counted, annualised), Kappa 3 (daily), upside potential and Omega against the shortfall below the risk-free rate; Calmar, Martin, Sterling (over the mean of the three deepest drawdowns) and Burke against drawdowns; gain to pain on months; the probabilistic Sharpe ratio, the probability that the true Sharpe ratio is above a benchmark (0 unless given), allowing for skew and fat tails; the deflated Sharpe ratio, against the best Sharpe ratio a number of strategies would show by luck, when the number tried and the spread of their Sharpe ratios are given; and Lo's Sharpe ratio, corrected for serial correlation over ten days. A ratio over a risk that is not there is missing.
  • The shape of a run's daily returns through PerformanceAnalytics.distribution(bins=50) (beacon.analysis.performance.distribution): the downside deviation below the risk-free rate and the semi-variance below the mean, both annualised; the sample skew and excess kurtosis, bias-corrected as a spreadsheet's are; the tail ratio (the 95th percentile over the size of the 5th); the serial correlation at 1 to 5 days; and a histogram with the counts a normal distribution of the same mean and spread would give. PerformanceAnalytics.bootstrap() resamples the run's own days, in blocks if asked, to give an interval for its annualised return and Sharpe ratio; the same seed gives the same interval.
  • beacon.analysis.performance.RelativeAnalytics(run, comparator): a run against its index, optimised index or benchmark, or any levels, on the days both have. Jensen's alpha, beta, R-squared and the residual risk from one regression of the daily excess returns, with alpha's t-statistic and its probability by chance; the information ratio's t-statistic (the ratio times the root of the years) and its probability; the Treynor ratio; up and down capture and their ratio on months, as Morningstar measures them; the batting average (the share of months ahead); the drawdowns of the run's wealth relative to the comparator's; the downside tracking error (the days it fell behind, every day counted); each calendar year's tracking difference and their spread; and the comparison figures the run reports. figures() gives them all.
  • Rolling figures through PerformanceAnalytics.rolling(window=252, comparator=None) (beacon.analysis.performance.rolling): each day's return, volatility, Sharpe ratio, Sortino ratio and maximum drawdown over the window ending that day, and with a comparator its relative return, tracking error, information ratio, beta and correlation, each the static figure over its window, blank until the first full window. rolling_outcomes() gives the worst, median and best return over every window and the shares that gained and that got ahead of the comparator.
  • A run's figures as tables through PerformanceAnalytics (beacon.analysis.performance.tables): the calendar grid of monthly returns, a row a year with the year's own, of the fund, a comparator or the difference (monthly_grid); each year's, quarter's or month's return, volatility, Sharpe ratio and maximum drawdown for the fund (with its share of positive days), its index and benchmark and the differences (period_table); the trailing returns of each and their differences, given only where the two cover the same days (trailing_table); and the mean return of each calendar month (month_of_year). Differences are in percentage points; a year's months compound to the year and the years to the whole run.
  • beacon.analysis.performance.CrisisAnalytics(run, comparator, market, threshold=0.15, named=None): how a run held up in crises. The windows are each fall of a broad market series deeper than the threshold, peak to trough, the market given as levels (market data or an index built in Beacon) or as one of the run's comparators, its benchmark by default; or the user's own named episodes, eight US ones (S&P 500 peak to trough, from the dot-com bust to the 2025 tariff shock) in NAMED_CRISES. For each crisis: the fund's and the comparator's return and the difference, each one's deepest fall inside it, the crisis beta, the alpha against the whole run's beta, the returns 3 and 6 months after the trough, and the trading days the fund took to get back to its value at the start; a crisis the run covers only part of is marked partial. Across them (summary()): the average outperformance, the share outperformed, crisis capture and the pooled crisis alpha.
  • beacon.analysis.performance.RegimeAnalytics(run, comparator, market): how a run did in each kind of market, the regimes found on a broad market series as the crises are: months the market rose and fell, calm and volatile days (its 63-day volatility in its lowest and highest fifth), bear markets (falls of more than 20%) and corrections (10% to 20%), peak to trough. For each: the days, the fund's and the comparator's compounded and annualised returns, the difference, beta and Jensen's alpha over its days.
  • beacon.analysis.performance.PortfolioAnalytics(run): what a run held. The number of names the fund, its index or its benchmark held each day (holdings_count); each one's weight in each group of any grouping field kept with the run (sector, industry, region, country, currency, exchange) each day, a name's group being the one it had at the latest rebalance and Unknown where none was recorded (group_weights); and the fund's group weights less its index's or its benchmark's, when the benchmark holds names (active_group_weights). A book's group weights add up to its invested weight each day.
  • Every trade says why it was made. Transaction.reason is the event that triggered it: a rebalance, investing a subscription or raising cash for a redemption, reinvesting a dividend, raising cash or spending it down to keep it in its band, settling a derivative (futures margin, a swap reset, a hedge), finishing an order an execution limit carried over, or a corporate action. Transaction.tags holds every tag it carries: its reason; a cash raise when a trade made to move cash sells and a cash spend-down when it buys; on a rebalance, the stages that changed the name's target (diversification for the index's cap or the vehicle's diversification limits, liquidity for a capacity cut, liquidity or exclusion for a screen, a position limit for the smallest position allowed; a name dropped for a stale price carries no stage tag); and model-driven for an active strategy's rebalances. beacon.portfolio.reasons names them all, with a category each, including the reasons no feature makes yet (an index change, drift, a discretionary or risk-driven trade, a futures roll or exposure change, an FX hedge). Figures by reason add up to the run's; figures by tag may count a trade more than once. Portfolio.trading(reason) marks the trades made inside it.
  • A run keeps its trades as a table (beacon.backtest.breakdown.trades, the run's data's trades): each trade's date, name, side, quantity, price, value, cost and impact, reason and tags. A stored record's transactions are served from it, so they are kept once.
  • Turnover and trading through PortfolioAnalytics.turnover(by="day" | "rebalance" | "year") (beacon.analysis.performance.trading): the buys, sells, number of trades and their mean value, one-way turnover (the lesser of buys and sells, the SEC's measure, which money arriving or leaving does not inflate) and two-way turnover (all of it), over the NAV at the close before the trades, or a year's mean NAV: each trading day, marked when it was a rebalance; each rebalance's own trades; and each year. trading_by_reason() gives the trading by why it was made, adding up to the run's.
  • A run's costs through PortfolioAnalytics (beacon.analysis.performance.costs): by kind (the fixed cost and market impact of its trades, futures rolls), the creation fees it received and the net, over the run with each in basis points of its mean NAV a year, or each year with the net in basis points of the year's mean NAV (costs); its trading costs in basis points of the value traded (cost_per_traded); and its trading costs by why each trade was made (costs_by_reason), adding up to the run's.
  • A fund's own figures through PortfolioAnalytics (beacon.analysis.performance.fund_figures): the weighted market cap, P/E, P/B and dividend yield of the fund, its index and its benchmark at each rebalance, P/E and P/B as weighted harmonic means so a loss or a tiny book does not blow them up (characteristics); each day's distribution yield and trailing dividend yield over the year to it (income) and each year's dividends and their growth (dividend_growth); its AUM and units each day (aum); each month's or year's net flows and their share of the AUM it began with (net_flows); the cost of trading each day's flows, all of a day's trading costs when it did not rebalance and the flow's share of them when it did, less the creation fees received (flow_costs); and an ETF's premium to NAV on the exchange, its mean, volatility and widest each way, with the mean spread (etf_premium). An ETF's quotes are kept as a table of the run's data (market).
  • A run with a cash band records each time its cash left the band and was brought back (BacktestResult.cash_band_events, kept as the run's cash_band_events table): the day, whether it was a raise or a spend-down, the cash's share of the fund before and after, the target and the band, the value traded, its cost and the number of trades.
  • How a fund managed its cash through PortfolioAnalytics (beacon.analysis.performance.cash_management): each band event with the gap to the target before and after, the share of it closed and its cost in basis points of the value traded (cash_band_events); for raises, spend-downs and both, how many, what they traded and cost, and how close they brought the cash to its target (cash_band_summary); how many each month or year had (cash_band_calendar); and every trade made to raise or spend cash, by tag and by what it was for, such as the band, a redemption or a distribution (cash_trading).
  • A hedged share class can pay for its hedge: ShareClass(hedge_cost_bps=...), 0 by default, is charged on the notional each hedge trade deals (all of it when a forward is opened or rolled, the change in it when one is resized), paid from the fund's cash and borne by the class alone. Each hedge trade also records the spot rate it was struck at, its expiry, the carry it locks in over its term (its notional times the forward rate less spot, over spot) and its cost. The setting is in the server's share class settings and options.
  • A run with share classes keeps each class's days, flows and hedge trades as tables (class_days, class_flows, class_hedges; beacon.analysis.class_panels).
  • What dealing cost through PortfolioAnalytics (beacon.analysis.performance.dealing): each day's subscriptions or redemptions (an ETF's creations or redemptions), with the trading they caused, what the dealing investors paid toward it, the net cost to the fund and in basis points of the flow, and for an ETF the cost to the AP, the flow times the day's quoted cost of creating or redeeming (dealing_costs); those added up by kind over the run or each year (dealing_summary); and each share class's costs in the book's currency, over the run or each year, with the net in basis points of its assets: its fees, its hedge's costs and the carry its forwards earned for the share of their term they were held, the trading its own flows caused less what its dealing investors paid, and its share of the rest of the fund's trading by its share of the fund's assets (class_costs). The classes' trading adds up to the fund's.
  • Index futures can cost something to trade between rolls: IndexFutures and FuturesReplication take cost_per_contract, paid on each contract every trade trades (a roll trades two, the old contract and the new), and trading_cost_bps, paid on the notional of each trade between rolls (opening the position and each resize). Both are 0 by default, and both are in the server's equitise settings and options.
  • A run holding index futures records each trade of them (BacktestResult.futures_trades: opened, rolled or resized, the contracts before, after and traded, the price, the notional traded and the cost) and each day held (futures_days: contracts, price, the fair value it was priced from, the index level and the expiry), kept as the run's futures_trades and futures_days tables. The run's cost table has a futures_trading column for the trades between rolls, which the cost figures count.
  • Index futures can be priced off another index and away from fair value. underlying names the index the futures are on, when not the fund's: a market series' identifier, or in Python an IndexResult or a level series. prices names a series in the data whose close each day is the price of the contract held. On a day it has none, or with no series, the price is fair value moved by an assumed mispricing: mean-reverting around 0, with a standard deviation of mispricing_bps of fair value (0 by default, so prices are fair value as before), halving in mispricing_half_life sessions on average (10 by default), drawn from mispricing_seed. All five are in the server's equitise settings and options, the identifiers as text. A run's futures_days keeps the level of the index the futures are on and of the fund's own, and the mispricing, each day.
  • How a fund traded its index futures, and their basis risk, through PortfolioAnalytics (beacon.analysis.performance.futures_figures): the trading by why each trade was made, between rolls and all of it, with the contracts and notional traded, the cost per contract and in basis points of the notional, and the notional a year over the mean assets (futures_trading); the basis to the futures' own index, split into carry and mispricing, each day or as its mean, volatility and extremes in basis points (futures_basis); and basis risk, the mean a year and tracking error of the pricing basis (the futures against their own index) and of the underlying mismatch (that index against the fund's), with days the position rolled left out (futures_basis_risk).
  • The risk model an analysis of a run uses (beacon.analysis.risk.model): RiskModelSettings chooses the kind (the shrunk sample covariance, or the factor model on exposures the caller gives), the window of daily returns it is estimated on (252 sessions by default), and a sample model's target and intensity; RebalanceRiskModels estimates it once at each rebalance, on the sessions before that day, for every name the fund, its index or its benchmark held. A name whose returns do not cover the whole window is left out of that rebalance's model, and uncovered says which.
  • Factors (beacon.strategy.Factor): a standardised score built from one or more signals, which serves wherever a signal does, a factor tilt's factor among them. Each part's values are made larger-is-better, transformed if asked (log or inverse), and centred and scaled across a universe: on its cap-weighted mean by default, so the market has no exposure, or its equally weighted mean (centre); within groups when centre_by names grouping fields (such as "sector", or ["region", "sector"]), a group of fewer than 5 names centred on the next wider one; on the universe's spread unless scale_within_groups; capped at 3 either side. A factor of several parts averages their scores by weights (equal unless given) over the parts a name has, then standardises again; a part may itself be a factor. standardise=False takes exposures as they are, for a vendor's imported as a feature, and returns names a series of the factor's own level. default_factors() gives size (minus log market cap), value (book to price) and momentum (the twelve-month return less the last month). The server builds factors from JSON, and the options publish their parameters' shapes (SignalWeights, GroupingFields).
  • A run's factors (beacon.analysis.risk.factors.FactorAnalytics, given the run's data and the data it read): each held name's exposures to each factor at each rebalance, standardised over the index's names that day or a universe given, with the groups too small to centre on (exposures, fallbacks); each day's factor returns, from a cap-weighted cross-sectional regression of the universe's returns on their exposures at the last rebalance before the day, with a market intercept, or a factor's own series where it names one (factor_returns); and the betas of the fund, a comparator or the active return to them, with standard errors, t-statistics, R² and the alpha a year (regression), over the run or a rolling window (rolling_betas). The default factors are size, value and momentum.
  • Holdings-based factor exposures (FactorAnalytics.holdings_exposures, active_exposures): a book's weights times its names' exposures, for the fund, its index or its benchmark, at each rebalance from its weights at that day's close or each day from that day's weights and the last rebalance's exposures, and the fund's less a comparator's. Cash and names without exposures add nothing.
  • Value at risk and expected shortfall (beacon.analysis.risk.var), as positive losses at 95% and 99%, one day and ten (the square root of ten times one day): historical (the returns' quantile, and the mean of the returns beyond it), normal (from their mean and standard deviation), and for value at risk Cornish-Fisher (the normal's, moved by their skew and excess kurtosis; reliable for moderate tails). RiskOfLoss(run).table(book) gives every figure for the fund, a comparator or the active return, and stress_windows() each book's return and deepest fall in each of the run's crises, the market's falls of 15% or more or named episodes.
  • Risk over a run (beacon.analysis.risk.contributions.RiskOverTime, on a run's factors): at each rebalance with a year of returns before it, the factor model's expected volatility and tracking error, each split exactly into factor and specific parts, the diversification ratio, the average correlation the weights imply and the weight the model covers (expected, summary); each name's weight, marginal contribution, contribution and share of the expected volatility or tracking error, adding up to it, and the same by any grouping field (contributions, group_contributions); and each name's or group's share of the fund's measured variance over the run, from its daily contribution to the fund's return, with the rest of the return as other, adding up to 1 (measured).
  • Concentration (beacon.analysis.risk.concentration.ConcentrationAnalytics). By weight, over the names held: the Herfindahl index and its normalised form, the effective number of holdings, the largest weight and the top 5, 10 and 20, the fewest names making 50%, 80% and 90%, and optionally the Gini coefficient (with lorenz for its curve) and entropy; for the fund, its index or benchmark, across any grouping field, against the index, at each rebalance or each day, by month or year, and inside each crisis against the calm days (by_weight, against, by_period, in_crises). By risk, at each rebalance: the Herfindahl of the names' shares of the expected volatility, the effective number of risk sources, the top names' share, the diversification ratio and average correlation (by_risk), and optionally the absorption ratio (absorption_ratio). By outcome: the top contributors' share of the fund's return from its names over a window, and breadth (by_outcome). And drift, the share of the book that would trade to put it back to the last rebalance (drift).
  • Liquidity over a run (beacon.analysis.risk.liquidity.LiquidityAnalytics): at each rebalance and month end, each holding's value, average daily traded value and days to sell at a set share of it a day (20% by default), and the share of the book sellable within 1, 5 and 20 days, the days to sell all of it, the value-weighted mean days and the share with no traded value (days_to_sell, profile). Traded values are measured from the run's data over the last 20 days with a volume by default, as the liquidity screens measure them, or taken from a stored run's own traded values, kept over the screens' 63 days.
  • A run's attribution (beacon.analysis.Attribution(run)): each name's, or each group's by any grouping field, contribution to a book's return (the fund, its index or benchmark) over the run or a window (contribution), and to the fund's return over its index or benchmark from its active weights (active), from the run's own daily total returns for each name, linked over the days by Carino's factors. Each is one AttributionResult, with its residual (what the names do not explain: cash, costs, fees, dividends a price index leaves out) and whether it reconciles. A group contributes what its names did, each in the group it was in at the close before.
  • Brinson-Fachler attribution (Attribution(run).brinson(field, against), brinson_by_period; beacon.analysis.attribution.brinson): the fund's return over its index or benchmark by any grouping field, each group's allocation, selection and interaction on its own line and cash a group of its own, each day from the weights at the close before, linked over the run (or each month or year) by Carino's factors for an active return. The effects add up to the holdings' active return; what they do not explain of the books' own returns (costs, fees, a price index's missing dividends) is the residual. A group the fund does not hold has no selection or interaction; one the comparator does not hold is all interaction.
  • Currency and factor attribution. Attribution(run).currency(against, by_currency) splits the fund's return (or its active return) into its names' local returns, their currencies' moves into the book's currency and the cross term, each on its own line, optionally by currency, from local returns worked out from the run's own closes and corporate actions. Attribution(run).factors(analytics, against, method) explains it by the run's factors: from the holdings (holdings: the market, each factor's exposure times its return, and the specific return, an exact split) or from the returns (returns: the risk-free rate, the alpha, each beta times its factor's return, and the regression's residual). Each is an EffectsResult, linked over the days by Carino's factors, with its residual.
  • The implementation breakdown of the tracking difference (Attribution(run).implementation(against); beacon.analysis.attribution.implementation): the fund's return less its index's split, each day from the run's own records, into the cap and screens (the gap the last rebalance left between the fund's invested weights and the index's), drift (how that gap moved since), cash drag (what the cash gave up against the index, less its interest), equitisation (the futures' profit before their costs), fixed costs, market impact, futures rolls, futures trading, fees, withholding tax, creation fees and dividend treatment (the dividends a price index leaves out), linked over the run, with what is left as the residual. Each day is measured on the base the fund's return per unit is, so money dealt that day joins as cash; the run's first day starts from its capital, so its costs of buying in count.
  • A backtest's analytics on its result, each built on first read with default settings and kept: result.analytics (performance), result.portfolio_analytics, result.risk (factors, value at risk, risk over time, concentration and liquidity, as beacon.analysis.risk.analytics.RiskAnalytics) and result.attribution, all over result.run_data.
  • A run's analysis as reports (beacon.analysis.reports). 103 statistics (beacon.analysis.reports.catalogue.CATALOGUE), each with an id, a label, a category, a description, the kind of value it gives (named figures, a series or a table, a table with the figures that sum it up), its unit and decimals, the settings it reads, and whether it can roll and what rolling it costs. Eight reports (beacon.analysis.reports.definitions.REPORTS: factsheet, performance, risk, tracking error, factor, portfolio, attribution, implementation), each at a core and an extended level, each level its statistics in sections by category, every one included or optional, with the time view it is shown in by default (point, rolling or both); everything in a report's extended view is optional for its core. Figures of returns are given for the fund, each comparator and each share class (class/<name>), and relative figures against each comparator.
  • Backtest.run(..., analysis=AnalysisRequest(reports={"factsheet": "core"}, add=..., remove=..., time_views=..., statistics=..., options=..., factors=...)) (beacon.analysis.request) works out the statistics the reports asked for, each once, and only the parts they need, so a factsheet's core never builds the risk model. The result keeps the request (analysis_request), the analytics block (analysis_block: the request with every default filled in, each report's statistics by id with their views, each statistic's value as plain data and, where wanted, its rolling table, the statistics the run cannot give with a code and a reason, the comparator active figures are measured against, and the seconds each part took) and the timings alone (analysis_timings). Each part says so as it starts ("Computing performance", "Building the risk model"). beacon.analysis.request.analyse gives the block for a finished run, analyse_run for any run's Context.
  • Every choice the analysis makes is a setting, in sections (beacon.analysis.reports.options.AnalysisOptions): the window, rolling figures (window, and a daily or month-end step), returns and ratios, crises and regimes, value at risk, the risk model's lookback, liquidity and attribution; describe() gives each section's settings as a form draws them (type, default, label, help, unit, choices with their labels, suggestions, bounds, and a list's items).
  • Rolling figures for any statistic of a window of returns (beacon.analysis.reports.rolling): each window's figure is the statistic worked out over that window, so a rolling figure is always its window's point figure. Return, volatility, the Sharpe and Sortino ratios, maximum drawdown, value at risk, expected shortfall, and against each comparator the tracking difference and error, information ratio, beta and correlation roll in one pass over the whole series, checked against the window-by-window figures; the rest are worked out window by window, together, sharing each window's work. A statistic that is heavy to roll steps month end unless asked otherwise. Every report at its extended level, at 6,000 names over seven years, takes 53 s, and a factsheet's core 24 s, most of each in building the factor exposures and risk model.
  • A stored run keeps its trades as what was traded (date, name, side, quantity, reason and tags) and the run's fixed cost rate, and works out each trade's price, value, cost and impact again on reading, in the arithmetic that recorded them; any value that does not come back to the last bit is kept as recorded, and a column that would need correcting for most trades (the costs of a run that modelled market impact) is kept whole. Checked on writing: trades that would not come back exactly are kept as they are. At 6,000 names over seven years the trades take 1.4 MB instead of 4.8 MB.
  • The concentration curve (ConcentrationAnalytics.curve(date, book, field), beacon.analysis.risk.concentration.concentration_curve): a book's names (or groups) largest first, position by position, with each one's weight, the cumulative weight to it, and the Herfindahl and effective number of the top k on their own with the change the k-th made to each, for a cumulative-weight chart and for seeing how much each further position diversifies. The weight figures add the top 25.
  • RunData.latest(name, rows) gives a table's last rows. A stored run's daily weights are worked out for those days alone, and are exactly those rows of the whole table.
  • API: POST /strategies/{strategy_id}/backtest takes analysis (reports by id and level, statistics added or taken out, time views, statistics outside any report, and every setting by section), refused with 422 before the run when it cannot be given; the job's result and /result carry the analytics block, which names the run's large tables. GET /strategies/{strategy_id}/analytics serves the latest run's block later, or not_computed for a run made without one. GET /strategies/{strategy_id}/tables/{name} serves a large table whole (the trades): by column in JSON, repeated text as its distinct values and a code a row and a column the same on every row sent once, numbers rounded (units to six decimals, prices and costs to four, values to cents); or as an Arrow IPC stream with Accept: application/vnd.apache.arrow.stream.
  • API: GET /analysis/options lists everything an analysis can be asked for: each section of settings in the shape /backtest/options uses, every statistic (label, category, kind, unit, decimals, rolling cost and step, the settings it reads, its figure-name dimensions, a table's columns), every report at both levels by section, labels for figure names by dimension, the large tables' columns, every reason a statistic can be unavailable, and ids renamed or dropped.
  • Each statistic says which of its figures are returns or differences, whose sign says better or worse (Statistic.signed, signed in /analysis/options), so a client colours those alone; and the analytics block lists the reference fields the run kept for its names (groupings), which attribution can group by.
  • A stored run's analysis asked for again (beacon.analysis.reports.rerun.rerun): with the choices the run's own analysis was made with, only the statistics it lacks, or lacks in a view now wanted, are worked out, and the answer is the whole analysis, the earlier statistics and reports with the new; with other choices everything asked for is worked out afresh. A run's factor work (each rebalance's exposures, the caps they used, the groups that fell back, the daily factor returns) is kept beside it, keyed by the factors' definitions and universe, and read rather than worked out again (beacon.analysis.risk.factor_store; beacon.analysis.request.keep_analysis_work for a finished run); factors read from a Python function are never kept. A statistic reading a table a run stored before it was kept is unavailable with run_predates.
  • API: POST /strategies/{strategy_id}/analytics asks for an analysis of the strategy's latest run, as a job (analytics:{strategy_id}) whose result is the whole analysis: with the run's own choices it joins the run's analysis, which GET .../analytics then serves; with other choices it is kept only under save. GET /strategies/{strategy_id}/analyses lists the analyses saved with the latest run, GET and DELETE /strategies/{strategy_id}/analyses/{name} read and remove one; a new backtest of the strategy leaves none. A backtest job keeps its factor work with the run.
  • Brinson-Fachler by name within each group (BrinsonResult.names, beacon.analysis.attribution.brinson_names): each group's selection and interaction split across its names by active weight within the group, a name's share of the fund's holding of the group less its share of the comparator's, times its return less the comparator's group return, linked with the groups' Carino factors. A group's names add up to its own effects; a name only the comparator held shows what not holding it cost; allocation stays a group's. The Brinson statistic gives the names' rows after the groups', told apart by level, each with its group. At 6,000 names it adds about 0.7 s.
  • API: responses of 1 MB or more are gzipped for a client on another machine, and sent as they are to one on the same machine, where compressing costs more than it saves.
  • A global factor model, for names in more than one market (beacon.risk.model.global_fit.fit_global_model): country, sector and currency factors beside the market and the styles. Each name has an exposure of 1 to its country's factor and its sector's; a country with fewer than 10 names (a setting) joins its region's factor, such as Europe (other). The countries' returns, weighted by their market caps, add up to zero, and so do the sectors', so each is measured against the market and the split between them is not arbitrary; a portfolio holding the market by cap therefore has no country or sector risk, and they show in its active risk. A currency's factor return is its own return against the base, from the rates, and every other factor is fitted on the names' returns in their own currencies, each name weighted by the square root of its market cap. It is fitted on weekly returns, ending on Fridays (weekly_returns), so markets closing at different times do not understate how they move together. FactorRiskModel.dimensions gives its independent factors, one fewer than its factors for each constrained set.
  • A run's analysis takes the global model at a rebalance whose names span more than one country, over the 104 weeks before it. Each part is a modelling assumption in the report options (risk_model): the factors (structure: automatic, global or styles only), the field a name's country is read from (country_field: its domicile by default, its listing, its region, or none), the fewest names a country needs (minimum_names), whether sectors and currencies are factors, whether the returns are weekly, and the weeks fitted on. On a 6,000-name run in 15 countries, a portfolio of only the index's US names has a tracking error of 3.0% against it, 76% from countries, 10% from currencies and 12% specific, where the styles model gave 1.2%, nearly all specific.
  • Docs: new concepts pages on a run's performance, portfolio and risk analysis, a section on the attribution page for a run's attribution (by name and group, Brinson-Fachler, currency, factors and implementation), and the analytics classes in the analysis reference.
  • A check of the risk model's forecasts: RiskOverTime.forecast_check() sets each rebalance's expected volatility and tracking error beside the ones measured over the days until the next rebalance, with their ratio, and RiskOverTime.bias_statistics() gives the standard deviation of the daily returns over the forecast in force, 1 when the forecasts were right on average (beacon.analysis.risk.forecast).

Changed

  • A strategy's stored run keeps its market inputs (closes, exchange rates, corporate actions, currencies, traded values, characteristics and reference data) once per data store, shared by every run on it (beacon.analysis.shared_inputs): each table is cut into pieces of a name's year named by a fingerprint of their contents, kept in market_inputs/<store id> with a catalogue, and the run keeps the list of pieces it used. A repeat run adds nothing, a longer one only the earlier years, a wider one the new names, and a revised price is a new piece, so an older run reads the numbers it ran on. A folder of more than 20 files is merged into one per table, dropping pieces no run uses. The fund's holdings are worked out again from its trades and splits (beacon.analysis.holding_replay), with what those do not give back kept. RunData.write(folder, shared=, store=) writes this layout; RunData.from_record reads either. Every table reads back exactly. Runs stored before are moved to it when the server starts, under market_inputs/unattributed. At 6,000 names over seven years a run keeps 10.5 MB of its own rather than 52.9, with 38.5 MB shared, and a repeat run adds nothing to the shared folder; writing the run takes 5.2 s rather than 3.6 (4.3 s for a repeat), and reading every table 4.1 s.
  • An index's results within a stored run (its target and optimised books' holdings, days, names and patches) are kept once in the data store's shared folder, under indices/<fingerprint>, for every strategy tracking that index on the same data over the same days (beacon.analysis.shared_indices). The fingerprint is of the tables themselves, so a changed definition, other data or other days give another entry and an older run reads the index it ran against. Entries no run uses are removed once a folder holds more than 20; nothing written in the last hour is removed, so a run saved alongside keeps what it added. At 6,000 names this is 7.5 MB a run: a run keeps 3.0 MB of its own, with 46.1 MB shared, where it kept 52.9 MB before 0.10.0, and a second strategy on the same index and data adds nothing.
  • Deleting a data store (DELETE /data/stores/{id}) answers 200 with what became of the stored runs that read it (kept, deleted, warning), where it answered 204. Those runs keep their market inputs, and each says so when opened (RunData.warnings, and warnings on GET /strategies/{id}/analytics); with ?cascade=true they are deleted too.
  • A run's active attribution (Attribution.active, and BacktestResult.active_attribution) explains the fund's compounded return less the comparator's, the same total Brinson-Fachler, currency, factor and implementation attribution explain: the days are linked by the active Carino factor. It explained the daily differences compounded, a different number: 3.15% where the others explain 4.43% on the attribution page's sample. link_contributions and attribute take the comparator's returns for this (comparator=).
  • Jensen's regression against a comparator that does not vary (RelativeAnalytics.regression) has a beta of 0, as formulas.beta and the rest of a run's comparisons give it, and an alpha of the mean excess return, where it was missing.
  • Trades say why they were made with the reasons beacon.portfolio.reasons defines. A futures trade's reason is futures roll or futures exposure, and a hedged class's forward trade's fx hedge; what each did (open, roll, resize, or band for a hedge) is its new kind, which the futures trading table is still given by, and the server's hedge records carry. Holdings bought or sold for what a currency hedge settles for, or for its cost, are fx hedge trades (tagged settlement for a settlement), where they were settlement. The cash band's sale is fee funding when the fees paid and owed since the cash was last at its target are at least half of what it raises, and a cash raise otherwise. Nothing is sold to fund a distribution, which is paid from the income it distributes.
  • A run whose names span more than one country is analysed with the global factor model, so its expected risk, contributions, diversification and absorption ratio change. It needs 104 weeks of returns before a rebalance, so a run's first two years have no expected risk under it; choose styles only, or fewer weeks, for the old figures. The absorption ratio counts one eigenvalue per independent factor (34 of the global model's 36 on the 6,000-name run, reading 0.46 where the styles model's four read 0.27). On that run the model at 16 rebalances takes 2.4 s.
  • The absorption ratio is the share of the held names' total variance in the risk model's largest eigenvalues, one per factor (ConcentrationAnalytics.absorption_ratio(date, components=None)), instead of the largest fifth of them. On a factor model the fifth of thousands of eigenvalues was mostly the names' own risk: at the last rebalance of a 6,000-name run it read 0.61, where the four factors absorb 0.27. The eigenvalues come from products with the covariance (FactorRiskModel.largest_eigenvalues, beside total_variance), so the names' full matrix is never built: 0.1 s instead of 3.7 s, the same to 15 decimal places as decomposing it in full. Over a sample covariance, which has no factors, it still counts the largest fifth.
  • Synthetic prices (open, high, low and close) are quoted in whole cents and kept as 64-bit numbers, so each is exactly the price a feed would print; dividends are paid in whole cents. They had four decimals, stored in 32 bits, which read back as values such as 385.531189. A store generated now differs from one generated by 0.9.7 with the same seed; extending an older store writes its new days in whole cents. Free-float factors keep four decimals and exchange rates their full precision.
  • Reading prices for many names at once (DataFetcher.fetch_prices) builds its table from the index directly: at 6,000 names over seven years it takes 1.1 s rather than about 2.8 s.
  • A strategy's backtest record keeps its large parts as tables beside it, and its JSON holds the rest: each book's daily weights are served from the run's own weights tables, the fund's units in the holdings document from its holdings, and the positions, transactions, rebalance snapshots and the rest of the holdings document are kept as tables of their own. A part moves only when it reads back exactly, which is checked as it is written. Every response is unchanged, and a record kept before still opens. The JSON is written without spaces. On a 6,000-name run the record was 241.6 MB of JSON; it is now 0.3 MB of JSON and 8.2 MB of tables, so the whole stored run is 39 MB rather than 272 MB. Saving it takes about 6 seconds less, and the backtest job about 43 seconds rather than 49.
  • Listing a server's backtest records (GET /strategies/runs) reads each record's small JSON rather than all of it, so it no longer takes seconds per 6,000-name record. Reading a record's holdings workflow (GET /strategies/{id}/holdings) reads only the holdings document's tables: 0.6 seconds rather than 2.5 at 6,000 names. Serving the whole record (GET /strategies/{id}/record) works the daily weights out again for the days it shows, which takes about 4 seconds at 6,000 names where reading the old JSON took about 3.
  • BacktestResult.summary() is PerformanceAnalytics's summary, with an ETF's trading and an active strategy's own figures added. Every figure is unchanged, except that a tracking error measured over a single day, which was NaN, is now left out, as every other figure that cannot be measured is.
  • A run's comparisons against its index and benchmark, and its figures by period, are PerformanceAnalytics's, and BacktestResult.get_tracking_error, get_tracking_difference, information_ratio, money_weighted_return and get_annual_returns give its figures; relative_metrics, a share class's figures against its benchmark and the ETF tracking functions are computed with the formulas. Every figure is unchanged.
  • The Sharpe ratio is the mean daily return in excess of the risk-free rate, over its standard deviation, annualised by the square root of the periods a year, everywhere: a backtest's summary, a comparator's own figures, the figures by period and beacon.analysis.calculate_sharpe_ratio. The annual risk-free rate is taken as the daily rate that compounds to it. It was the annualised (compounded) return less the risk-free rate, over the volatility, which counted volatility twice, since its drag lowers the compounded return, and fell as a strategy was levered; the mean daily form does not change with leverage. calculate_sharpe_ratio divided the rate evenly across the days and gave NaN or infinity for returns that did not vary; it now gives what a backtest reports, and 0 for such returns. On the 6,000-name example run the summary's Sharpe ratio goes from 0.941 to 0.964 (0.805 to 0.830 at a 3% risk-free rate), and the quickstart's from 1.095 to 1.089.
  • The information ratio in a run's comparisons is the mean daily active return over its standard deviation, annualised, as a backtest's summary has always measured it. It was the difference of the two annualised returns over the tracking error, which scales the active return by one plus the comparator's growth, so it partly measured the market. On the 6,000-name example run it goes from 11.30 to 8.54 against the index. An information ratio over active returns that do not vary (a standard deviation of at most 1e-12) is now missing, where it was one rounding error over another.
  • Correlation and beta are 0 when a series does not vary (a standard deviation of at most 1e-12) in a run's comparisons too, as relative_metrics reported them; they were missing.
  • A backtest of a stored strategy with a benchmark calculates the benchmark before the run and gives it to the run, rather than calculating its levels afterwards. A stored index used as the benchmark is now on the record as a book with its levels, daily weights and rebalances, where the record's benchmark used to be null. The comparison against it is unchanged.
  • A futures roll's recorded cost (FuturesRoll.cost, the run's futures_rolls costs) includes the new cost per contract of both legs as well as the roll cost; with no cost per contract it is unchanged.
  • The factor model is in beacon.risk.model beside the sample model: FactorRiskModel, fit_factor_model, z_scores, ActiveRiskDecomposition and MARKET_FACTOR are imported from beacon.risk.model (or beacon.risk, as before), and beacon.risk.factors is gone. beacon.analysis.risk is a package; its single-series metrics are in beacon.analysis.risk.single_series and importable from beacon.analysis.risk as before.
  • A field signal reads its field for every name at once (beacon.expressions.resolve.numbers_of), with the same answers as name by name: at 4,500 names a rebalance's market caps, closes and features are read once rather than once a name, and the three default factors' exposures take 2.4 s a rebalance rather than 19.
  • Attribution is a package (beacon.analysis.attribution), its decomposition and linking in beacon.analysis.attribution.contribution, all importable from beacon.analysis as before; their results are unchanged. The old Attribution class, whose one method compared two total returns, is gone: simple_performance_attribution does the same, and Attribution is now the run's attribution.
  • Momentum is worked out for every name at once, and a day's factors read the names' market caps once, for the size factor and the centring alike, with the same answers: at 6,000 names the three default factors' exposures at 20 rebalances take 19 s rather than 35.
  • The factor analytics are faster. At 6,000 names over seven years a factsheet's core takes 6.8 s instead of 24.7, the risk report's core 8.1 s instead of 25.3, the tracking error report's 7.2 s instead of 18.9, and every report at its extended level 25 s instead of 43. Each name's last market value in a window is read from the store's session index (DataFetcher.last_market_values) instead of from a slice of every name's history; each feature is read once over every rebalance; the daily factor returns are fitted a stretch between rebalances at a time, every day with the same names priced in one fit; the risk models check each name's returns in one pass; and the fund's daily weights are put straight into a grid, and the positions' dates converted once a day, so a run's weights take 0.7 s instead of 3.4. Everything is the same to the last bit, except the factor returns and the figures read from them (factor betas, factor attribution), which differ in the last places (at most 1.5e-14 relative) from fitting days together.
  • Attribution and the rolling factor betas are faster. At 6,000 names over seven years the attribution report at its extended level takes about 4 s of attribution instead of 8.5, the tracking error report's core 6.6 s instead of 7.8, and every report at its extended level 22 s instead of 28. Contributions work out every name's average weight and total return at once (the same figures); holdings-based factor attribution works a stretch between rebalances at a time as matrix products; the rolling factor betas sum every window's cross-products at once and solve them together, a near-singular window by least squares; the bulk field reads and momentum look names up in dicts. Everything is the same to the last bit except the rolling factor betas (at most 3.5e-14 relative) and factor attribution (in the last places).
  • The server's views compute no figures of their own: they call the library and convert what it gives. New in the library for them: beacon.analysis.performance.levels (rebased, daily_returns, total_return, headline, annual_returns and compared, several level series on one axis over the dates they share), beacon.analysis.attribution.schedule.attribute_schedule (an index's names' contributions over a window, with its cap and cost drags), beacon.risk.prices (a risk model, and a book's total and active risk by name, from prices, None under 60 days), beacon.optimise.inputs (expected returns and the size, momentum and volatility exposures an optimisation uses), BacktestResult.total_costs, OptimisationResult.active_sum, and ShareClassBook.fees_paid and distributions_paid. Every view's answers are unchanged. The rest followed: the server now calculates nothing. New in the library for it: beacon.derivatives.valuation (value_future with its carry split, basis, implied repo and sensitivity grid, value_swap with its financing schedule, fair spread and breakeven against futures, roll_between, tenor_of), beacon.data.market_caps (caps_of, in full and free float, local and converted, is_stale, shares_of_total), beacon.portfolio.valuation.held_weights, DataFetcher.last_prices, beacon.backtest.implementation.buffered, beacon.index.capping.reachable_weight and is_tight, beacon.index.schedule.projection_end and days_until, beacon.analysis.liquidity.trailing_start, beacon.analysis.concentration.total_weight, beacon.catalogue.in_words, BacktestResult.fees_paid and OptimisationResult.by_active_size. Every endpoint's answers are unchanged.

Fixed

  • A run's risk (result.risk) used the default risk model and liquidity settings whatever its analysis asked for; it now uses the analysis's risk model, participation and look-back, as its reports do, so the two agree.
  • A name with no value for a factor's group field (no sector, say) was centred and scaled in a group of its own, named "None"; it is now centred in the wider group it does have, as a thin group's names are, down to the whole universe.
  • Attribution against the optimised index (against="optimised", or the optimised book) failed with a bare KeyError; it now reads the optimised index's weights as it reads the index's, and an unknown book is named in the error.
  • An expected tracking error that is rounding in the weights (below a millionth of the portfolio's own volatility, as for a fund holding its index exactly) was split into names' shares that were noise, such as 0.42 and -0.14; those shares are now 0.
  • Concentration in crises (ConcentrationAnalytics.in_crises) ignored the analysis window, finding crises over the whole run and counting days outside the window as calm; it now uses the window and conventions the value at risk's stress windows do.
  • A stored run's top weights, coverage, Gini and entropy differed from the finished run's in the last places: its weights, worked out again, were laid out in memory the other way, and a sum along a day added in another order. The weights are now laid out the same way before they are summed.
  • After a backtest's analytics had been read (as Backtest.run(analysis=...) reads them), its metrics (result.summary() and the figures built on it) failed: the analytics kept on the result hid the method the metrics read them through.
  • Relative figures over a window that started after the run (AnalysisSettings(start=...), and every rolling window) measured the comparator's first day as nothing, leaving a day of its move out: of the relative analytics, crises, regimes, a comparator's rolling figures and the value at risk of active returns. The comparator's first return in such a window is now from its close before the window, as the fund's is. A run's own first day is unchanged.
  • Futures on a total return or net total return index with no dividend yield given kept only their roll days and roll cost: any other term (the multiplier, whole contracts, the band) was reset to its default. Every term is now kept.
  • A cash band check that had nothing to buy or sell, as before a fund's first rebalance, was recorded as a band event that traded nothing, every day; it is now no event, and does not resize the futures equitising the cash.
  • A run's name returns lost a day's move wherever the data printed a close on a day the market was shut (a holiday's print): the table was measured on every printed day and then kept only the sessions, so the session after a holiday returned from the holiday, not from the session before. Such a day is now compounded into the next session, so the names explain the fund's return on it; every other day's returns are unchanged to the last bit. Stored runs work their name returns out again when opened, so they correct themselves.

Deprecated

  • RiskMetricsCalculator, calculate_volatility, calculate_sharpe_ratio and calculate_max_drawdown (in beacon.analysis and beacon.analysis.risk), and simple_performance_attribution, to be removed in 0.11.0. Use beacon.analysis.performance.formulas: volatility on the returns, sharpe_ratio, max_drawdown, and compounded_return on each series for the difference of two total returns. A run's figures are result.analytics.headline(). Until then each warns with a DeprecationWarning naming its replacement, and gives the same answer as before.

Removed

  • beacon.analysis.comparison: its comparisons and figures by period are PerformanceAnalytics.comparison and PerformanceAnalytics.periods, and the functions that built them are in beacon.analysis.performance.comparisons (comparison_of, periods_of, period_against) and beacon.analysis.performance.formulas (hit_rate_monthly, returns_from_start).

[0.9.7] - 2026-10-22

A backtest tracks its index the way a real fund does. Dividends count in the NAV from their ex-date, a fund's cash can be held within a band, and index futures follow the cash every day in whole contracts. On the TTIX backtest over 6,000 names against a total-return index, tracking error went from 0.81% to 0.08%. Postgres stores load several times faster with a third of the memory, and no longer fail on a NULL number. Synthetic data spreads dividends across the year and has companies leave as a large-cap market's do, mostly small ones and mostly through takeovers. Results change for backtests holding names through an ex-date, runs holding futures, and stores generated anew.

Added

  • A cash band: Implementation(cash_band=(lower, upper)), and implementation.cash_band in the API, checks the cash at every close between rebalances. Above the upper edge the cash above cash_buffer is invested; below the lower edge holdings are sold pro rata back up to it. Off by default, which keeps the cash waiting for the next rebalance as before.

Changed

  • Synthetic names leave as a large-cap market's do: the chance of leaving falls with a company's size, and each exit is a takeover or a failure. Takeovers are likelier the larger the company (about a third of the smallest names' exits, four fifths of the largest), announced 40 to 120 sessions ahead at a 20% to 45% premium, with the price closing its spread to the offer by the last day; failures, not bids, crowd into a crisis. The overall rate is unchanged. On a 600-name store, the largest fifth of names had 5 exits rather than 26, and the 2020 crash 7 rather than 13, none of them large. A store generated now differs from one generated by 0.9.6 with the same seed; a store generated before keeps its exits when extended.
  • A Postgres store is streamed out with COPY and each column read as the type the database holds it in, rather than every value fetched, written as text and read back. On a 6,000-name store (11.4 million market rows) loading takes 19 s and 4.2 GiB, where reading and checking alone took 85 s and 13.8 GiB. A store's date and number columns must now have Postgres date and number types; a column of another type is refused, naming it.
  • Index futures, whether a futures-based fund's or equitising a buffer, are checked every day and resized once their exposure is further from its target than band (0.25% of the net assets by default), not only at rebalances, rolls and flows. A contract is now worth its price times multiplier (50 by default), and the position holds whole contracts unless whole_contracts is false. Results of runs holding futures change. On the TTIX backtest over 6,000 names the tracking error went from 0.16% to 0.08%, and at 600 names from 0.49% to 0.22%, where cash from delisted names used to sit uncovered until the next rebalance.
  • A backtest's NAV includes a dividend from its ex-date, as a receivable at the day's exchange rate and net of withholding tax, until it is paid. It used to be left out until the pay date, so the NAV dipped on each ex-date and recovered on the pay date against a total-return index that reinvests the dividend on the ex-date. On the TTIX backtest over 6,000 names (London UCITS ETF, total-return index) the tracking error went from 0.81% to 0.16%. Nothing is bought with a receivable before it is paid. The run's result carries it as dividends_receivable. Results change for every backtest that holds a name through an ex-date before its pay date.
  • Synthetic data times each name's dividends on its own: one of the three quarterly cycles of months, a day of the month, and two to five weeks to payment, so a large universe's dividends land across the year rather than on one day a quarter. A store generated now has different dividend dates, and so different prices, from one generated by 0.9.6 with the same seed. A store generated before keeps its timing when extended.

Fixed

  • A Postgres store with a NULL in an optional number column (such as an exchange rate's VOLUME) failed to load: the NULL came back as NaN, was written as the text 'nan', and was refused as not a number.

[0.9.6] - 2026-10-22

Backtests are many times faster, and data stores load in a fraction of the time. Over 6,000 names and seven years, a London-calendar UCITS ETF backtest with market impact, a weight cap and flows went from 807 s to 43 s, and a plain backtest of 3,908 holdings from 756 s to 47 s. At 600 names a market-impact backtest went from 506 s to 6 s. Stores are now Parquet: a store saved by an earlier version is converted the first time it is loaded, and the 6,000-name store loads in 2.0 s rather than 17.7 s. Results are unchanged except where noted below: a reinvested dividend now buys the name that paid it by default, and market impact agrees with 0.9.5 to about 5e-13 of each cost rather than to the last bit.

Changed

  • Data stores are Parquet rather than gzipped CSV, and pyarrow is a core dependency. Loading the 6,000-name synthetic store went from 17.7 s to 2.0 s, and it takes 242 MB rather than 312 MB. Writing a backtest's index to the index cache, now Parquet too, is most of a second rather than most of fifteen, so the 6,000-name base backtest went from 68 s to 47 s. A store saved by an earlier version is converted the first time it is loaded, and reads the same. A store saved from now on keeps its numbers exactly: CSV read about one float64 in six back a bit away from its value, so a store generated or imported now can differ from one made by 0.9.5 in the last digits. With pyarrow installed, pandas holds text columns in pyarrow arrays; results are the same either way.
  • Market impact reads each name's average traded value and volatility from running totals built once per run, rather than summing the window again for every trade and every basket quote. The costs agree with the windowed sums to within about 5e-13 of their size, and NAVs to the last digit or so, so results with market impact on differ from 0.9.5's in the last few digits. Karan's London UCITS ETF backtest over 6,000 names went from 90.6 s to 59.6 s.
  • The backtest marks its book each day from one array of closes, and asks the calendar whether a day was a session once per day rather than once per missing price. Results are unchanged.
  • The index's daily valuation reads a day's closes for the whole book as one array, an asset's hash is worked out once rather than on every lookup, and a book whose unit counts change (a split anywhere in the universe) keeps its lists. The index result is unchanged. On a 6,000-name universe (3,908 constituents, 2020 to 2026) the calculation went from 20.0 s to 12.3 s.
  • A backtest's result and record are converted for the wire column by column, and stored documents are written without indentation, so the standard library's fast encoder writes them; the documents hold the same JSON. On a 6,000-name backtest (3,908 holdings) the steps after the simulation went from 41 s to 25 s.
  • The index calculation values its book once a day from lists built once per holdings set, records its daily weights as columns, values the book once for a deletion, reads only the market columns it uses from each day's rows, and remembers each date's session and FX rates. Results are unchanged. On 6,000 names over 2020 to 2026, an index of 3,908 constituents calculates in 20 s, from 48 s, and one of 1,155 on the London calendar in 11 s, from 25 s.
  • A day's batched price read answers for a name with no row that day straight from the day's panel, instead of going back to the market data for it one name at a time. On a session the data has no rows for (an index on the London calendar over New York data), every holding used to take that slow read. A UCITS ETF backtest on the London calendar over 6,000 names went from 315 s to 245 s, its index calculation from 68 s to 35 s; results are unchanged.
  • Market impact and average traded value are computed from each name's history held as arrays, with the same windows and the same answers to the last bit, instead of slicing a pandas Series on every call. On 6,000 names, a UCITS ETF backtest with market impact (1,155 holdings) went from 556 s to 315 s.
  • A futures roll prices the index's dividend yield from each constituent's cached last close, instead of reading its price history up to the day.
  • A backtest records its books once after each run of same-day trades (a rebalance, a day's dividends, invested flows, worked orders) instead of rewriting every holding after each trade, and keeps each day's positions as arrays. Only a day's last snapshot was ever kept, so the history and every result are unchanged. On 6,000 names (3,908 holdings) over 2020 to 2026 a plain backtest went from 756 s to 146 s, its simulation from 636 s to 28 s. Portfolio.batch() is the context that does it.
  • A reinvested dividend now buys more of the name that paid it, by default, instead of every holding in proportion to value. A backtest that reinvests its dividends therefore has different results from before: its holdings drift from the index's weights between rebalances by what each name paid, and it makes one trade per payer per payment day rather than one per holding. reinvest_into (payer or holdings) on Backtest and in a backtest request's settings chooses; holdings gives the old behaviour. /backtest/options describes it.
  • A backtest job reports its progress through the simulation, by date: the index's calculation, the strategy's weights, then each trading day reached ("Simulating 2024-03-28, day 812 of 1,700") about a hundred times a run. It used to report nothing between 0.05 and 0.8, so a long run and a hung one looked the same. Backtest.run takes a progress callback, and BacktestEngine.run one for the days.
  • Reinvesting a dividend prices the holdings in one read, with the same answers, instead of one read per holding on every payment day. On 600 names a plain backtest reinvesting its dividends went from 8.9 s to 6.8 s; results are unchanged.
  • A holding with no bar on a session is valued at its last close found in its history read once per run, instead of a fresh read of the market data for each name on each such day. On 600 names, a backtest on the London calendar over New York data went from 23 s to 17 s.
  • A name's corporate actions are read from rows split by name once per table, instead of filtering the whole table on every lookup. A futures roll prices the index's dividend yield from every constituent's trailing dividends, so on 600 names a backtest equitising its cash went from 26 s to 15 s and one replicating with futures from 19 s to 10 s.
  • Market impact, the liquidity screen and cap, and execution limits read each name's volume and converted closes once per run, and answer each day from that history over the same window as before, instead of reading and converting the window again every day. The answers are unchanged. On 600 names over the full history, with the lookup fix below: market impact 506 s to 18 s, capacity caps and screens 176 s to about 21 s, execution limits 31 s to 18 s, against 12 s for the same backtest with none of them.
  • Reading several names' market data checks them against a set built once, not against every row label of the store on each call. That check was most of the time in market impact, the liquidity screen and cap, and execution limits: on 600 names over the full history, a backtest with market impact went from 506 s to 50 s and one with capacity caps from 176 s to 33 s.

0.9.5 - 2026-10-21

The engine stays responsive: it answers while a backtest or any other job runs, and announces its port before loading its data. Synthetic prices never go negative, and a missing or bad price is carried at its last close on any day, rebalances included, instead of failing a run.

Changed

  • The engine prints BEACON_PORT before loading its registered data store, and loads it in the background, with GET /health reporting data_source.loading: true until it is served and a data.loaded event when it is. On the default synthetic store the port used to wait 31 s for the load, and a client could not tell loading from hung. Data named with --data or $BEACON_DATA_PATH still loads first, so an unreadable path still exits with code 2.

Fixed

  • A name with no price on a rebalance day, whether its bar is absent or was at or below zero, is carried at its last close and the day recorded as a price gap, as on any other day. It used to fail the whole index calculation ("IndexUnits ... could not be priced"). A name with no trade within max_price_staleness_days is still dropped by the stale-price step at that rebalance, and one that has never printed a bar is still refused.
  • Synthetic prices never go negative. Fat-tailed daily returns were used as simple returns, so a draw below -100% turned a name's price negative for the rest of the panel: one draw in 1.5 million, so several names in a store at the API's default size, and a backtest that traded one failed with "price cannot be negative". Returns are now drawn as log returns, less half each name's variance so the expected return is unchanged (8.1% a year across 600 names, as before). Every synthetic store generated from now on has different numbers from one generated before.
  • A price at or below zero, from a store generated before this release or a frame built in Python, is read as a missing bar: the last good close is carried and the day recorded as a price gap, with one warning per load naming the identifiers. Imported and Postgres stores already refused such prices.
  • A backtest, optimisation, risk model or report no longer holds the server for its whole run. Each job's work runs in a worker thread, as do the settings and index calculations its submit route does first, so /health and every other request are answered while a job runs, and a submit answers 202 at once. A cancelled job stops at its next progress report rather than going on to save its results.

0.9.4 - 2026-10-21

A store saves in well under half the time with its progress shown, and the API refuses requests it used to misread: a parameter given twice, a boolean for a number, a price column it does not hold.

Fixed

  • GET /data/prices/{identifier} reads columns as the other list parameters do, so ?columns=CLOSE,VOLUME names two columns, and an unknown column is refused with 422 INVALID_ARGUMENT rather than failing with a 500.
  • POST /derivatives/trs/price and /derivatives/futures/price refuse inputs whose result overflows to infinity with 422 INVALID_ARGUMENT, where they answered 200 with null in place of a number.

Changed

  • Saving a data store takes well under half as long: on 1.16M market rows, 11 s rather than about 24 s, for a file 2% larger. A synthetic store at the API's default size should save in about 110 s rather than four minutes (estimated from the measured tenth). Each file is written a chunk of rows at a time and compressed as it goes, at gzip level 6 rather than 9. store.save takes a progress callback, and generating synthetic data reports the save's progress by dataset and chunk ("Saving market data") instead of sitting at one stage, with each stage's share of the progress bar matching the time it takes.
  • A query parameter that takes one value is refused with 422 INVALID_ARGUMENT when it is given more than once. The last value used to win, so ?limit=10&limit=500 answered with 500 rows.
  • A decimal number in a request body must be a JSON number: true, false and numbers sent as strings are refused with 422 where they were read as numbers, in a strategy, a backtest request, an index, a risk model or optimisation request, feature rows and synthetic data. A risk model's index_id and strategy_id must be ids like any other.

0.9.3 - 2026-10-20

A strategy's holdings at any date, from the universe to the book, with each step explained, and a backtest editor that can offer pickers and rows for every structured setting.

Added

  • GET /strategies/{id}/holdings?date= shows a strategy's whole holdings workflow at a date, one row per name: the universe narrowed by the index's rules, the index's cap, the benchmark's weight, the strategy's choice, the weight after each implementation screen, the cash buffer and the caps, the weight traded to, and as of the date the held weight, its drift and the units held, with every rebalance date of the run and each stage's label and count. A backtest now keeps how each rebalance's universe narrowed (IndexResult.selections) and each name's weight after the screens (RebalanceStep.screened).
  • universe_weight on holdings rows and constituent preview assets: each universe name's share of the universe's total market cap, free-float where the index weights by free-float market cap, full otherwise.
  • Each holdings stage and constituent preview step says what it is and does: its type, a plain-sentence description of what it does with its settings, and its settings as labelled params formatted with their units. The market cap and liquidity rules' thresholds now carry their units (money, shares) in /indices/rule-types.

  • Every structured setting in GET /backtest/options names the shape it takes in ref, a schema published under components.schemas: names, a number per name, amounts by date, a field, an expression, optimiser constraint rows, signals by factor and targets by factor, and a vehicle's pricing, limits and withholding rates. A list of reference values names its column, and a setting whose entries are configurable types names the family they come from in options. replication_constraints lists the constraints an optimised replication takes, and GET /data/reference-values?column= lists the values a reference column holds. The optimiser's constraints in /optimise/constraint-types name their shapes too.

Fixed

  • A constituent preview's stale-price step no longer takes another rule's id.

Changed

  • /data/fields labels keep acronyms in capitals: "GICS industry", "ISIN", "IPO date", rather than "Gics industry".

0.9.2 - 2026-10-19

Every figure a run shows comes from the engine: a run compared with its index and its benchmark, its figures by year, quarter and month, and each holding's reference columns as they stood on the row's date.

Added

  • A run's comparisons compare it with its index and its benchmark: each comparator's level and own figures over the days both have (total and annualised return, volatility, Sharpe ratio, maximum drawdown and monthly hit rate) and the run's figures against it (relative and annualised relative return, tracking error, information ratio, correlation, beta and the share of months it beat it), for every kind of strategy. The run's metrics add hit_rate_monthly. beacon.analysis.comparison computes them in Python.
  • GET /strategies/{id}/periods?frequency=annual|quarterly|monthly gives a run's figures in each calendar year, quarter or month, and against its index and its benchmark, each period from the previous period's close so they compound to the whole run.
  • Reference columns on every row that names a holding, as they stood on the row's date: the weights view, each rebalance of a run with its unfilled orders and price gaps, attribution, an optimisation run's rows and frontier, and a constituent preview. reference_fields chooses the columns; without it a row carries the name, asset class, sector and country. A missing ASSET_CLASS answers Equity, as the engine reads it. GET /optimise/runs/{id} serves a run's rows, and GET /data/fields gives each field a label. beacon.data.reference_as_of.ReferenceAsOf answers many names on many dates from one read.

0.9.1 - 2026-10-18

For a backtest form and its runs: a strategy's latest run result by strategy, every setting a backtest request takes described in the options, and a run's settings complete enough to start a new backtest from.

Added

  • GET /strategies/{id}/result gives a strategy's latest run payload, every series and record in it, without the job's id, and answers 404 until the strategy has a run.
  • GET /backtest/options describes the run's own settings in run_settings: start and end (a new date field type), initial_capital, transaction_cost_bps, currency, dividends and benchmark, with their defaults, units and choices. A request always took them, but the options never said so, so a form built from them could not set the dates, capital or cost.
  • A run's resolved settings carry its start and end (the dates it ran over, defaults filled in), initial_capital, transaction_cost_bps and benchmark, so a new backtest can start from a run's settings.

0.9.0 - 2026-10-16

Strategies you save and backtest: a stored strategy holds what a backtest holds and how it trades, and every backtest runs one, keeping its runs apart from any other strategy's on the same index. An index can be calculated on its own, with no backtest. Share classes, synthetic replication and futures reach the API, and a hedged share class is measured against the index hedged the same way. Breaking for API clients: backtests and their results moved from /beacon/{index_id}/... to /strategies/{id}/..., and runs saved before this release are no longer served.

Added

  • GET /indices/{id}/level calculates a stored index on its own, with no backtest: its level, its total and annualised return, volatility, Sharpe ratio and maximum drawdown, and its weights at each rebalance, over start and end or the whole of the loaded data. Backtest.calculate(definition, start, end) does the same in Python, through the cache a run uses.
  • Stored strategies: /strategies keeps what a backtest holds and how it trades, beside the index definitions, so a strategy can be saved, listed, read, checked and deleted, and travels with the indices. A strategy is {id, name, description, index_id, strategy, implementation}, the last two in the shapes a backtest request gives them. A save is checked as a backtest checks its settings, with a finding for each problem at its path, and POST /strategies/validate checks one without saving it. A strategy whose index has gone lists with a problem, and deleting an index a strategy holds is refused with 409 IN_USE, naming the strategies in detail.used_by.
  • An optimisation run can aim at a stored strategy rather than an index: POST /optimise/runs takes strategy_id to solve for the weights the strategy's latest run chose at a rebalance, so an active strategy's answers how close a portfolio can get to it under the constraints. A risk model can take its names from a strategy_id too.
  • Share classes on the API: a backtest request takes share_classes, each with its currency, hedge, fee and distribution policy, and initial_capital and flows by class name. GET /backtest/options describes the class fields, and a problem is a finding at its path, such as share_classes.1.hedge_band. The result carries each class's record in its own currency on level's dates: net assets, units, NAV per unit, fees, distributions, flows and, for a hedged class, its hedge's value and trades, with the fund's hedge_value. Each class's total return, tracking difference and tracking error are measured against the index in its currency.
  • A share class's benchmark: index_in_class_currency in beacon.backtest.class_benchmark gives the index converted into a class's currency, or hedged into it the way the class hedges, at the first session of each month and at covered interest parity, so a hedged class's tracking difference leaves out the interest rate differential. class_tracking measures a class against it.
  • A synthetic fund's swap and a fund's index futures in the API's backtest result: swap_value, counterparty_exposure and swap_resets, and futures_notional, futures_exposure and futures_rolls, on level's dates, and null or empty for a fund without them. Each futures roll now records the contracts held and their price, in FuturesRoll and on the API.

Changed

  • Breaking: every backtest runs a stored strategy. POST /strategies/{id}/backtest and POST /strategies/{id}/backtest/validate take what the strategy does not hold (the period, capital, costs, currency, dividends, benchmark, modelling assumptions, flows and vehicle), and refuse a body carrying strategy or implementation. POST /beacon/{index_id}/backtest and its validate route are gone.
  • Breaking: runs are kept per strategy, so two strategies on one index each keep their own. The views of a run moved from /beacon/{index_id}/... to /strategies/{id}/overview, /record, /weights, /attribution and /assets/{identifier}, each naming its strategy_id and the index_id it holds; /beacon/compare is /strategies/compare, comparing strategies (strategy_ids), and /beacon/backtests is /strategies/runs, whose rows give strategy_id, strategy_name and index_id. A run's settings and its job kind, backtest:{strategy_id}, name the strategy. Runs saved before this release, filed under an index, are no longer served: backtest each strategy again.
  • Breaking: an optimisation run takes exactly one of index_id and strategy_id. An index's weights are now calculated, so optimising against an index no longer needs a backtest of it. Each row's index_weight is target_weight, and the result adds strategy_id and target_date. A risk model's index_id takes the names from the index's calculation rather than a run.
  • Breaking: a built-in report template is generated from a strategy_id's latest run, not an index_id's, and named after the strategy; the render result gives strategy_id.
  • Deleting a strategy removes its runs, and its response says how many went. Deleting an index no longer touches runs, since none belong to it, so DELETE /indices/{id} no longer reports backtest_record_deleted or backtest_results_deleted.
  • compare and runs are reserved and cannot be used as a document's id.

0.8.1 - 2026-10-14

Documentation only: the library is unchanged from 0.8.0.

Changed

  • Each chart in the gallery has a switch between its image and its live interactive version, and a list of the six themes. A chart starts as its image in the theme matching the page's light or dark setting. The live versions are now drawn in every theme, not only the two Beacon themes, and the row of the other four themes under each chart is gone.

0.8.0 - 2026-10-13

Charts for any data: chart classes (Line, Area, Column, Bar, Combo, Scatter, Histogram, Heatmap, Grid and Table), every part of their design a setting in a Style, and an interactive version of every chart that looks the same as its image. A plain install now draws charts, writes PDF and Excel reports, solves optimisations and reads Postgres stores; only the server and Yahoo Finance downloads are extras. The result charts return a chart rather than a matplotlib Axes, and ax= is gone.

Added

  • Chart styles: every part of the chart design is a setting, with Beacon's design as the default. beacon.plot.Style holds them (size and zoom, the heading and its scale, the beta mark and accent bar, fonts, text sizes, line weights, axis lines and ticks, gridlines, the legend's position, the notes and every colour), and saves to and loads from a TOML file. configure() sets a style for every chart drawn afterwards, settings() for a with block, and every chart method takes style= for that chart alone. Style.plain() drops the beta mark and draws on white. use(theme) is now a shortcut for configure(theme=...).
  • Chart classes in beacon.plot, each taking a DataFrame or Series and drawing it in the Beacon frame, with title=, subtitle=, notes=, source= and style=. A chart is drawn only when it is used: .show(), .save(path) (PNG, SVG or PDF at its designed size), its .figure or .ax, or as a notebook cell's last value. Building one needs no matplotlib.
  • Line: one or more series, the first in the accent colour and heavier. reference= for a line such as 100, label_last= to dot and label the last value, secondary= with ylabel_secondary= for series on a second axis on the right, and periods= for marked periods (boxes from the bottom of the plot to the top over date ranges, behind the series, labelled at the top unless period_labels=False; period_legend= names them once in the legend).
  • Area: stacked parts of a whole, or one filled series such as a drawdown. Its horizontal axis runs from the first value to the last, so the fill meets the axes.
  • Column (vertical) and Bar (horizontal): values by category, grouped where there are several series. A single series takes the signed colours (signed=False gives every bar one colour, grey by default, or color=; up_color= and down_color= change the signs' colours for one chart). gap= sets the space between categories and inner_gap= between the bars in one; both can be 0. value_labels= writes each value at its bar's end, and cap= marks a limit.
  • Combo: columns on the left axis and a line on the right. On daily data with gap=0, each column runs to the next trading day, so the columns meet edge to edge.
  • Scatter: one measure against another, by column name or as series. labels= names the points, fit="linear" draws a fitted line and writes its slope and R² on the chart, curve= draws a curve through the same axes such as a frontier, and axes="origin" draws the axes through zero with optional quadrants= names; signed=True colours each point by whether its two values share a sign.
  • Histogram: counts in equal bins, with an optional normal= curve and mark= lines for values such as a VaR.
  • Heatmap: a table of values as colour, cropped to what it draws at the same scale, so a square table does not leave the frame's width empty. colormap= takes a map's name (beacon_corr, blue-red, blues, greens, purples, greys, viridis, with _r to reverse) or a list of hex colours; by default values either side of zero diverge about it in blue-red, and others take blues. vmin= and vmax= set the map's ends, values= writes each value in its cell (in dark or light text to read on the cell), decimals=, lower=True draws the lower triangle, shading="blended" blends each colour into the next, gap= sets the space between cells (with gap=0 they overlap a little, so no seam shows), and colorbar= draws the scale beside, labelled at its two ends.
  • Grid: several charts in rows and columns under one heading and one notes line, each panel titled with its chart's title (None leaves a cell empty). A chart named in a rectangle of cells spans them, so a tall chart can run beside two short ones. heights= and widths= set the rows' and columns' shares, such as heights=(3, 1) for a tall panel over a short one. Each column is given the room its labels take and each row room for its titles and tick labels, and the heading and legend line up with the outer panels. sharex=True runs every panel on dates over the same dates, and a panel with another on dates directly beneath it leaves its dates to that one. One legend is shown, in the heading band, when every panel's legend names the same series, and none otherwise. BacktestResult.plot.performance() is now such a grid: its level over its drawdown, three to one.
  • On a narrow axis, dates are labelled less often so they do not run together. A column chart's categories that do not fit side by side are labelled every few (every other, every third: a year's quarters), staying level, and a heatmap's names, where every one matters, are slanted or stood upright.
  • percent=True writes shares with as few decimals as tell the ticks apart: 5%, 10%, 15%.
  • Limits: xlim=, ylim= and ylim_secondary=. While axes end on their ticks a limit moves out to the nearest tick, never in. Limits given the wrong way round are swapped, and a single limit beyond the data keeps the data's span on the other side.
  • Table in beacon.plot: a DataFrame under the Beacon frame (the mark, the heading and the notes line), drawn as an image with .show() and .save(), or written as HTML with .to_html(), which is also what a notebook shows. Its look is the style's table group, so a saved Style carries it.
  • preset= sets the rules and boxes: "lines" (the default: rules under the header, between rows, under the table and under the column group headings), "plain" (none at all) or "boxed" (a box around the values, and the group headings' rules). Each rule and box can still be changed: table_header_rule, table_row_rules, table_bottom_rule, table_group_rules, table_column_rules, table_box, table_group_boxes (a box around each column group, with a narrow gap so neighbouring boxes do not merge, enclosing the values or the headings too) and table_row_boxes (a box around each row group). Each kind of line has its own weight and colour, and the rules follow the column headings' colour unless given their own. table_stripes shades every other row. The row names' column is as wide as they need, table_name_space before the longest, and the value columns share the rest.
  • formats= per column or per column group: a format string, a mapping of decimals, prefix, suffix, thousands and percent, or a function. Negatives take a true minus sign, or brackets with negatives="brackets"; a value that rounds to zero has no sign. A missing value is a dash.
  • groups= puts columns under headings, each centred over its columns on a rule that starts a little in from the group's left, so neighbouring groups' rules stay apart. row_groups= keeps rows together, and row_group_headings=True names each group in a column at the left, centred beside its rows, with a group rule between the headings that stops short of the rule between the rows; the row names then take the column headings' colour, so the group headings stand out. signed= colours columns or groups by sign, and highlight= sets rows in bold.
  • heatmap= colours a column or a column group by value: colormap=, reverse=, scale= ("column" or "group"), center= (such as 0), fade= (near-neutral cells take the table's background, so no pale cell stands out on a dark page), values=False to hide the numbers, and shading="blended" with blend= "columns", "rows" or "both". Text on a heatmap cell is dark or light to read on it.
  • In HTML, a column's values sort when its heading is clicked, each row group staying together. Without scripts the table still reads, its heatmap cells each their own colour. The HTML is laid out as the image is: its columns take the image's widths, its rules take no room, and it carries the fonts it is set in (the bundled ones, or a font given as a file), so it looks the same offline and wherever it is opened. That makes each table's HTML about 1.4MB.
  • Interactive charts: every chart's .interactive() returns a plotly figure drawn from the same layout as its image, so the two look the same: the figure is the image's size, each axis takes the image's domain, range, ticks and labels, and the mark, heading, legend and notes are where the image puts them. Moving the pointer over a chart shows a popup in the style of Beacon desktop's popovers (a blurred glass fill, a hairline edge and a soft shadow, in the chart's theme) and the app's crosshair: a dashed line down through the date under the pointer with a dot on each line, or both ways through a scatter's point. The popup gives the date and every series' value on a time series, the category and each series on columns and bars, the point's name and both values on a scatter, the cell and its value on a heatmap, and the bin's range and count on a histogram, with the units the axis writes. The figure's .write_html() and .to_html() carry the chart's fonts, plotly.js and the popup's script, so the file looks and works the same offline; include_plotlyjs="directory" writes plotly.js once beside several files, fonts= links a stylesheet of the fonts rather than embedding them (beacon.plot.webfonts.font_faces and font_files write one), and fit=True makes the figure fill the frame it is shown in, such as an iframe the page sizes. Where the script cannot run, such as in some notebooks, plotly's own labels show instead. Zooming and the toolbar are off: the figure is the chart as designed.
  • The documentation covers the chart API: the Charts page has a section for each chart class with its options and a picture, tables and their presets, grids, interactive charts, and every setting with its default, the series palette and the colour maps. A chart styles page changes every setting on sample charts and shows the code for it, and the gallery shows every chart in every theme beside a live interactive version.
  • beacon.report.blocks.Chart.of(chart, path) saves a chart, grid or table as an image and returns a report block holding it, so a report can hold a table under the same frame as its charts.
  • GET /data/stores says why a store cannot be read when it can tell without loading it: a store saved before 0.7.0, with exchange rates in a RATE column, is readable: false with problem {code: "STORE_FORMAT_OUTDATED", message}. It was listed as readable and failed only when loaded, with the generic CONFIGURATION_ERROR. Activating it is refused at once with a 409 and the same code.

Changed

  • A plain pip install py-beacon-kit now does everything but serve the API and download market data: charts and interactive charts, PDF and Excel reports, the optimiser and Postgres stores work without naming an extra, so the core install brings matplotlib, plotly, fonttools, reportlab, openpyxl, scipy, psycopg and platformdirs. Two extras remain: server for the local API server, which no longer pulls in the others, and data for Yahoo Finance downloads. The plot, plot-interactive, pdf, excel, optimise and postgres extras are still declared and add nothing, so an install command written for an earlier release still works. import beacon still loads none of the new packages; each is imported when the feature that needs it is first used.
  • Breaking: the result charts (IndexResult.plot, BacktestResult.plot, AttributionResult.plot, OptimisationResult.plot, RiskModel.plot) and compare() return a chart rather than a matplotlib Axes, built on the chart classes, so they take the same options: .save(), .show(), style=. chart.ax and chart.figure are the matplotlib axes and figure for code that drew on the returned axes. A chart is drawn only when it is used, so calling a chart method no longer draws on pyplot's current figure: plt.savefig() or plt.show() after it finds nothing, and chart.save() or chart.show() takes its place. Touching result.plot no longer imports matplotlib.
  • Breaking: ax= is gone from every chart method and from compare(). A chart always has a figure of its own and is always framed; drawing into a caller's axes gave a chart with a plain title and none of the frame.
  • The result charts as rebuilt: the weights chart's cap label is drawn (it sat just above the top bar and was clipped away), bars and contributions run from the largest at the top, percent axes read 5% rather than 5.0%, the constituents chart has no legend (each line is named at its end), the correlation heatmap writes each pair's value in its cell and labels its colour bar at its two ends with values in place of "less correlated" and "more correlated", and is cropped to the cells. The frontier's minimum-variance and tangency points take the palette's magenta and deep blue.
  • Series take a new palette in order: blue, deep blue, magenta, pink, lime, green, olive, red and oxblood, then black (white on a dark canvas) and five greys. Orange is no longer a default: in compare() a second line is deep blue rather than purple, and a third magenta rather than orange. Marked periods get their own colour per theme.
  • A chart's heading is the same height with or without a subtitle, so the accent bar is one size on every chart. A title with no subtitle is centred on the bar and the mark; with a subtitle the heading is unchanged.
  • A chart's frame is laid out before it is drawn, without a renderer, so an interactive version can draw the same layout: where the plot sits, where each axis ends and what its ticks say, and where the heading, legend and notes go. The ticks are the same as before. Text is now measured from the bundled fonts rather than from the drawn image, so a plot's edges move by up to 0.014in. Notes now wrap at their measured width, so a line can hold more: the annual returns chart's notes fit on one line instead of two. A chart's measuring axes keep the ticks they were drawn with: setting new limits on the returned axes no longer picks new ticks.

0.7.0 - 2026-10-12

Funds: synthetic and futures-based replication, futures to equitise a cash buffer, withholding tax by fund domicile, share classes that share one pool of assets, including classes in another currency, hedged or not, and more ways to build an active portfolio. Reference data now says what each series is, and exchange rates are read from CLOSE: market data with a RATE column is refused, so a store saved before this release has to be regenerated.

Added

  • Synthetic replication: IndexTracking(index, SyntheticReplication(basket, spread_bps=..., exposure_limit=0.10)) holds a substitute basket and a total return swap that pays the fund the index's return for the basket's, less a spread. The basket is required: an index definition, calculated over the run and held at its weights, or fixed weights. The swap is valued every day and included in the NAV, and is reset (settled in cash, its notional set back to net assets) when its value owed to the fund reaches the exposure limit (10% of net assets by default, the UCITS limit), at each of the index's rebalances, and on any day money flows in or out. result.swap_value, result.swap_resets and result.counterparty_exposure record it. A swap's settlement is a "SWAP" cash flow.
  • Futures-based replication: IndexTracking(index, FuturesReplication(roll_days=5, roll_cost_bps=..., dividend_yield=None)) holds cash, earning the run's cash rate, and long index futures sized to its net assets. Contracts are priced at fair value from the index level, the cash rate and the index's dividend yield, expire on the third Friday of each quarter and roll a set number of sessions before expiry at a cost in basis points. A price index's dividend yield is estimated at each roll from its constituents' trailing twelve months; a total return index's is zero. Profit and loss is settled in cash every day as a "FUTURES" cash flow.
  • Implementation(equitise=IndexFutures(...)) holds the same futures on a physical fund's uninvested cash, so its buffer earns the index's return. The server's backtest request takes implementation.equitise.
  • result.futures_notional, futures_rolls and futures_exposure record a fund's index futures.
  • Withholding tax by fund domicile: Vehicle(domicile=..., withholding_rates=...). Each preset carries its domicile (UK OEIC the United Kingdom, Luxembourg SICAV Luxembourg, Irish ICAV and UCITS ETF Ireland, the US presets the United States). A dividend is withheld at the vehicle's own rate for its source country, then a built-in table for the domicile (on US dividends: Ireland 15%, Luxembourg 30%, the United Kingdom 15%, the United States nothing; nothing on UK dividends; nothing on Irish dividends to an Irish fund), then the run's flat rate. The source country is the company's COUNTRY_DOMICILE or COUNTRY, otherwise its listing exchange's country.

  • A total return swap's value counts the dividends the underlying paid: dividends in TotalReturnSwap's market data, and in the server's TRS pricing request, joins the total return leg as notional * ((spot + dividends) / initial_price - 1). dividend_yield stays an input to the futures breakeven only, and its description now says why.

  • Share classes that share one pool of assets: Backtest(share_classes=[...], initial_capital={...}, flows={...}) runs every class in one book, so capacity caps, market impact and execution limits see the whole fund. Each day the book's gains, losses and income are split by the classes' net assets at the previous close; each class's own fee, flows (dealt at its own NAV per unit) and distributions reach it alone. result.share_classes holds each class's net assets, units, NAV per unit, fees, distributions and flows. ShareClass moved to beacon.backtest; beacon.fund still exports it.

  • Share classes in another currency: ShareClass(name, currency="EUR") has its capital, flows, fees and distributions in its own currency, and its NAV per unit moves with the book's return and the exchange rate. hedged=True hedges it back into its own currency with one-month forwards priced at covered interest parity from the two currencies' short rates, rolled on the first business day of each month and resized when the hedge leaves hedge_ratio by more than hedge_band (3% by default). The forward's gains and losses are the class's alone; a settlement is a "HEDGE" cash flow, and result.hedge_value and each class's hedges and hedge_value record it.

  • Reference data says what each series is: ASSET_CLASS (Equity, Currency or Fixed Income), SECURITY_TYPE (Spot for a currency pair, Short Rate for a short-term interest rate), a pair's BASE_CURRENCY and QUOTE_CURRENCY, a short rate's TENOR and DAY_COUNT, and TRADABLE. A row without them is an equity, so equity-only reference data needs no change. Currency pairs and short rates are not tradable unless TRADABLE says so, and are never offered as universe members. pair_reference and short_rate_reference in beacon.data build these rows.
  • Short rates: DataFetcher.short_rate_on(currency, date), fetch_short_rates and short_rate read a currency's rate, an annual decimal in CLOSE. Where a currency has several, the one month rate is read, else the overnight. A rate above 1 is refused as probably a percent.
  • DataFetcher.tradable_identifiers and is_tradable say what a fund can hold.

  • More ways to build an active portfolio: MinimumVariance, MaximumDiversification, RiskParity(budgets), MaximumSharpe(base_return, alpha_per_score), BlackLitterman(risk_aversion, tau, alpha_per_score, confidence), FactorTilts(factors, targets) (each factor a signal) and TopN(n, weighting), all long-only within the strategy's constraints. The first three and factor tilts need no signal, so ActiveStrategy's signal is now optional for them. Each rebalance in result.active records every holding's share of the risk (risk_contributions) and what the construction reports (exposures), and the server's backtest results carry both.

Changed

  • Breaking: an exchange rate is read from CLOSE, like every other series, and a currency pair is the series reference data describes as Currency/Spot, found by its two currencies whatever its identifier. Market data with a RATE column is refused, with a message saying to move the rates to CLOSE and add a reference row per pair (pair_reference("GBPUSD") builds one). A series named like a pair but with no such row is no longer a pair. The importer's fx sheet is gone for the same reason, and the reference sheet requires EXCHANGE of equities only. fetch_fx_rates no longer takes column. Synthetic and sample data are written the new way.
  • fund.backtest() runs every share class together, with initial_capital and flows given by class name (one number for a fund of one class), and returns the fund's result with each class in result.share_classes. It no longer takes share_class=, and Fund.vehicle_for() is gone: a class's fee now reaches it inside the pooled run.
  • A backtest with a preset vehicle now withholds dividends by its domicile instead of the flat withholding_tax_rate, so its dividends, NAV and tracking difference change. Pass domicile=None to keep the flat rate.

0.6.0 - 2026-10-10

Charts: every chart framed as Beacon desktop frames it, with the beta mark, a heading and legend, and a notes line; six themes, including GitHub's dark page and transparent backgrounds; a constituents chart; axes that end on their ticks; and readable, consistently sized text. IndexFund and ETF, deprecated in 0.5.0, are removed.

Added

  • Charts that create their own figure are framed as Beacon desktop frames them: the beta mark, then a thin accent bar beside a title in Inter Tight and a subtitle in Source Serif 4 italic; the legend, when there is one, at the right of the heading; and one italic notes line saying where the data came from and the dates it covers. Every chart method and compare takes title=, subtitle= and notes= to replace them, or an empty string to leave one out, and beacon.plot.frame_text(ax, part) reads them back. The fonts ship with py-beacon under the SIL Open Font License.
  • Themes: beacon.plot.use() takes beacon-light (or light), beacon-dark (or dark), github-dark, white, transparent-dark-axes and transparent-light-axes, each also a matplotlib style, and palette() takes a theme. A chart keeps the theme it was drawn in, so its own colours follow it on a transparent background.
  • constituents() on an index or a backtest result: the index drawn over its constituents' closes, all rebased to 100, each named at the end of its line. It draws the eight largest by weight unless given another limit, and the notes say how many it left out. The quickstart's first chart now uses it.
  • correlation(shading="blended") blends the heatmap's colours from cell to cell; "squares" is the default.

Changed

  • Charts are designed 6in wide and drawn at 80% of their size, with fixed text sizes: 8pt axis titles, 7.8pt tick labels, 5.5pt legends and labels on lines, and 4.5pt notes, all in the title's colour. The time series are 3:2. Date axes label the year at each January and the month between, and a chart's side margins widen to fit its labels.
  • Every axis that measures something ends on its outermost ticks, and where both axes measure, the lowest y label is left blank so it does not sit on the first x label.
  • The level charts (level, constituents, performance and compare) have no gridlines and draw one line at 100. The bar charts and the frontier have no gridlines either, with a line at zero where a bar can fall below it. Ticks point inwards, and the axes are thinner and in the title's colour.
  • The frontier's x axis is labelled, and its tangency point is a deep blue rather than orange. The correlation heatmap has no tick marks, and its colour bar is labelled at each end.
  • compare no longer prints a metrics table under the chart. Its notes say how many shared observations the comparison rests on.
  • A chart's notes, and the "At ..." date on a weights chart, moved from the axes to the figure's notes line. Read them with frame_text(ax, "notes") rather than ax.texts. A chart drawn into axes you pass with ax= keeps its notes and legend in the axes.

Deprecated

  • beacon.plot.use(), palette() and style_dict() name their parameter theme; mode= still works, with a DeprecationWarning, and a call by position is unchanged.

Removed

  • beacon.fund.IndexFund and beacon.fund.ETF, as their deprecation in 0.5.0 said. Use a Fund with a vehicle: an open-ended preset such as uk_oeic() for an IndexFund, or ucits_etf() or us_etf() for an ETF.

Fixed

  • A dark chart saved after switching back to the light style was saved on the light background. A saved chart now keeps its own background.
  • The last value marked at the end of a level chart's line was cut off at the right edge, and its dot was cut in half where the axis ends.
  • The drawdown axis rounded a 2.5% step to whole percents, labelling -2.5% as -2% and -7.5% as -8%.

0.5.0 - 2026-10-08

Funds and strategies: money flowing in and out with units and fund accounting; fund vehicles with structure presets, four pricing methods, UCITS and 1940 Act limits, and ETFs with a modelled market price; a Fund product record; index tracking through optimised or sampled replication; active strategies built from a signal; and all of it through the server's backtest API. IndexFund and ETF are deprecated.

Added

  • Flows in a backtest: Backtest(flows=...) takes money in and pays it out, as DatedFlows, PeriodicFlows (an amount or a share of the assets), RandomFlows (seeded) or PerformanceChasingFlows, or several added together. Flows create and cancel units at the day's NAV per unit, so nav_per_unit measures performance whatever money moved, and with flows every return metric is a unit's and the summary adds money_weighted_return. The result records each flow in flows, and aum and units_outstanding each day. Without flows every figure is unchanged.
  • Implementation(cash_buffer=...) keeps a share of the book in cash, which outflows draw on first, and invest_flows says whether an inflow buys the last rebalance's weights (the default) or the holdings pro rata.
  • Vehicle: what the fund itself charges and its unit price at launch. Vehicle(management_fee_bps=...) accrues the fee daily on net assets (ACT/365) as a liability the NAV is net of, paid from cash as it can be.
  • Pricing methods for a fund's dealing, so the investors who come or go can pay for the trading they cause: SinglePricing (the default), DualPricing, SwingPricing (full, or partial above a threshold) and DilutionLevy. A swing factor, spread or levy left unset is estimated from the run's own costs. Each flow records its dealing_price and the adjustment paid into the fund.
  • Diversification limits for a fund structure, applied with the capacity caps: UcitsLimits (5/10/40, or 20/35 for an index tracker) and Act1940Limits (the 1940 Act's diversified-fund test).
  • OwnershipCap(free_float=False) measures against every share outstanding rather than the free float.
  • Structure presets: uk_oeic, luxembourg_sicav, irish_icav and us_mutual_fund, each a Vehicle with its structure's usual pricing and limits, any setting of which can be changed. preset(name) and PRESETS list them.
  • Exchange-traded funds: EtfVehicle, and the ucits_etf (cash creations) and us_etf (in kind) presets. Flows are rounded to whole creation units, with the rest carried to the next day; in-kind creations move the holdings without cost, and cash ones pay a creation fee into the fund. After each close the shares are quoted on an exchange by EtfMarket: a premium that persists, follows creations and the NAV's return, and stays inside the arbitrage band, and a spread that follows the basket's trading cost and the NAV's volatility. result.market holds each day's quote and the summary adds the exchange investor's return and the average premium and spread.
  • Fund: a fund product, with a name, a currency, ShareClasses and documents, one strategy and one vehicle. fund.backtest(share_class=...) runs a Backtest of it with that class's fee and distribution policy (accumulating or distributing).
  • Strategies: IndexTracking(index, replication=...) holds an index in full, through an optimised subset (OptimisedReplication: the optimiser minimises tracking error within a holdings limit, using a covariance re-estimated at each rebalance from a year of returns, shrunk toward constant correlation), or through a stratified sample (SampledReplication: the largest names in each sector and size cell, each cell at its index weight). The run is measured against the index, and result.replication records each rebalance's weights, holdings and ex-ante tracking error. Pass it to Backtest.run or as a Fund's strategy.
  • Active strategies: ActiveStrategy(benchmark, signal, construction, constraints) builds its own portfolio at each rebalance and is measured against its benchmark. Signals: FieldSignal, Momentum and FunctionSignal, standardised into scores. Constructions: MaxAlpha (the most exposure to the scores within a tracking-error budget) and MeanVariance (expected active return against active variance), behind one Construction interface. Constraints relative to the benchmark: TrackingErrorBudget, ActiveShare, RelativeSectorBounds, RelativePositionBounds, HoldingsLimit and TurnoverLimit. result.active records each rebalance; the summary adds the information ratio, average active share and ex-ante tracking error; active_attribution() splits the active return by name.
  • BacktestResult.information_ratio() for any run that tracks an index.
  • The backtest API carries every part of a backtest: POST /beacon/{index_id}/backtest takes optional strategy (index tracking with a replication, or an active strategy), implementation, flows, vehicle (a preset with settings laid over it), modelling_assumptions, dividends and currency. A request without them runs as before. GET /backtest/options lists every type and field with units and bounds, the presets with their settings and the engine's default assumptions; POST /beacon/{index_id}/backtest/validate answers what would run, or findings at each field's path. The result adds the resolved settings, NAV per unit, units, flows, an ETF's quotes, replication and active records, the implementation's stages and unfilled orders, and saved-run rows add the strategy, vehicle, preset and currency.
  • Field descriptions in /backtest/options, /indices/rule-types and /optimise/constraint-types carry a unit (such as fraction, bps or money) and minimum and maximum bounds, so a form can format a value and refuse one out of range.

Deprecated

  • IndexFund and ETF, to be removed in 0.6.0. Use a Fund with a vehicle: an open-ended preset such as uk_oeic() for an IndexFund, or ucits_etf() or us_etf() for an ETF. Until then they keep their own fee convention (a fee per trading day, applied to the backtest's NAV afterwards).

Fixed

  • An optimisation with a holdings limit re-solves the kept names from the first answer, with the dropped names at zero, rather than from its original starting point. From there the solver could stop on weights that were not fully invested and refuse a problem it could solve. Optimised indices, optimised replication and active strategies with a holdings limit can solve to slightly different weights.

0.4.0 - 2026-10-02

A backtest can now model how a fund carries out its index at its size: screens, capacity caps, market impact and execution limits, dividends, and its modelling assumptions in one object. Results change: a backtest receives dividends, sizes its buys net of costs, and keeps its book in the index's currency. ExpressionScreen moved to beacon.backtest.

Added

  • Implementation: how a backtest carries out its index at its size, without changing the index. Its screens decide which names may be held at each rebalance (MarketCapScreen, LiquidityScreen, MinimumPriceScreen, ListingAgeScreen, ExclusionScreen, ExpressionScreen), with optional exit levels (buffers) so names near a threshold do not flip in and out. Removed weight is spread pro rata across the remaining names or held as cash. Pass it as Backtest(implementation=...).
  • Capacity caps in a backtest's Implementation: OwnershipCap (a share of free-float market cap), LiquidityCap (days of traded value at a participation rate) and WeightCap limit each position at the book's size, with the excess spread across the names still under their caps or held as cash. MinimumPosition drops positions too small to keep. Each rebalance's RebalanceStep records what was capped.
  • Market impact and execution limits in a backtest's Implementation. MarketImpact charges each trade for its size against the name's traded value, by the square-root law, so the same weights cost a large fund more. ExecutionLimit caps how much of an order trades in a day, by participation in the day's volume or spread over a number of days; the rest is worked on the following sessions. A blank volume is replaced by the last one reported within volume_backfill_days (a new modelling assumption, 5 days unless set), and otherwise by the average daily volume.
  • UnfilledOrder.reason: why an order went unfilled, "cash", "no price" or "execution limit". The server's unfilled orders carry it too.
  • BacktestResult.rebalance_steps: for each rebalance, the target, the names removed and the screen that removed each, and the weights traded to.
  • ModellingAssumptions: what a backtest takes as given about markets and data in one object. FX policy, stale-price threshold and free-float backfill (shared with the index calculation), and cash rate, risk-free rate and periods per year. Set a process-wide default with use_modelling_assumptions, and override it per backtest with Backtest(modelling_assumptions=...). Results and index results record what they assumed. The defaults change no result.
  • Dividends in the backtest. A holding is paid each cash distribution on the pay date, for the shares held at the start of the ex-date, converted into the book's currency and net of withholding_tax_rate (a new modelling assumption). Backtest(dividends=...) reinvests the cash in the current holdings the day it arrives (the default), keeps it as cash until the next rebalance, or distributes it, with returns adding distributions back. Each payment is recorded in portfolio.cash_flows.
  • Cash can earn interest (cash_rate), recorded in Portfolio.cash_flows.
  • IndexResult.currency and BacktestResult.currency: the currency an index's levels and a backtest's book are in. A backtest run from the engine reports its currency too.
  • IndexFund and ETF take the backtest settings as keyword arguments (currency, modelling_assumptions, dividends, implementation, modifiers, benchmark and cache) and pass them to the backtest they run. A fund ran with the defaults whatever was needed.
  • Backtest(cache=False) turns the index result cache off. cache=None already meant the default location, so there was no way to ask for none.
  • The index preview returns each constituent's market caps: market_cap and free_float_market_cap in the index currency, market_cap_local and free_float_market_cap_local in local_currency, with market_cap_currency, priced_from and price_is_stale. Every name has them, excluded ones included, at the preview's resolved_date, and they match GET /data/reference field for field. Null where a name has no price or the data has no free float.

Changed

  • GET /data/reference computes market_cap and free_float_market_cap about 12 times faster for a large batch: 0.3s for 1,000 names, from 1.8s. Each name's currency, latest row and FX rate were read separately; they are now read once for the batch. The answers are unchanged.
  • A rebalance sizes its buys so that they and their costs fit the cash, so it fills in full. Buys were sized before costs, so the last buy of almost every rebalance with costs came up short and was recorded in unfilled.
  • A target name with no price on a rebalance day is recorded in unfilled with the reason "no price". It was skipped without a record. In the server's unfilled orders, price and shortfall_value can now be null.
  • A backtest over data with cash distributions now receives them, so its NAV and every figure from it rise by about the dividend yield. It earned the price return only, and trailed a total-return index by about that much.
  • ExpressionScreen is a screen, passed in Implementation(screens=[...]), and no longer takes a fetcher. It was a trade modifier that cancelled buys of a failing name, left its weight in cash and only trimmed a failing holding. A failing name is now removed from the target, sold in full and its weight redistributed. It moved from beacon.backtest.rules to beacon.backtest, and a screen passed in modifiers is refused with a message saying where it goes.
  • A backtest keeps its book in the index's currency unless currency is passed. It defaulted to USD whatever the index's currency, so a euro or sterling index was valued in dollars and its NAV picked up exchange-rate moves the index does not have. This includes backtests run from the engine and by an IndexFund.

Fixed

  • An index over data with no SHARES_OUTSTANDING column is refused before the run starts, saying the calculation sizes every index from market cap. An equal-weighted index passed the check, since its scheme reads no columns, and then failed at the divisor as an index worth 0.0.
  • The index result cache keys on the data source's FX policy, stale-price threshold and free-float backfill. It keyed on the store alone, so changing one of those settings could reuse an index calculated under the old one.

0.3.1 - 2026-10-01

One fix: futures and roll pricing refuse bad input as a 422 rather than a 404.

Fixed

  • Futures and roll pricing answer 422 INVALID_ARGUMENT, not 404 DATA_NOT_FOUND, for a negative or missing time to expiry, an expiry before the valuation date, and a back expiry that is not after the front.

0.3.0 - 2026-09-30

Money in one currency across multi-currency indices, prices carried over gaps, expressions that refuse fields the data does not have, and engine state that survives. Two breaking changes: data.actions is gone from expressions, and some requests the engine cannot answer as put answer 422 instead of 404.

Added

  • DataFetcher.fetch_prices reads prices for several instruments at once, converted into one currency day by day under the dataset's FX policy.
  • IndexResult.price_gaps and beacon.index.PriceGap: the days a held name had no bar and was valued at its last close. PriceGap is still importable from beacon.backtest.
  • The asset view reports currency, which its returns, beta and tracking error are measured in (the index's), and price_currency, which its price series is in (the name's own).
  • A feature import's response says whether the rows were saved into the served store, and gives the new data_version.
  • BacktestResult.get_annual_returns(): calendar-year returns that compound to the whole run's return.
  • TotalReturnSwap takes underlying_type (INDEX, the default, ETF or EQUITY). It was always INDEX.
  • Each release from GET /changelog carries its summary, the prose between its heading and its first section.
  • A risk model request takes an optional currency, and a risk model and an optimisation run report the currency they were measured in.

Changed

  • Requests that cannot be answered as put answer 422 INVALID_ARGUMENT instead of 404 DATA_NOT_FOUND: an unknown price interval, an adjusted series without CLOSE, and an empty or oversized feature batch.
  • An expression with a field the data does not have is refused with ExpressionError by universe.where, ExpressionScreen and an index's ExpressionRule, naming the field and suggesting close matches. Before, it selected nothing.
  • IndexDefinition refuses an unknown calendar or rebalancing frequency when it is built, naming the valid values and suggesting close calendar codes. Before, the mistake surfaced only when rebalance dates were first computed.
  • The API schema states more of what it accepts: since on /changelog is a dotted version, and /beacon/compare needs at least two ids, each a valid identifier. These are now refused as VALIDATION_ERROR by the schema check. The boolean fields of a synthetic-data or import request no longer accept 0, 1 or strings.

Removed

  • data.actions in expressions. No expression could read its fields, so every name was missing a value; it now raises UnknownDatasetError, and the field catalogue and GET /data/fields no longer list an actions namespace. Read corporate actions from the fetcher's corporate_actions.

Fixed

  • Money is compared in one currency wherever names are compared or added up. LiquidityRule's traded-value floor, the engine's risk models, optimisation runs, the weights pane (drift, risk contributions, active risk), attribution and the asset view all read each name's prices in its own currency, so a multi-currency index mixed yen with dollars and left exchange-rate returns and risk out. They now convert into the index's currency.
  • An index values a held name with no bar on a session at its last close, as the backtest engine does, and lists the day in IndexResult.price_gaps. It used to value the name at zero, so the level dipped by the name's weight for the day and recovered when the bar returned.
  • An expression's market_cap inside an index is in the index's currency, as MarketCapRule's bounds are. Outside an index it stays in USD.
  • POST /data/features now saves the rows into the served store when it is a folder, so they survive a restart, and changes data_version and sends a data.freshness event for features. Before, a client caching on data_version missed the change and a restart lost the rows.
  • The engine always keeps the saved results its views read: the latest backtest of each index, every optimisation run and the latest estimate of each risk model. The limit of 50 saved jobs now applies only to the rest, so a run of loads, refreshes or renders no longer makes those views answer 404.
  • data.market.free_float and free_float_market_cap in an expression carry the free float forward as far as the data's free_float_backfill_days, as every other read does, rather than 10 days.
  • Attribution for a capped index no longer fails when its window starts after the index's first rebalance. The cap drag is measured over the same periods as the contributions.
  • A cancelled dividend is no longer reinvested by a total-return index, counted in the trailing dividend and yield, or applied to adjusted closes; a cancelled split is no longer applied to adjusted closes either.
  • The engine checks for a token before it loads any data, so a missing token is reported at once rather than after a large store has loaded.
  • http://127.0.0.1 and http://[::1] on any port are allowed origins, as http://localhost already was.
  • A wrong or missing token on the event socket closes it with code 1008 and a reason, as intended, instead of refusing the handshake with an HTTP 403 a browser cannot read.
  • BacktestPlots.annual_returns measures each year from the previous year's close, and the first from the initial capital. It measured each year from its own first close, so every year after the first lost its first day's return.
  • A chart drawn before beacon.plot.use() gets the light colours on matplotlib's white background, not the dark mode's.
  • OptimisationPlots.frontier starts the capital market line at the rate the frontier was traced at, unless another is passed, so the line is tangent.
  • The Excel reports accept a pathlib.Path as well as a string, and the holdings report writes valuation_date into its sheet instead of only logging it.
  • futures_roll_return uses 365-day years, like every other year fraction in the derivatives. It used 365.25, so its rates came out smaller than the rest by a factor of 365/365.25.
  • The sample dataset in beacon.testing.dataset stores its GBPUSD rate in RATE, so fx_pairs and the coverage view list it. A pair stored without RATE still converts but now logs a warning that it is not listed.
  • A report template with an unknown page setting answers 422 instead of 500, and so does a futures or swap price whose inputs overflow.
  • A plain OPTIONS request answers 405 with an Allow header listing every method its path supports. It listed only one route's methods on a path with several, such as /data/features. CORS preflights are unchanged.
  • The nightly API fuzz run passes again: it leaves out operations that start heavy work, and skips the check that a schema-valid request is accepted only where a rule spans fields or depends on the data.
  • Generating or extending synthetic data from an isolated engine (python -I, as the Beacon app runs it) keeps the child process isolated too, so it cannot load packages from the user's own site-packages.

0.2.0 - 2026-09-26

Choose where the engine's data comes from: named stores, synthetic data you can extend to today, CSV and Excel import, and read-only Postgres. Also documentation at pybeacon.dev, and fixes to index levels and backtests around splits and delistings.

Added

  • Documentation at https://pybeacon.dev: a guide to each part of py-beacon (data, universes, methodology, expressions, backtests, funds, derivatives, the optimiser, risk, attribution, charts, reports and the server), and a complete Python reference. Every example in it runs.
  • The engine can start without any data and load a store later. Loading runs as a job with progress, and the event socket announces data.loaded when the new data is being served.
  • Named data stores. Register a data folder under a name you choose, see every store at GET /data/stores, and switch which one the engine serves. The engine remembers the active store and serves it again on the next start.
  • Generate synthetic data from the engine: POST /data/synthetic creates a new store with the size, dates and seed you choose (end date defaulting to today), and serves it when it is ready. It runs as a job with progress, and gives exactly the same data as python -m beacon.synthetic with the same settings.
  • python -m beacon.synthetic --progress prints a line at each stage, for a program running it.
  • Extend a generated store to today without changing its history: python -m beacon.synthetic --extend PATH, or beacon.synthetic.extend. Prices, exchange rates, listings, dividends, splits and features carry on from where the store stops, and the rows already there are never changed. The same store extended to the same date always gives the same data. Stores generated from this version on keep the settings this needs beside the data.
  • Import your own data from CSV files or an Excel workbook: POST /data/import checks every row and saves a new store, or refuses with one finding per problem naming its sheet, row and column. GET /data/import/template downloads a blank template, and beacon.data.importing.load_files does the same from Python. Dates are read as YYYY-MM-DD only, so a date cannot be read as the wrong day.
  • The server extra now includes excel, for Excel import.
  • Refresh a store from its own source: POST /data/stores/{id}/refresh extends synthetic data to today, reads a folder or database again, and saves what changes. If the store is being served, the engine serves the refreshed data. Each store in GET /data/stores says what a refresh would do.
  • A folder store can choose to refresh from Yahoo Finance instead (refresh_from), which downloads new prices and saves them into the folder. It is never the default.
  • A data store can be a Postgres database. Give it tables or views named market, reference, and optionally fx, corporate_actions and features, with the import template's columns; views over your own tables work. The engine only reads, over a read-only connection, and checks every row as an import does. The password is never stored: name an environment variable that holds it. Needs the new postgres extra.

Changed

  • A backtest's return metrics start from its initial capital: get_returns() has one return per simulated day, the first from the capital to the first close. The tracking difference, tracking error, volatility and drawdown now include the cost of the opening trades, which they used to leave out, so a run with costs no longer shows a positive tracking difference for that reason.
  • In a backtest result from the engine, returns, drawdown and annual_returns start from the initial capital too, so they agree with the metrics. returns now has one value per day of level, the first from the capital to the first close. level is unchanged.
  • POST /data/coverage/{dataset}/sync is deprecated. It now refreshes the store being served from that store's own source, and no longer downloads from Yahoo Finance unless the store chose it. Its body is ignored, and its job is a refresh:{store_id} job. Use POST /data/stores/{id}/refresh.
  • A request that needs data when none is loaded now answers 409 NO_DATA_LOADED, saying what could not be done. It answered 500 CONFIGURATION_ERROR before.
  • /health says which store is being served and whether one is loading.
  • /health and the data events carry data_version, a token that changes whenever the data being served changes. A client compares it to tell whether what it cached is still current.

Fixed

  • IndexFund.calculate_nav keeps the fund's trading cost when it extends a run to a later date. It used to re-run at zero cost.
  • A split, reverse split or stock dividend no longer moves an index level or a backtest's NAV. On the ex-date the units or shares held change by the ratio, as the price does. Before, a split between rebalances cut the level and NAV by the split, including in synthetic data, which splits every year.
  • A constituent delisted the session before a rebalance no longer takes its weight out of the index level. It leaves first, as on any other day.
  • SelectionResult.excluded_by names the right step when prices go stale. With stale names dropped, it credited each exclusion to the step before it, and a stale name to the last rule.
  • A damaged data file no longer stops the engine with a crash. It is refused with a message naming the file, and a damaged store found at startup is skipped with a warning.

0.1.1 - 2026-09-25

Added

  • DataFetcher.fx_route says how a currency pair is converted: from a stored rate, its inverse, or a cross through USD.

Fixed

  • A currency with no stored rate of its own is now converted using the inverse of the reverse pair, or a cross through USD. Before, an index in pounds holding US shares refused because only GBP to USD was stored.
  • The quickstart in the README and on the docs home page runs again.

0.1.0 - 2026-09-24

The first release.

Added

  • Build an index from rules and a weighting scheme: equal weight, market cap or free-float market cap, with optional weight caps.
  • Calculate the index level on a real exchange calendar, as price, total return or net total return.
  • Adjust the index for dividends, special dividends and delistings.
  • Write selection rules as expressions, such as data.market.market_cap > 1e9, including rules on company fundamentals and other features.
  • Backtest a portfolio that trades to the index weights, with transaction costs, drift thresholds and a benchmark.
  • Read results with tracking error, attribution, risk, concentration and drift, and draw them as charts.
  • Hold names in several currencies. Prices are converted with FX rates.
  • Load data from files, generate a realistic synthetic dataset, or download prices with yfinance. Data is kept in a local store that reports its coverage and age.
  • Three settings, shown on /health: whether a missing FX rate carries forward, when a stale price drops a name, and how long a free float carries forward (90 days by default).
  • A local API server for the Beacon desktop app, covering data, indices, universes, backtests, the optimiser, risk, derivatives and PDF reports. Long tasks run as jobs with live progress.
  • This changelog, served at GET /changelog so the app can show what changed.
  • Optional extras keep the core install small: data, excel, pdf, optimise, plot and server.

Notes

  • An index or backtest never uses a price, rate or free float dated after the day it is working on.
  • Requires Python 3.11 or later.