Receive live GB accepted and on-table bid/offer changes through one SignalR subscription and one Python callback.
The BM push subscription is a push-based service that delivers real-time GB accepted and on-table bid/offer changes over SignalR.
One subscription covers accepted bids, accepted offers, on-table bids, on-table offers and their removals. A subscription has a maximum lease of 14 days at which time it will retire. The python package will automatically renew the lease after 13 days.
Enact maintains a rolling window of 48 half-hour periods, beginning at the start of the current settlement period and ending immediately before the period starting 24 hours later. The subscription will push BM data for all periods within this window. Once a historical period leaves the window, later corrections to that period are outside this subscription.
Getting Started
The easiest way to interact with this push service is through the LCPDelta Python package. The BMPushClient manages authentication, the SignalR connection, subscription restoration, automatic lease renewal, callback buffering, heartbeat monitoring and shutdown.
The client delivers a cleaned BMPush object and just needs the user to define a callback method to tell it how to process the push. Accepted and on-table changes share one connection, one subscription and one callback.
The examples/bm_client.py file, which can be viewed on the GitHub, is the best place to start. The file outlines how to run the service and provides an example callback method that can be easily altered for your use case. We have further outlined this in the below python examples.
Usage and Renewal
The first recorded BM subscription or renewal for an account on a GB calendar day counts as 10 API calls. Repeat subscriptions recorded for that account on the same day do not add this charge again. The account lease lasts 14 days, and the Python client automatically renews after 13 days by default; renewal can therefore add another 10-call charge. Automatic recovery of an existing valid subscription does not add usage. Restarting the script creates a fresh subscription and can add the charge on a later day. Receiving updates and the rolling window crossing midnight do not themselves add charges.
Asynchronous Python Example
Set LCPDELTA_ENACT_USERNAME and LCPDELTA_ENACT_API_KEY in the environment.
The example callback method here on_update prints rows as they arrive. You can filter accepted and on table bids/offers through COLLECTIONS_TO_SHOW or edit TARGET_PLANT_ID to filter to a specific plant for example..
import asyncio
import logging
import os
from datetime import datetime, timezone
import pandas as pd
from lcp_delta.enact import BMPushClient, BMPush
TARGET_PLANT_ID = None # For example: "T_COSO-1"
COLLECTIONS_TO_SHOW = {
"removed_accepted_bids": True,
"removed_accepted_offers": True,
"removed_table_bids": True,
"removed_table_offers": True,
"accepted_bids": True,
"accepted_offers": True,
"table_bids": True,
"table_offers": True,
}
def on_update(batch: BMPush):
rows = []
for collection, enabled in COLLECTIONS_TO_SHOW.items():
if not enabled:
continue
for row in getattr(batch, collection):
if TARGET_PLANT_ID is not None and row.get("plantId") != TARGET_PLANT_ID:
continue
rows.append({
"Collection": collection,
"delta id": row.get("deltaId"),
"plantId": row.get("plantId"),
"bod id": row.get("bodId"),
"volume": row.get("volume"),
"bid price": row.get("bidPrice"),
"offer price": row.get("offerPrice"),
"flagged": any(row.get(flag, False) for flag in ("soFlag", "storFlag", "cadlFlag")),
"accepted time": row.get("acceptedTime"),
})
if not rows:
return
print(f"Received (UTC): {datetime.now(timezone.utc).isoformat()}")
print(f"Settlement date: {batch.date} | Period: {batch.period} | Revision: {batch.revision}")
print(pd.DataFrame(rows).to_string(index=False), flush=True)
async def main():
logging.basicConfig(level=logging.INFO)
client = BMPushClient(
os.environ["LCPDELTA_ENACT_USERNAME"],
os.environ["LCPDELTA_ENACT_API_KEY"],
callback=on_update,
auto_connect=False,
reconnect=True,
callback_queue_maxsize=1000,
heartbeat_timeout_seconds=30,
lease_refresh_interval_days=13, # Default: renew before the 14-day expiry.
)
try:
await client.async_subscribe_to_bm_updates(timeout=30)
await asyncio.Event().wait()
finally:
await client.async_close(wait_for_callbacks=True)
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
passIn a notebook with an existing event loop, use await main() instead of asyncio.run(main()). Keep callbacks quick; pass slow storage or processing work to another worker.
Synchronous Subscription
For a synchronous application, reuse on_update above and use the synchronous subscribe and close methods:
from threading import Event
client = BMPushClient(
os.environ["LCPDELTA_ENACT_USERNAME"],
os.environ["LCPDELTA_ENACT_API_KEY"],
callback=on_update,
auto_connect=False,
callback_queue_maxsize=1000,
lease_refresh_interval_days=13,
)
try:
client.subscribe_to_bm_updates(timeout=30)
Event().wait()
except KeyboardInterrupt:
pass
finally:
client.close(wait_for_callbacks=True)Python Callback Shape
A synchronous or asynchronous callback accepts one BMPush argument:
def on_update(batch: BMPush):
...
# An async callback is also supported:
async def on_update(batch: BMPush):
...The batch metadata is:
| Property | Type | Meaning |
|---|---|---|
date | datetime.date | GB settlement date. |
period | int | Period within that settlement date; valid dates can have 46, 48 or 50 periods. |
revision | int | Source revision for this date/period, not a global delivery sequence. |
The eight row collections are tuples of public row dictionaries:
| Changed rows | Removed rows |
|---|---|
accepted_bids | removed_accepted_bids |
accepted_offers | removed_accepted_offers |
table_bids | removed_table_bids |
table_offers | removed_table_offers |
An on-table-only update invokes the same callback. Empty collections mean no changes in that collection. The collections contain deltas, not full period snapshots.
Illustrative Python Batch
The following JSON-style view illustrates the cleaned callback data; the values are illustrative, not a live market response. In Python, the callback receives a BMPush, date is a datetime.date and the row collections are tuples.
{
"date": "2026-12-01",
"period": 23,
"revision": 1,
"accepted_bids": [],
"accepted_offers": [{
"deltaId": "EXAMPLE_PLANT_1_False_False_False_False_100_50",
"plantId": "EXAMPLE_PLANT",
"bodId": "1",
"volume": 10.0,
"bidPrice": 50.0,
"offerPrice": 100.0,
"cost": 0.0,
"bidOnTableTypeEnum": null,
"fuelType": null,
"isBid": false,
"isAccepted": true,
"soFlag": false,
"storFlag": false,
"cadlFlag": false,
"additionalBsadData": null,
"acceptedTime": "2026-12-01T10:00:00"
}],
"removed_accepted_bids": [],
"removed_accepted_offers": [],
"table_bids": [],
"table_offers": [],
"removed_table_bids": [],
"removed_table_offers": []
}Python Row Properties
Each retained row contains these public keys. Values can be None when the source value is unavailable; the classification flags are Python Booleans.
| Property | Meaning |
|---|---|
deltaId | Source row identity, preserved unchanged. |
plantId | Enact plant identifier. |
bodId | Bid/offer pair identifier, (-5 to 5) |
volume | Accepted volume for accepted rows, or remaining on-table volume for on-table rows, in MW. |
bidPrice | Source bid price. |
offerPrice | Source offer price. |
cost | Source cost value, preserved unchanged. |
isBid | True for a bid; False for an offer. |
isAccepted | True for an accepted row; False for an on-table row. |
soFlag | SO classification flag. |
storFlag | STOR classification flag. |
cadlFlag | CADL classification flag. |
bidOnTableTypeEnum | On-table classification name determining turn on/off status. |
fuelType | Fuel classification. |
acceptedTime | Nullable source acceptance timestamp as an ISO-format string. |
additionalBsadData | BSAD information containing plantId, partyName and fuelType, or None. |
Row Identity and Applying Updates
Use the complete key settlement date + period + logical collection + deltaId. The four logical collections are accepted_bids, accepted_offers, table_bids and table_offers; each removed_* list removes rows from its corresponding logical collection. An ID alone is not globally unique across periods or collections.
On-table IDs use:
{plantId}_{bodId}Accepted-row IDs use:
{plantId}_{bodId}_{cadlFlag}_{soFlag}_{storFlag}_{terreFlag}_{offerPrice}_{bidPrice}Treat deltaId as an opaque string rather than splitting it; plant IDs can contain underscores.
When maintaining state, apply removals before changed rows. Remove from the matching accepted/on-table and bid/offer collection; insert or replace changed rows by deltaId. A price or flag correction can remove an old accepted identity and add a new one. Volume and acceptance time are not part of the ID.
A single batch can contain an acceptance and updates to both on-table sides. Those are different row changes in one batch, not duplicate pushes.
Python Reconnect Behaviour
With reconnect=True, BMPushClient reconnects automatically after an unexpected disconnect. The default retry delay starts at 2 seconds and increases to a maximum of 30 seconds. It re-registers handlers, restores the BM subscription through ReconnectToPush and resumes your existing callback. If restoration returns ReconnectUnavailable or DataFormatError, it attempts a fresh JoinBoaPush. A successful reconnect does not reset the renewal deadline. A successful fresh join, including this fallback, starts the 13-day renewal timer again.
There is no snapshot-refresh callback, automatic HTTP request, replay or revision deduplication. Revisions are scoped to settlement date/period and can skip or reset. They do not prove complete delivery. Server queues, membership transitions and disconnects can lose updates.
Restarting the Python client: A running client uses ReconnectToPush to restore its subscription. Restarting the script or creating a new BMPushClient instead starts with JoinBoaPush. That can record another 10-call charge on a later day, even if the previous lease is still valid.
Heartbeat Monitoring
The engine sends a heartbeat every five seconds. While connected and subscribed, the client warns once after heartbeat_timeout_seconds without a heartbeat; the default is 30 seconds. It logs recovery when heartbeats resume. Set the timeout to None to disable this monitoring.
A stale heartbeat does not force a reconnect or prove that a particular BM row was missed. Receiving heartbeats does not prove that the BM lease is still live. The hub can also broadcast unrelated frontend control messages; raw SignalR clients can ignore those when consuming the BM feed.
Python Error Handling
Subscription errors are raised as EnactApiError. Inspect error_code, message and response when diagnosing a failed join.
| Error | Meaning |
|---|---|
InsufficientAccessPrivileges | The account does not have the required access. |
DataCapped | The account has reached its usage allowance. |
RateLimited | Too many join/reconnect attempts in the configured rate-limit window. |
ReconnectUnavailable | The account BM lease was not found or has expired; perform a fresh validated join. |
DataFormatError | The client received an unexpected subscription response. |
UnknownData | The API user could not be found. |
Malformed batches are logged and ignored. User callback failures are logged without retrying the callback. Connection and subscription restoration failures are logged while automatic retry remains enabled.
Python Client Settings
| Setting | Default | Purpose |
|---|---|---|
callback | None | Required before subscribing; receives one BMPush. Can be sync or async. |
auto_connect | True | Use False to defer network activity until connect/subscribe. |
reconnect | True | Restore the connection and subscription after unexpected disconnects. |
reconnect_initial_delay_seconds | 2.0 | Initial retry delay. |
reconnect_max_delay_seconds | 30.0 | Maximum retry delay. |
callback_queue_maxsize | 0 | Bounds queued plus running callbacks. Zero is unbounded; a positive value applies backpressure. The example uses 1000. |
heartbeat_timeout_seconds | 30.0 | Missing-heartbeat warning threshold, or None to disable. |
lease_refresh_interval_days | 13.0 | Renew the 14-day account lease after this many days since the last successful fresh join. Must be greater than 0 and less than 14, or None to disable automatic renewal. |
logger | Module logger | Optional logger for connection, heartbeat and callback messages. |
Callbacks run sequentially. Synchronous callbacks use a dedicated worker thread; asynchronous callbacks run on the client's background event loop. Close the client from outside its callbacks.
Subscribe, Unsubscribe and Close
| Method | Purpose |
|---|---|
subscribe_to_bm_updates(callback=None, timeout=30) | Synchronous subscription; returns "boaDashboardUpdated". |
async_subscribe_to_bm_updates(callback=None, timeout=30) | Async subscription. |
unsubscribe_from_bm_updates(timeout=30) | Stops the subscription. |
async_unsubscribe_from_bm_updates(timeout=30) | Async unsubscribe. |
close(wait_for_callbacks=True, timeout=10) | Closes the connection and, by default, drains queued callbacks within the shutdown timeout. |
async_close(wait_for_callbacks=True, timeout=10) | Async close. |
Timeout arguments are in seconds and keyword-only. Callbacks already queued may finish after unsubscribe. Unsubscribing stops automatic lease renewal for this client. Explicitly closing the client stops automatic reconnect and lease renewal.
Connecting Directly with SignalR
Use this section when implementing your own SignalR client. BMPushClient handles these connection and subscription steps for Python applications.
API Usage and Renewal
A successful new BM subscription or lease renewal made with
JoinBoaPushcounts as 10 API calls towards your monthly usage quota. Repeat joins for the same account's recorded BM subscription on the same day do not add that charge again.
ReconnectToPushrestores an existing BM subscription after a disconnect and does not increase API usage while its 14-day lease is still valid, including when reconnecting the next day.Clients should not call
JoinBoaPushrepeatedly for disconnect recovery. UseReconnectToPushfirst, and only callJoinBoaPushagain if the backend returnsReconnectUnavailable.The Python client renews after 13 days by default; this fresh join can record another 10-call charge. Receiving updates and the rolling data window crossing into a new day do not themselves add subscription charges.
Connection Steps
At a high level, your client should:
- Connect to
https://enact.lcp.com/signalr/dataHubusing your Enact bearer authentication. - Register a client handler for
boaDashboardUpdatedbefore joining, so it is ready for incoming updates. - Call
JoinBoaPushwith no arguments. - Check the returned messages for errors and read
data.pushName. - Process pushed updates in the registered handler.
- If the connection drops, reconnect SignalR and call
ReconnectToPush("boaDashboardUpdated"). - If
ReconnectToPushreturnsReconnectUnavailable, callJoinBoaPushagain. - Call
LeaveGroup("boaDashboardUpdated")when intentionally stopping, then close the connection.
Join Request Shape
Invoke the SignalR hub method with an empty argument list:
Method: JoinBoaPush
Arguments: []There are no plant, settlement-period or collection arguments. Filter the received rows in your callback if you only need part of the feed.
Join Response
The relevant field in a successful response is:
{
"data": {
"pushName": "boaDashboardUpdated"
}
}The push name is the logical subscription identifier. Use it for the message handler, reconnect and unsubscribe calls; clients do not need to construct physical period-group names.
Lease and Long-Running Clients
A successful JoinBoaPush() creates or renews a 14-day lease for the API account and BM feed. Renewing starts a new 14-day lease from the successful join. Connections for the same account share that lease.
The lease controls how long the account can receive BM updates. It is separate from the rolling 24-hour data window: the window moves forward while the lease remains live.
ReconnectToPush("boaDashboardUpdated") restores an existing live lease, including on a later day, without extending its expiry. If the lease is missing or expired, reconnect returns ReconnectUnavailable; perform a fresh validated JoinBoaPush() to create a new lease.
The server removes BM period memberships after lease expiry, including for clients whose SignalR connection has stayed open. The connection itself may remain open and receive general heartbeats. Renew before expiry to keep receiving BM data.
BMPushClient renews automatically 13 days after its last successful fresh join, using JoinBoaPush() on the same connection and retaining the callback and handlers. Failed renewals retry with backoff. Set lease_refresh_interval_days=None to disable automatic renewal; then your client must renew the lease itself before expiry. A custom interval must be greater than 0 and less than 14 days.
Reconnect Flow
If the SignalR connection drops unexpectedly:
- Reconnect to the SignalR hub.
- Call
ReconnectToPush("boaDashboardUpdated"). - If it succeeds, continue listening for
boaDashboardUpdated. The backend restores memberships for the current window. - If it fails for a transient reason, keep retrying
ReconnectToPush. - If the backend returns
ReconnectUnavailable, the account lease is missing or expired. CallJoinBoaPush()again.
This matters for API usage. ReconnectToPush does not increase usage, but a fresh JoinBoaPush can count as 10 API calls when the account has no BM subscription recorded for that day.
Reconnection resumes future delivery. Missed updates are not replayed, and there is no initial snapshot or automatic HTTP recovery request.
Stop Receiving Updates
Invoke LeaveGroup("boaDashboardUpdated"). This stops maintenance of the connection's BM period memberships. Closing the connection also removes its memberships. It does not revoke the account lease or stop other subscribed connections for the same account.
Raw SignalR Message Shape
Non-Python consumers receive the shared wire envelope. The following illustrates its shape with empty row collections:
{
"datePeriod": {"date": "2026-12-01T00:00:00", "period": 23},
"item": {
"revision": 66,
"previousRevision": 65,
"reloadRequired": false,
"acceptedBids": [],
"acceptedOffers": [],
"removedAcceptedBids": [],
"removedAcceptedOffers": [],
"tableBids": [],
"tableOffers": [],
"removedTableBids": [],
"removedTableOffers": []
}
}Raw wire rows use camel-case collection names and can contain frontend fields and predictions. The cleaned Python view described above filters those rows and fields locally. Raw SignalR consumers must implement any equivalent filtering themselves.