citylearn.internal.market_history module

Lossless, append-oriented storage for community market settlements.

class citylearn.internal.market_history.MarketSettlementHistory(steps=())[source]

Bases: MutableSequence

Binary64 columns, interned member IDs and per-step row offsets.

Indexing, slicing and iteration return ordinary lists of dictionaries for the requested steps only. These are detached snapshots: assign a changed step back to the history to persist edits. Nonstandard/legacy rows are retained verbatim in a sparse side table, rather than dropping unknown fields.

Arrays grow amortized, without retaining per-row Python objects. Totals use the legacy chronological addition order; edits invalidate them and the next query rebuilds them once. No prices, flows or physical state are recomputed.

append(rows)[source]

S.append(value) – append value to the end of the sequence

clear() → None -- remove all items from S[source]
insert(index, rows)[source]

S.insert(index, value) – insert value before index

market_totals(building_names)[source]

Return independent KPI totals, including historical/removed members.