Skip to main content

Manager Updates

Stream real-time margin manager lifecycle events across all DeepBook Margin pools. This stream delivers manager creation events, collateral deposits, withdrawals, and liquidations as they occur on-chain.

Event Types

This stream emits multiple event types:

TypeDescription
deepbook_margin_manager_updates_manager_createdNew margin manager created
deepbook_margin_manager_updates_depositCollateral deposited
deepbook_margin_manager_updates_withdrawCollateral withdrawn
deepbook_margin_manager_updates_liquidationPosition liquidated

Endpoint

GET /deepbook-margin/manager-updates

Parameters

ParameterTypeRequiredDescription
api-keystringYesYour Surflux API key (query parameter)
last-idstringNoResume from events after this ID

Last-ID Options

ValueDescription
<event-id>Resume from events after this specific ID
0Consume from the beginning (server retention limits apply)
$Consume only real-time events (skip historical)

Event Structures

Manager Created

Emitted when a new margin manager is created.

{
"type": "deepbook_margin_manager_updates_manager_created",
"timestamp_ms": 1758629823918,
"checkpoint_id": 193054501,
"tx_hash": "FgUfRsYpC6ynW3pRvtgCLaa4WniBZYdsSLP94jrZ3pj7",
"data": {
"margin_manager_id": "0xabc123def456789abc123def456789abc123def456789abc123def456789abc1",
"balance_manager_id": "0x939adae6836dd87de7b7a2a48a5bd703dc1add7eb304d0c580217e000ccd2b10",
"deepbook_pool_id": "0xe05dafb5133bcffb8d59f4e12465dc0e9faeaa05e3e342a08fe135800e3e4407",
"owner": "0xb117b12facd947cabb3d17d68a67b3d8d6865280edb0644cb4d25a9d86646966",
"timestamp": 1758629823805
}
}

Manager Created Fields

FieldTypeDescription
margin_manager_idstringNew margin manager ID
balance_manager_idstringAssociated balance manager
deepbook_pool_idstringDeepBook trading pool
ownerstringOwner wallet address
timestampnumberOn-chain timestamp in milliseconds

Deposit Collateral

Emitted when collateral is deposited into a margin manager.

{
"type": "deepbook_margin_manager_updates_deposit",
"timestamp_ms": 1758629923918,
"checkpoint_id": 193054601,
"tx_hash": "GhVgStZqD7zoX4qSwuhDMbb5XoCjCaBttMQ95ksA4Sk8",
"data": {
"margin_manager_id": "0xabc123def456789abc123def456789abc123def456789abc123def456789abc1",
"base_asset_amount": 500000000000,
"quote_asset_amount": 0,
"timestamp": 1758629923805
}
}

Deposit Fields

FieldTypeDescription
margin_manager_idstringMargin manager receiving deposit
base_asset_amountnumberBase asset deposited (in smallest units)
quote_asset_amountnumberQuote asset deposited (in smallest units)
timestampnumberOn-chain timestamp in milliseconds

Withdraw Collateral

Emitted when collateral is withdrawn from a margin manager.

{
"type": "deepbook_margin_manager_updates_withdraw",
"timestamp_ms": 1758630023918,
"checkpoint_id": 193054701,
"tx_hash": "HiWgTuArE8apY5rTxviEOcc6YpDkDbCuuNR06ltB5Tl9",
"data": {
"margin_manager_id": "0xabc123def456789abc123def456789abc123def456789abc123def456789abc1",
"base_asset_amount": 100000000000,
"quote_asset_amount": 0,
"timestamp": 1758630023805
}
}

Withdraw Fields

FieldTypeDescription
margin_manager_idstringMargin manager withdrawn from
base_asset_amountnumberBase asset withdrawn (in smallest units)
quote_asset_amountnumberQuote asset withdrawn (in smallest units)
timestampnumberOn-chain timestamp in milliseconds

Liquidation

Emitted when a margin manager position is liquidated.

{
"type": "deepbook_margin_manager_updates_liquidation",
"timestamp_ms": 1758630123918,
"checkpoint_id": 193054801,
"tx_hash": "IjXhUvBsF9bqZ6sTywiEPdd7ZqEkEcDvvOS17muC6Um0",
"data": {
"margin_manager_id": "0xabc123def456789abc123def456789abc123def456789abc123def456789abc1",
"margin_pool_id": "0x4405b50d791fd3346754e8171aaab6bc2ed26c2c46efdd033c14b30ae507ac33",
"liquidation_amount": 200000000000,
"pool_reward": 5000000000,
"pool_default": 0,
"risk_ratio": 1120000,
"remaining_base_asset": 500000000000,
"remaining_quote_asset": 100000000,
"timestamp": 1758630123805
}
}

Liquidation Fields

FieldTypeDescription
margin_manager_idstringLiquidated margin manager
margin_pool_idstringMargin pool the debt was in
liquidation_amountnumberAmount of debt liquidated
pool_rewardnumberReward retained by the pool
pool_defaultnumberBad debt absorbed by pool (if any)
risk_rationumberRisk ratio at liquidation (× 1,000,000)
remaining_base_assetnumberRemaining base collateral
remaining_quote_assetnumberRemaining quote collateral
timestampnumberOn-chain timestamp in milliseconds