subscribeOrders
Subscribe to a real-time stream of order events. The stream emits events when orders are created, filled, unfilled, or cancelled. Each event contains the complete order data.
The subscription can be filtered by order type, trading pair, or wallet address to receive only relevant events.
Params
The subscribeOrders
method accepts two sets of parameters:
Parameter | Type | Description |
---|---|---|
OrderSubscriptionKind | HashSet | The set of order event types to subscribe to. Options: NewOrders , FilledOrders , UnfilledOrders , CancelledOrders , ExpiredOrders . |
OrderSubscriptionFilter | HashSet | Filters to restrict the subscription. Options: ByPair(Bytes32) (only returns orders for a specific pair), ByAddress(Address) (for a specific wallet), (only returns book orders) OnlyBook , (only returns tob orders) OnlyTOB or None (returns all orders). |
Request
wscat -c ws://<ANGSTROM_URL>:<ANGSTROM_PORT>
> {"jsonrpc": "2.0", "id": 0, "method": "angstrom_subscribeOrders", "params": [["newOrders"],["none"]]}
Response
{
"jsonrpc": "2.0",
"id": 0,
"result": 5439762351020376
}
...
{
"jsonrpc":"2.0",
"method":"angstrom_subscribeOrders",
"params":{
"subscription":5439762351020376,
"result":{
"newOrder": {
"PartialFlash":{
"ref_id":0,
"min_amount_in":27046034922895,
"max_amount_in":135230174614476,
"max_extra_fee_asset0":27046034922895,
"min_price":"0x115ca7048e5b370000000000000",
"use_internal":false,
"asset_in":"0x45cb6df752760cc995fe9b05c61ce6bd8776b1e7",
"asset_out":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"recipient":"0x0000000000000000000000000000000000000000",
"hook_data":"0x",
"valid_for_block":21967420,
"meta":{
"isEcdsa":true,
"from":"0x8c7b8983fb4aae474812b96b88c3d5573c5219dd",
"signature":"0x007732f185e1f291b3be9f53bfa3c4b781bd3ec705844037814588dfc28968dbde3e6295571e3adc5bb82fa55343473cc7a1f6d4833987cc140fa143137e695448"
}
}
}
}
}
}