Tracking risk measure: private API
PortfolioOptimisers.bind_data_benchmark — Method
bind_data_benchmark(r::TrackingRiskMeasure, rd)
bind_data_benchmark(r::Union{RiskTrackingError, RiskTrackingRiskMeasure}, rd)Bind the DataBenchmarkTracking that a tracking measure holds to the benchmark B of the returns data rd.
A TrackingRiskMeasure binds its tr field. A RiskTrackingError and a RiskTrackingRiskMeasure track a benchmark portfolio, so they bind the measure r that they track. Each rebuilds through its keyword constructor only when the field changes, as bind_data_benchmark states.
Algorithm
- Bind the field that can hold a data benchmark with
bind_data_benchmark:trof aTrackingRiskMeasure, givingtr, or the tracked measurerof the two risk trackers, givinginner. - Return
ritself when the bound field is the field it replaces, by===. - Otherwise rebuild
rwith the bound field through its keyword constructor, withrebuild_struct.
Related
PortfolioOptimisers.reader_frames — Method
reader_frames(r::Union{RiskTrackingError, RiskTrackingRiskMeasure},
path::AbstractString, refit::Bool)Return the frames that the tracked measure of a risk tracker adds to the group of the optimiser that holds the tracker.
A RiskTrackingError and a RiskTrackingRiskMeasure hold the measure that they track in r, so the walk passes through to it at the path "<path>.r". A measure that holds a reader, such as an UncertaintySetVariance with a prior of its own, adds the frames of that reader. A TrackingError and a TrackingRiskMeasure hold no reader, so they add no frames.
Arguments
r: The risk tracker.path: The path of the value from the head, for example"pe","cle"or"r[2].pe". A warning names a reader by its path.refit:truewhen a regression reader atx_src = nothingin the group fits its regression on the raw returns data.refits_regressionfinds the value.
Returns
fr::ReturnsFrames: The frames of the tracked measure.
Related