OpenXSwitch - Webhook Trade Event
Webhooks for trade events notify you about the status of trade-related transactions within the OpenXSwitch system.
- Parent Method:
trade
- Sub-Methods:
live
: Triggered when a trade is created and actively ongoing.cancelled
: Triggered when a trade is cancelled before completion.done
: Triggered when a trade is fully executed.
Example Payload for Trade:
{
"requestId": "ab67d4be56d4d549f59b92a17fd71b",
"method": "trade.live",
"params": {
"id": "1234567890",
"clientTxId": "client-tx-abc-123",
"workspaceId": "656abf1e4b5f5e0012345678",
"walletId": "656abf1e4b5f5e0098765432",
"symbol": "TRXUSDT",
"price": 0,
"quantity": 1.5,
"orderType": "limit",
"side": "buy",
"status": "live",
"priceAvg": 44999.75,
"base": {
"baseCoin": "TRX",
"baseVolume": 0,
},
"quote": {
"quoteCoin": "USDT",
"quoteVolume": 0,
},
"fee": {
"feeCoin": "TRX",
"totalFee": 0,
},
"requestWindow": null,
"cancelReason": null,
"createdAt": "2025-05-12T08:30:00.000Z",
"updatedAt": "2025-05-12T08:30:01.000Z",
"completedAt": null,
"wallet": {
"id": "6812b103908d2d0d49c7ff79",
"clientUserId": null,
"email": "email@openxswitch.com",
"name": "openxswitch-subwallet",
"assets":[
{
"coin": "USDT",
"balance": 9,
"frozen": 0,
"updatedAt": "2025-05-04T23:58:20.494Z"
},
{
"coin": "TRX",
"balance": 26.043,
"frozen": 0,
"updatedAt": "2025-05-04T23:58:20.494Z"
}
],
"isSubWallet": true
}
}
}
{
"requestId": "ab67d4be56d4d549f59b92a17fd71b",
"method": "trade.done",
"params": {
"id": "1234567890",
"clientTxId": "client-tx-abc-123",
"workspaceId": "656abf1e4b5f5e0012345678",
"walletId": "656abf1e4b5f5e0098765432",
"symbol": "TRXUSDT",
"price": 45000.5,
"quantity": 1.5,
"orderType": "limit",
"side": "buy",
"status": "done",
"priceAvg": 44999.75,
"base": {
"baseCoin": "TRX",
"baseVolume": 1.5,
},
"quote": {
"quoteCoin": "USDT",
"quoteVolume": 67499.63,
},
"fee": {
"feeCoin": "USDT",
"totalFee": 0.63,
},
"requestWindow": null,
"cancelReason": null,
"createdAt": "2025-05-12T08:30:00.000Z",
"updatedAt": "2025-05-12T08:30:01.000Z",
"completedAt":"2025-05-12T08:30:01.000Z",
"wallet": {
"id": "6812b103908d2d0d49c7ff79",
"clientUserId": null,
"email": "email@openxswitch.com",
"name": "openxswitch-subwallet",
"assets":[
{
"coin": "USDT",
"balance": 9,
"frozen": 0,
"updatedAt": "2025-05-04T23:58:20.494Z"
},
{
"coin": "TRX",
"balance": 26.043,
"frozen": 0,
"updatedAt": "2025-05-04T23:58:20.494Z"
}
],
"isSubWallet": true
}
}
}
{
"requestId": "ab67d4be56d4d549f59b92a17fd71b",
"method": "trade.cancelled",
"params": {
"id": "1234567890",
"clientTxId": "client-tx-abc-123",
"workspaceId": "656abf1e4b5f5e0012345678",
"walletId": "656abf1e4b5f5e0098765432",
"symbol": "TRXUSDT",
"price": 45000.5,
"quantity": 1.5,
"orderType": "limit",
"side": "buy",
"status": "cancelled",
"priceAvg": 44999.75,
"base": {
"baseCoin": "TRX",
"baseVolume": 1.5,
},
"quote": {
"quoteCoin": "USDT",
"quoteVolume": 67499.63,
},
"fee": {
"feeCoin": "USDT",
"totalFee": 0.63,
},
"requestWindow": null,
"cancelReason": "....",
"createdAt": "2025-05-12T08:30:00.000Z",
"updatedAt": "2025-05-12T08:30:01.000Z",
"completedAt": null,
"wallet": {
"id": "6812b103908d2d0d49c7ff79",
"clientUserId": null,
"email": "email@openxswitch.com",
"name": "openxswitch-subwallet",
"assets":[
{
"coin": "USDT",
"balance": 9,
"frozen": 0,
"updatedAt": "2025-05-04T23:58:20.494Z"
},
{
"coin": "TRX",
"balance": 26.043,
"frozen": 0,
"updatedAt": "2025-05-04T23:58:20.494Z"
}
],
"isSubWallet": true
}
}
}
Reference
Field | Description | Type |
---|---|---|
requestId | Unique ID for the WebSocket request | string |
method | WebSocket method/event name (trade.live , ...) | string |
params.id | Unique internal order ID | string |
params.clientTxId | Client-supplied transaction ID | string |
params.workspaceId | Workspace ID associated with the trade | string |
params.walletId | ID of the wallet or sub-wallet | string |
params.symbol | Trading pair symbol (e.g., TRXUSDT ) | string |
params.price | Order price | number |
params.quantity | Quantity (amount) placed in the order | number |
params.orderType | Order type (limit , market ) | string |
params.side | Order side: buy or sell | string |
params.status | Trade/order status (live , cancelled , done ) | string |
params.priceAvg | Average price of filled amount | number |
params.base.baseCoin | The base coin being bought or sold | string |
params.base.baseVolume | Volume of the base coin | number |
params.quote.quoteCoin | The quote coin (payment currency, e.g., USDT) | string |
params.quote.quoteVolume | Volume of the quote coin involved | number |
params.fee.feeCoin | Coin in which the fee was charged, coin obtained from the transaction | string |
params.fee.totalFee | Total fee charged for the trade | number |
params.requestWindow | Time window in unix milliseconds within which the request is valid. | string |
params.cancelReason | Reason for cancellation (if applicable) | string |
params.createdAt | ISO timestamp when the order was created | string (ISO) |
params.updatedAt | ISO timestamp when the order was last updated | string (ISO) |
params.completedAt | ISO timestamp when the order was completed (if filled) | string |
params.wallet.id | Wallet ID (redundant with walletId , likely the master wallet ID) | string |
params.wallet.clientUserId | Optional external user identifier for the wallet | string or null |
params.wallet.email | Email address associated with the wallet | string |
params.wallet.name | Display name of the wallet | string |
params.wallet.assets | List of assets and their balances after the trade | array of objects |
params.wallet.assets[].coin | Coin symbol (e.g., USDT, TRX) | string |
params.wallet.assets[].balance | Balance of the coin after the trade | number |
params.wallet.assets[].frozen | Frozen amount of the coin (if any) | number |
params.wallet.assets[].updatedAt | Last update time of the asset balance | string (ISO datetime) |
params.wallet.isSubWallet | Whether the wallet is a subwallet | boolean |