ores.synthetic.variance_calibration
Table of Contents
- 1. Flags
- 2. Columns
- 2.1. id
- 2.2. party_id
- 2.3. base_currency_code
- 2.4. quote_currency_code
- 2.5. input_id
- 2.6. method
- 2.7. method_version
- 2.8. alpha
- 2.9. gamma
- 2.10. beta
- 2.11. persistence
- 2.12. long_run_variance
- 2.13. starting_variance_ratio
- 2.14. log_likelihood
- 2.15. returns_used
- 2.16. starts
- 2.17. starts_agreed
- 2.18. state
- 2.19. state_reason
- 3. SQL
- 4. Foreign keys
- 5. Insert trigger
- 6. C++
- 7. See also
One GJR-GARCH shape of a pair's daily variance and the evidence a reviewer judges
it by. A fitted calibration names the variance_calibration_input it was fitted
from and the version of the method that fitted it; an authored one names no input
and is reviewed like any other. A feed runs only a calibration that is approved,
and names it. See "A calibration is stored and reviewed before a feed runs it" in
Volatility clustering and GARCH models.
A calibration is proposed when it is stored. A person approves or rejects it and
states why in state_reason; approving one makes the pair's earlier approval
superseded in the same change, so one approved calibration of a pair is current.
Each decision is a new version of the row, so its history shows who decided what
and when. A fit that could not be made, for too few returns or a shape at the
stationarity bound, is stored as rejected with the reason, so the attempt is kept;
such a row may have no shape, so the shape is required, and admissible, in the
other three states only. Each bound is written so that a missing value or NaN
fails it: a check passes on null, and PostgreSQL orders NaN above every number. A
value that is present is finite in every state, rejected included, so the audit
trail holds no NaN. The evidence of a fit agrees with its method: an authored shape
has no starts, returns or likelihood, and a fit that was not rejected has all three.
The checks do not tie persistence to the three parameters, because p_minus is
not stored; the fit that writes a calibration owns that equality.
persistence is alpha + gamma p_minus + beta, with p_minus the share of the
daily return's variance that falls on negative days, so it is stored rather than
recomputed from the three parameters alone.
1. Flags
2. Columns
2.1. id
Surrogate UUID uniquely identifying this calibration.
2.2. party_id
Owning party: the system party, as for the feeds.
ctx.generate_uuid()
2.3. base_currency_code
The pair's base currency, held here so the approval index needs no join.
std::string("EUR")
2.4. quote_currency_code
The pair's quote currency.
std::string("USD")
2.5. input_id
The variance_calibration_input this calibration was fitted from; absent for an
authored calibration, which reads no input. A foreign key holds a fitted
calibration to an input that exists.
std::nullopt
2.6. method
How the shape was obtained: gjr_garch_qmle, variance targeting and Gaussian quasi
maximum likelihood over the input's returns, or authored, written by a person.
std::string("authored")
2.7. method_version
The version of the method, so a fit made by an earlier estimator stays distinguishable from one made by a later one.
1
2.8. alpha
The reaction to yesterday's squared return.
std::optional<double>(0.05)
2.9. gamma
The extra reaction to a negative return, the asymmetry; alpha + gamma is not
negative.
std::optional<double>(0.02)
2.10. beta
The weight of yesterday's variance.
std::optional<double>(0.9)
2.11. persistence
alpha + gamma p_minus + beta, below one for a stationary shape.
std::optional<double>(0.96)
2.12. long_run_variance
The unconditional daily variance the history the shape was fitted to returns to, positive. Absent for an authored shape: a feed always takes its long-run level from its own mixture, so the level only describes the fit's data.
std::optional<double>(0.00004)
2.13. starting_variance_ratio
The variance at the end of the input's history over the long-run level: where a feed's first day starts. One for an authored shape.
std::optional<double>(1.0)
2.14. log_likelihood
The Gaussian log likelihood of the input's returns at the fitted shape; absent for an authored shape.
std::nullopt
2.15. returns_used
How many returns the fit read; zero for an authored shape.
0
2.16. starts
How many starting points the simplex was run from; zero for an authored shape.
0
2.17. starts_agreed
Whether every start reached the same optimum, within the fit's tolerance; a fit whose starts disagree deserves a closer look before it is approved.
false
2.18. state
proposed, approved, rejected or superseded.
std::string("proposed")
2.19. state_reason
Why the calibration is in its state: the reviewer's reason for an approval or a rejection, the refusal of a fit that could not be made, or the calibration that superseded it.
std::string("")
3. SQL
3.1. Flags
3.2. Checks
| expression |
|---|
| "base_currency_code" <> "quote_currency_code" |
| "method" in ('gjr_garch_qmle', 'authored') |
| ("method" = 'authored') = ("input_id" is null) |
| "method_version" > 0 |
| "state" in ('proposed', 'approved', 'rejected', 'superseded') |
| "state" not in ('approved', 'rejected', 'superseded') or "state_reason" <> '' |
| "returns_used" >= 0 and "starts" >= 0 and (not "starts_agreed" or "starts" > 0) |
| "method" <> 'authored' or ("starts" = 0 and "returns_used" = 0 and "log_likelihood" is null) |
| "method" = 'authored' or "state" = 'rejected' or ("starts" > 0 and "returns_used" > 0 and "log_likelihood" is not null) |
| coalesce("alpha", 0) < 'Infinity'::double precision and coalesce("gamma", 0) < 'Infinity'::double precision and coalesce("beta", 0) < 'Infinity'::double precision and coalesce("persistence", 0) < 'Infinity'::double precision and coalesce("long_run_variance", 0) < 'Infinity'::double precision and coalesce("starting_variance_ratio", 0) < 'Infinity'::double precision and coalesce("log_likelihood", 0) < 'Infinity'::double precision |
| "state" = 'rejected' or coalesce("alpha" >= 0 and "alpha" < 1 and "beta" >= 0 and "beta" < 1 and "alpha" + "gamma" >= 0 and "alpha" + "gamma" < 'Infinity'::double precision, false) |
| "state" = 'rejected' or coalesce("persistence" >= 0 and "persistence" < 1, false) |
| "state" = 'rejected' or "method" = 'authored' or coalesce("long_run_variance" > 0 and "long_run_variance" < 'Infinity'::double precision, false) |
| "state" = 'rejected' or coalesce("starting_variance_ratio" > 0 and "starting_variance_ratio" < 'Infinity'::double precision, false) |
3.3. Indexes
| name | columns | unique | current_only | where_extra |
|---|---|---|---|---|
| approved_pair | tenant_id, party_id, base_currency_code, quote_currency_code | true | true | state = 'approved' |
4. Foreign keys
4.1. input_id
5. Insert trigger
5.1. Validations
| column | validation_function |
|---|---|
| base_currency_code | ores_refdata_validate_currency_fn |
| quote_currency_code | ores_refdata_validate_currency_fn |
6. C++
6.1. Flags
6.2. Repository
6.3. Domain includes
#include <boost/uuid/uuid.hpp> #include <optional> #include <string>
6.4. Entity includes
#include <optional> #include <string>
6.5. Conventions
6.6. Table display
| column | header |
|---|---|
| base_currency_code | Base |
| quote_currency_code | Quote |
| method | Method |
| state | State |
| alpha | Alpha |
| gamma | Gamma |
| beta | Beta |
| persistence | Persistence |
| version | Version |
7. See also
- Variance Calibration Input – the stored fixings a fit reads.
- Volatility clustering and GARCH models – the model and the workflow.