Skip to content

Configuration

Centralized pipeline configuration. All tunable parameters live here.

PipelineConfig

PipelineConfig(**data: Any)

Bases: _Settings

Validated, immutable configuration for the ob-analytics pipeline.

Every parameter that was previously a hard-coded literal now lives here with a sensible default matching the original R package behaviour (Bitstamp BTC/USD, 2015). Override individual values for different instruments, exchanges, or precision requirements.

How a feed encodes its prices and timestamps is not set here: each loader reads its own format. An unknown field is refused, so a setting this version no longer has is not dropped silently.

price_multiplier property

price_multiplier: int

Integer inverse of :attr:tick_size (round(1 / tick_size)).

The multiplier that turns a quote-currency price into an integer tick count, defined only when the tick is a reciprocal integer (the usual case: a cent, nickel, or quarter grid). With the default tick_size of 0.01 this is 100, matching the former 10 ** price_decimals.

Raises:

Type Description
ConfigError

If :attr:tick_size has no integer inverse; convert prices with ob_analytics._utils.price_to_ticks (which divides) instead.

bps_labels property

bps_labels: list[str]

Column suffixes for depth-metric BPS bins (e.g. '25bps', '50bps' …).

InstrumentGrid dataclass

InstrumentGrid(
    tick_size: float = 0.01, lot_size: float = 1e-08
)

The price and size grid a source's data is usually on.

A source declares one as its grid (see :func:~ob_analytics.protocols.grid_of). The pipeline starts its config from it, and a field the caller sets wins, so LOBSTER runs on whole shares without the caller saying so.

Attributes:

Name Type Description
tick_size float

The price step, in the quote currency. The default is a cent.

lot_size float

The size step, in the instrument's own units. The default is a satoshi (1e-8), the :class:PipelineConfig default.

fields

fields() -> dict[str, Any]

Return the :class:PipelineConfig fields for this grid.

Each step comes with the display precision that shows one step, as :func:instrument_fields gives them.

config

config(
    config: PipelineConfig | None = None,
) -> PipelineConfig

Return config laid over this grid.

The fields the caller set in config win; every other grid field comes from this grid. A step the caller set without its display precision brings the precision that shows one step, as :func:instrument_fields gives it, rather than the grid's. With no config, the config is this grid's.