Skip to content

MarketUpdate


dataclass backtide.live.MarketUpdate

A candle received from a live market-data connection.

is_final is true only when the provider has closed the candle, or when Backtide observed the next candle and can therefore finalize the prior one.

Attributes

provider : str

Lowercase provider identifier, or "mock" for replay data.

symbol : str
Canonical provider-independent symbol.

quote_currency : str | None
Currency in which OHLC prices are denominated. Live providers populate this value; None preserves base-currency accounting for synthetic and backwards-compatible manually constructed updates.

interval : str
Canonical interval string.

open_ts : int
Candle-open Unix timestamp in seconds.

close_ts : int
Candle-close Unix timestamp in seconds.

open : float
Opening price in quote-currency units.

high : float
Highest price in quote-currency units.

low : float
Lowest price in quote-currency units.

close : float
Latest or final closing price in quote-currency units.

volume : float
Traded volume in base-asset units.

n_trades : int | None
Provider-reported trade count when available.

is_final : bool
Whether no further updates are expected for this candle.

received_ts : int
Local receipt Unix timestamp in seconds.


See Also

Session

A stateful simulated account with optional strategy evaluation.


Example

>>> from backtide.live import MarketUpdate

>>> market = MarketUpdate(
...     symbol="BTC-USD",
...     interval="1m",
...     open_ts=1_700_000_000,
...     close_ts=1_700_000_060,
...     open=100.0,
...     high=102.0,
...     low=99.0,
...     close=101.0,
...     volume=5.0,
... )
>>> print(market.close)

101.0