Skip to content

Tokens

Reusable label vocabularies for one timeframe.

register_calendar_token

register_calendar_token(
    name: str,
    timeframe: str,
    expand: Callable[[], Any],
    alignment: str | None = None,
) -> str

Register a token: expand() returns {"label": [...], "share": [...]} (or a table with those columns) with unique labels and shares summing to 1.

get_calendar_token

get_calendar_token(name: str) -> dict

A token's definition: timeframe, expand, and optional alignment.

list_calendar_tokens

list_calendar_tokens() -> list[str]