Cross-Sectional Factor Axis: private API

Functions

PortfolioOptimisers.exposure_axis_namesFunction
exposure_axis_names(
    nm::AbstractString,
    xe::AbstractExposureEstimator,
    _::ReturnsResult
) -> Tuple{Vector{String}, Vector}

Return the raw factor names and the Factor Family label of one Factor Exposure.

A OneHotExposure expands to one "<field>=<level>" name per level of the Panel Field it reads, so the name the caller paired it with names the block rather than a column. Every other Exposure Estimator produces one factor, which takes the caller's name.

Arguments

  • nm::AbstractString: Name the caller paired the estimator with.
  • xe: An Exposure Estimator.
  • rd: Returns data carrying the Asset Panel the levels are read from.

Returns

  • nf::Vector{String}: The raw factor names the estimator produces, in column order.
  • fam::Vector{String}: The estimator's Factor Family label, repeated once per name.

Related

source
PortfolioOptimisers.cross_sectional_sets_dictFunction
cross_sectional_sets_dict(
    rd::ReturnsResult,
    _::Nothing
) -> Dict{String, Any}

Return the dictionary a cross-sectional factor axis is written into.

Widening copies the declared universe's own dictionary, so every axis it already carries survives. Building one from nothing declares the asset axis alone, under the default xkey.

Arguments

  • rd: Returns data carrying the asset names.
  • sets: The declared universe to widen, or nothing.

Validation

  • rd.nx is set when sets is nothing.

Returns

  • dict::Dict{String, Any}: The dictionary to write the axis into.

Related

source
PortfolioOptimisers.cross_sectional_sets_write!Function
cross_sectional_sets_write!(
    dict::AbstractDict,
    key::AbstractString,
    val::AbstractVector
)

Write one entry of a cross-sectional factor axis into a universe dictionary, refusing to replace a different one.

A widened universe carries every entry the caller declared, and a Factor Family label is a plain group name, so a caller's own group can share it. Replacing that group in silence would re-point every constraint written against it, so an entry that already holds a different list is refused by name, and one that holds the same list is left as it stands.

Arguments

  • dict: The dictionary being built.
  • key: The key to write.
  • val: The list to write under it.

Validation

  • dict holds no entry under key, or holds val there.

Returns

  • nothing.

Examples

julia> d = Dict{String, Any}("style" => ["a"]);julia> PortfolioOptimisers.cross_sectional_sets_write!(d, "style", ["a"]);julia> PortfolioOptimisers.cross_sectional_sets_write!(d, "industry", ["b", "c"]);julia> d["industry"]2-element Vector{String}: "b" "c"

Related

source