Subscribing to the order updates provides real-time data on changes made to the orders placed by the account.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "portfolio.order_updates.subscribe",
  "params": {}
}

Parameters:

  • with_snapshot: Whether to include the snapshot in the response. It may incur additional API credit spending.
  • from_block_id: Specifies the block from which to start sending the events. See more information about this in the Managing Data Integrity section.

Snapshots

The snapshot format is the same as v1/portfolio/history/orders endpoint response (for events) and v1/portfolio/orders (for orders). Upon subscription, the lists of the current active orders and the latest order update events are provided:

{
    "jsonrpc": "2.0",
    "method": "portfolio.order_updates.snapshot",
    "params": {
        "data": {
            "orders": [
                {
                    "contract_id": 6,
                    "contract_info": {
                        "contract_id": 6,
                        "delivery_date": "2024-09-17T00:00:00Z",
                        "lot_decimals": -2,
                        "name": "ETH",
                        "symbol": "ETH-17SEP24"
                    },
                    "created_at": "2024-09-04T10:53:36Z",
                    "customer_order_id": "",
                    "filled_quantity_asset": "1.02",
                    "filled_quantity_contracts": "0.0102",
                    "filled_quantity_steps": "102",
                    "limit_price": "2750",
                    "opened_quantity_asset": "17.16",
                    "opened_quantity_contracts": "17.16",
                    "opened_quantity_steps": "1716",
                    "order_id": 10527,
                    "ordered_quantity": "18.18",
                    "reduce_only": false,
                    "reduced_quantity_asset": "0",
                    "reduced_quantity_contracts": "0",
                    "reduced_quantity_steps": "0",
                    "side": "sell",
                    "time_in_force": "GTC",
                    "updated_at": "2024-09-05T11:16:20Z"
                }
            ],
            "events": [
                {
                    "contract_id": 6,
                    "contract_info": {
                        "contract_id": 6,
                        "delivery_date": "2024-09-17T00:00:00Z",
                        "lot_decimals": -2,
                        "name": "ETH",
                        "symbol": "ETH-17SEP24"
                    },
                    "created_at": "2024-09-06T15:41:15Z",
                    "customer_order_id": "",
                    "executed_price": "2250",
                    "fees": "0",
                    "id": 10526,
                    "limit_price": "2250",
                    "opened_quantity": "19.22",
                    "quantity_assets": "2",
                    "quantity_contracts": "2",
                    "quantity_steps": "200",
                    "reduce_only": false,
                    "reject_reason": "",
                    "role": "maker",
                    "side": "buy",
                    "time_in_force": "GTC",
                    "tx_info": {
                        "block_timestamp": "2024-09-06T15:41:15Z",
                        "event_id": "699091-3",
                        "transaction_hash": "0x4d5126ddcafd63b04bb447f9931844d2c8d04c267f7381c2893a56dd293ac47d"
                    },
                    "type": "order_filled"
                }
            ]
        }
    }
}

Events

The event format is the same as v1/portfolio/history/orders endpoint response. Subscribers receive real-time events whenever an order is accepted, posted, filled, canceled, reduced, or terminated. Each event provides information about the change that occurred:

{
    "jsonrpc": "2.0",
    "method": "portfolio.order_updates.event",
    "params": {
        "data": {
            "contract_id": 1,
            "contract_info": {
                "contract_id": 1,
                "delivery_date": "2024-09-17T00:00:00Z",
                "lot_decimals": -3,
                "name": "BTC",
                "symbol": "BTC-17SEP24"
            },
            "created_at": "2024-09-04T10:26:57Z",
            "customer_order_id": "",
            "executed_price": "0",
            "fees": "0",
            "id": 10313,
            "limit_price": "0",
            "opened_quantity": "1",
            "quantity_assets": "1",
            "quantity_contracts": "1",
            "quantity_steps": "1000",
            "reduce_only": false,
            "reject_reason": "",
            "role": "",
            "side": "sell",
            "time_in_force": "IOC",
            "tx_info": {
                "block_timestamp": "2024-09-04T10:26:57Z",
                "event_id": "603674-0",
                "transaction_hash": "0x1bb40ef9e66510e27430584c923d5cf94d6f039465b7d1d4fe2eaed16ccc2fdf"
            },
            "type": "order_accepted"
        }
    }
}