quantlab.portfolio.approximate#
The approximate backtest’s interface to its rule implementations: which rules it runs, and what a decision reads and returns.
The approximate backtest (quantlab.backtest.approximate, ADR 0045) owns
its implementations of the portfolio construction rules it supports, apart
from the per-bar rule classes: they live in
quantlab.portfolio.predefined.approximate, one module per rule, and are
chosen here by the rule’s exact class (its import path, so neither a rule
module nor an implementation is imported before it is used). A subclass may
decide differently and is refused, as is any other rule. Each rule’s config
is read through a field table: a field is supported, ignored (listed as given
up in docs/user-guide/backtesting.md), or must keep its default; a field the table does
not know is refused unless it is at its default, so a field added to a rule’s
config later is never silently approximated. A rule’s covariance estimator is
chosen and read the same way, and estimate_all answers for it with every
bar’s covariance in low-rank form (LowRankCovariance).
implementation(rule) returns the module that decides a rule, or raises
with the reason, before any data is read. Each implementation offers one
call, decide(rule, panel, prices, stopping): every bar of a decision
panel’s weights (PanelSolution), given the book before the bars and the
prices it drifts with (PanelPrices) and an iterative solver’s
Stopping.
This module is framework: it imports no predefined module and no solver.
Classes
Every bar's covariance of a decision panel, in low-rank form: |
|
The book filled before a panel and the prices its holdings drift with: what |
|
Every bar's weights of a panel, as an implementation's |
|
When an iterative panel solver stops on a bar. |
Functions
Estimate the covariance of one-bar returns at every bar of a decision panel. |
|
Return the module that decides |