Repository navigation
Finalytics 1.0.0-rc.6
Pre-releaseAdded
-
keep_cashinoptimise, as inrebalance:keep_cash=True(.keep_all_cash()in Rust)
holds every currency's cash incurrent_weightsat its current weight, and
keep_cash=["USD"](.keep_cash(["USD"])) that of the currencies named, and optimises the
rest, with every limit measured on the whole portfolio. The weights hold the kept cash, so
portfolio.rebalance(result, keep_cash=True)trades what the limits allow, and its turnover is
the optimisation's. It needscurrent_weights, takes nocashlimits on the cash it keeps,
and applies to the frontier and to each refit of a walk-forward backtest (keep_cashin
compareandbacktest).methods()lists it with the limits of every method that takes
limits, as a new kind of option,currencies;finalytics::KeepCashis its type in Rust. -
include_benchmarkinscreen(.include_benchmark()in Rust) screens the universe's
benchmark as a candidate too; see Changed. -
A Python test runs every example in the package's docstrings, and JavaScript and Python tests
hold the contract sweep's cases: every problem reported together, at the option given.
Fixed
-
Every problem with a call's inputs is reported together. A value that could not be read hid
every other problem: an unknown method hid a limit out of range, a number that is not finite
hid an unknown asset, fixed weights given limits hid an unknown asset, and a rebalancing's
targets, a report's account and an asset setting hid the checks after them. Options are read
field by field and checked on the fields that read; with an unknown method, only the checks
that do not depend on it run, so no option is said to be unused by a method not chosen. -
Five of the Python package's docstring examples used names they did not define; they run as
written now. The cash andoptimisedocstrings said optimisation never holds cash, which
cashlimits andkeep_cashchange, and JavaScript'sResultleft outevaluateand
rebalance. The methods page said one rule for unused options applies "in every verb"; it
says which verbs now, and what the shared optionsrisk_free_rate,expected_returns,
current_weightsandbenchmark_weightschange in a backtest: the fits of the methods that
use them, not the report's ratios. -
Minimum CVaR with limits on cash, such as
cash=(0, 0.2), failed in its report ("weights: 6
weights for 5 assets") on every kind of assets, thoughmethods()lists the limit for it. The
report now splits the expected shortfall over every weight, the cash's included, on the
returns the method minimised. -
An optimisation's weights could fall a little below zero, of the order of 1e-13, and the engine
then refused its own output:portfolio.rebalance(optimisation), the weights given back as
current_weights, and walk-forward backtests with trade limits, whose refits checked the
weights the run held as if they had been given. The weights ofoptimiseand the frontier are
now within their bounds, at zero or the current weight where the solver was within 1e-7 of
it, and add up to one; their expected return and volatility are those of the weights given.
A refit starts from the weights the run holds without checking them as user input. -
A walk-forward refit with trade limits after fits that found no weights, holding only cash,
sent NaN weights without a risk-free asset (and could not invest with one). With nothing
invested, a refit now enters from cash, as the first fit does. -
Rebalancing to an optimisation traded every instrument: the assets the optimisation did not
trade were within about 1e-10 of their current weights, and each difference became a separate
trade of a fraction of a unit, paying the minimum fee, so the optimisation'smax_tradesand
min_tradedid not hold in the trades. An optimisation's weights for the assets it does not
trade are now their current weights exactly, andrebalancetreats a change worth less than
one minor unit of the instrument's currency, or a billionth of the account's value, as no
trade. -
Every input that takes weights by asset now follows one rule, and
portfolio.weights()is
valid in each.current_weights,benchmark_weights(inoptimiseand the frontier), fixed
weights and benchmark weights in backtests and comparisons refused cash in another currency,
such asEUR cash, whichPortfolio.assets()lists andevaluatetakes;current_weights,
benchmark_weightsand plans refusedCashat the risk-free rate unlesscashlimits were
given. Each now takes every label the assets list, cash included, andCashwhere it stands
for cash at the risk-free rate. An optimisation invests the cash in another currency it is
given, counting it in the turnover and listing it among the trades; a benchmark's cash in
another currency counts in the tracking error, with its risk; and a backtest holds such cash
as the asset it is, moving with its exchange rate. -
A report's
benchmark_weights(for the tracking error) that named a holding not held, or did
not add up to one, andexpected_returnsfor a holding not held, were accepted: the first was
caught inside the risk estimate and turned into a warning that dropped the holdings' risk from
the overview and the risk report, and the others changed nothing. They are now refused when the
report is built, with the other options, atoptions.benchmark_weightsand
options.expected_returns. -
The optimisation report's chart labelled equal weight's point beside the weights' dot when
the two nearly coincided, as for equal weight itself or given weights close to it, so the label
read as the weights'. The label is left out then; the legend names the point. -
The backtest and comparison reports echoed fixed weights, and a benchmark's weights, without
their cash and with every asset they left out at zero:{"US Equity": 0.55, "Bonds": 0.35, "T-Bills": 0.1}came back as five assets adding up to 0.9. The reports' weights are now those
given, the risk-free asset,Cashand cash in other currencies included. -
A backtest given a name (
name="Mine") used it for the strategy and the report's title but
leftreport.nameempty, whereoptimise,compareandevaluateput it. It is now there. -
The Python and JavaScript documentation of
Portfolio.assets()said it holds the instruments
alone; it holds the portfolio's cash too, as the Rust documentation says: base-currency cash as
the risk-free asset and cash in other currencies, so that the portfolio's own weights can be
valued and optimised from.
Changed
-
One message for a label that is not one of the assets,
unknown asset Nope, in every input
that takes weights or values by asset; rebalancing targets said "is not an instrument of the
portfolio". Current and benchmark weights andevaluate, like fixed weights, report weights
that do not add up to one beside an unknown label, and fixed weights say where the cash goes
as the others do ("give T-Bills, the risk-free asset, any cash"). Limits and risk budgets that
name cash in another currency say that optimisation does not choose it, and expected returns
for the risk-free asset orCashpoint torisk_free_rate. -
The digests of the optimisation, backtest and comparison reports (
context.digest, printed as
the inputs at the foot of each page) now cover every input: the strategies, their weights and
options, the benchmark, the validation and the money for backtests and comparisons, and the
method's parameters, the current and benchmark weights and the given weights foroptimise
andevaluate. Different inputs gave the same digest, such as minimum variance and risk
parity, or a target return of 6% and of 7%. Every such digest changes. -
Assets.frontierrefuses what it does not use, in the words of the rule every verb follows
(options.target: the frontier does not use target): a method (in JavaScript), a method's
parameters, resampling, and the risk-free rate unless it is the return ofCashon a frontier
that holds cash. It accepted them and did nothing. Python'sfrontiertakesrisk_free_rate
for that case. In TypeScript,frontiertakesFrontierOptions, the limits and the options
they use, rather thanPartial<OptimiseOptions>, and the options ofcompareandbacktest
(OptimiseLimits) no longer includecurrent_weights, which backtests refuse. -
A comparison refuses an option none of its methods takes in the words one optimisation uses,
grouping the methods by their reason, and its notes name the options that do not apply to a
method (The limits on cash do not apply.). It said that maximum Sharpe or minimum CVaR "is
fully invested and long only, and takes no limits on weights", and noted that the limits on
weights did not apply to a method when others had. A method that takes no limits, given
cash, is said to take none rather than to keep its ratio. -
Fields that options and documents do not have are refused at every depth, as the options'
top level already was in Python and JavaScript: a group's misspeltmaxx, which left the group
without a limit, a goal'snmae, a walk-forward'syeers, and in Rust a misspelt top-level
field ofReportOptions,OptimiseOptionsorBacktestOptionsread from JSON. JSON with
extra members, which was read as if they were not there, is now refused, naming the member. -
rebalancewithkeep_cashtakes targets that give the kept cash its weight now, as an
optimisation that kept the same cash gives them, as shares of the whole value; targets that
leave the kept cash out are shares of the rest, as before. A target for kept cash at another
weight is still refused, now saying the weight it has. -
A rebalancing's
turnover, for each account and for the accounts together, is half the sum
of the changes in weight with the cash included, as an optimisation's is and its
max_turnoverlimits; it was half the value traded in instruments. For the same trades the
two figures now agree; a rebalancing that invests or raises cash shows a larger turnover. -
The overview report's efficient frontier is the instruments', the one
optimiseand
evaluatedraw: it chose cash in other currencies as an asset, which optimisation never does,
so its least risky point leaned on the cash. The overview's frontier figures change. -
Attribution periods that reach past the report's start or date are attributed over the part
within the report, with the benchmark's figures as given and a warning that says so, rather
than refused; a period wholly outside the report is left out with a warning, and a report with
no period inside it is refused. -
A screen's benchmark serves beta and the other measures against it and is not a candidate:
it is no longer listed, matched or counted among the securities, unlessinclude_benchmark
asks for it. -
In Rust,
Portfolio::assets()returns a builder ended by.build(), as every other verb with
options does, so that options can be added to it later:portfolio.assets().build()?.
Python and JavaScript keepassets(). -
Problems are reported at the option given, under
optionsin every verb and language:
options.trading_cost_bpsandoptions.validation.startin backtests,options.chancein
plans,options.limitandoptions.rules[0].measurein screens,options.covariancefor
Python'sAssetsas for JavaScript's, andoptions.fee_bps,options.tax[0]and
options.accounts[0]in a rebalancing, rather than the fee rate and tax fields they become
inside the engine. A comparison's strategy is at the method or weights it was given as
(options.methods[1],options.weights.Mine) rather thanstrategies[k], a benchmark's
weights atoptions.benchmark, a plan's fixed weights atoptions.weightsrather than
weights.weights, and a report's date before the books atoptions.as_ofrather than a
startnot given. Problems are worded alike in JavaScript and Python: an unknown name or
method asminimum_varience is not one of minimum_variance, …, a misspelt option with a
suggestion (is not an option; did you mean max_weight?), a negative count asmust be a whole number of zero or more, and a number that is not finite asNaNorInfinity.