bayesline.api.equity.LevelHierarchy

bayesline.api.equity.LevelHierarchy#

model LevelHierarchy#

One chain of nested levels within a dimension, coarsest to finest.

Each level’s members nest within the members of the level before it. A dimension can carry several chains (assets by industry and by geography), and a level can sit in more than one: an asset nests under its industry and under its country alike.

A level’s members are either unique on their own, so each determines its parent (a business sector belongs to one economic sector), or unique only within their parent, so a member is identified together with the levels before it (a month number recurs in every year). The latter are listed in within_parent; expanded without their parents, their members merge across parents.

Fields#

Field

Type

Required

Default

levels

list[str]

Yes

name

str

Yes

within_parent

list[str]

No

factory

field levels: list[str] [Required]#

The chain’s level columns from coarsest to finest.

field name: str [Required]#

The chain name, e.g. ‘trbc’ or ‘date’.

field within_parent: list[str] [Optional]#

The levels, after the first, whose members are unique only within their parent; every other level’s members are unique on their own.