Skip to content

registry

The brokers whose ticks the unified service can normalize, and their normalizers.

A broker is added here with its normalizer and offline tests. Being here is not the same as being trusted: ownership prefers the brokers in sources.VERIFIED_BROKERS, which a broker joins only after its normalizer has been checked against a live session, and uses the others only for instruments no verified broker streams. Ticks from a broker with no normalizer are counted and ignored.

Functions:

Name Description
build_normalizers

One normalizer per broker.

build_normalizers

build_normalizers(brokers=None)

One normalizer per broker.

Parameters:

Name Type Description Default
brokers list[str] | None

Broker names to build for, or None for every broker with a normalizer.

None

Returns:

Type Description
dict

Broker name to its TickNormalizer instance.

Raises:

Type Description
ValueError

If a named broker has no normalizer.

Source code in stock_brokers/instruments/ticks/utilities/registry.py
def build_normalizers(brokers=None):
    """
    One normalizer per broker.

    Args:
        brokers (list[str] | None): Broker names to build for, or None for every broker with a normalizer.

    Returns:
        dict: Broker name to its TickNormalizer instance.

    Raises:
        ValueError: If a named broker has no normalizer.
    """
    names = list(NORMALIZERS) if brokers is None else list(brokers)
    unknown = [name for name in names if name not in NORMALIZERS]
    if unknown:
        raise ValueError(f"no tick normalizer for: {', '.join(unknown)}")
    return {name: NORMALIZERS[name]() for name in names}