Account orders and trades
Order
Field | Description |
---|---|
id | The identifier of the order. |
subAccountId | The identifier of the sub-account having created the order. |
userId | The identifier of the user having created the order. |
pairId | The identifier of the pair of the order book where the order has been created. |
clientOrderId | The identifier sent by the user. |
side | SIDE_BUY or SIDE_SELL |
quantity | The quantity of the order. |
executedQuantity | The quantity that has been executed. |
price | The price of the order. |
status | The current status of the order. |
type | The type of the order. |
symbol | The symbol of the order book. |
timeInForce | The time in force applied to the order. |
createdAt | The time at which the order has been created. |
updatedAt | The time at which the order has been updated the latest. |
Trade
Field | Description |
---|---|
id | The identifier of the trade. |
orderId | The identifier of the order. |
pairId | The identifier of the pair of the order book where the order has been created. |
subAccountId | The identifier of the sub-account having created the order. |
clientAccountId | The identifier of the client account. |
userId | The identifier of the user having created the order. |
side | SIDE_BUY or SIDE_SELL |
quantity | The quantity of the trade. |
originalQuantity | The original quantity of the order (<= quantity). |
cumulativeQuantity | The executed quantity of the order after the trade (<= quantity). |
price | The price of the trade. |
grossAmount | The gross amount of the trade (price * quantity). |
transactionFee | The transaction fees applied to this trade. |
swissStampTax | The swiss stamp tax applied to this trade. |
executedAt | The time at which the trade has been executed. |
isTaker | true if the order has taken liquidity from the order book. |
Subscribe
Request
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "tdx:subscribe",
"a": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.LwimMJA3puF3ioGeS-tfczR3370GXBZMIL-bdpu4hOU"
}
Replies
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "tdx:subscription_received"
}
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "order",
"d" : {
"id": "996f8f4f-3f51-46e0-a253-1e86d0958913",
"subAccountId": "8cc80065-6679-4426-9f96-d7023220226c",
"userId": "aa141d5c-bf89-473c-a16a-63568679e233",
"pairId": "e388d756-c70e-4516-b057-947049553138",
"clientOrderId": "accb7075-fc4d-4e40-8213-269ab523472c",
"side": "SIDE_BUY",
"quantity": "5",
"executedQuantity": "0",
"price": "11.18",
"status": "STATUS_NEW",
"type": "TYPE_LIMIT",
"symbol": "XTZ/CHF",
"timeInForce": "TIME_IN_FORCE_GTC",
"createdAt": "2024-12-04T12:14:31.182276080Z",
"updatedAt": "2024-12-04T12:14:31.198953329Z"
}
}
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "trade",
"d": {
"id": "0670a254-512c-47fe-9756-3ebc888a92a2",
"orderId": "3c31cfd6-483a-4cef-83e8-3de60e5118dd",
"pairId": "e388d756-c70e-4516-b057-947049553138",
"subAccountId": "8cc80065-6679-4426-9f96-d7023220226c",
"clientAccountId": "6d15f6aa-84dd-4284-b3f5-7f56ea039c69",
"userId": "aa141d5c-bf89-473c-a16a-63568679e233",
"side": "SIDE_SELL",
"quantity": "5",
"originalQuantity": "5",
"cumulativeQuantity": "5",
"price": "11.18",
"grossAmount": "55.9",
"transactionFee": "0.22",
"swissStampTax": "0",
"executedAt": "2024-12-04T12:14:38.478394534Z",
"isTaker": true
}
}
Unsubscribe
Order and trade updates can be stopped by unsubscribing to the topic.
Request
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "tdx:unsubscribe"
}
Replies
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "tdx:unsubscribe_succeeded"
}
Create an order
Prerequisite
A valid subscription for subaccount-orders
must be active.
Request
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "tdx:order_create",
"a": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.LwimMJA3puF3ioGeS-tfczR3370GXBZMIL-bdpu4hOU",
"d": {
"dry": false,
"order": {
"clientOrderId": "ec1d4067-6b8a-4463-8627-2686d83c77d4",
"subAccountId": "8cc80065-6679-4426-9f96-d7023220226c",
"type": "TYPE_LIMIT",
"side": "SIDE_BUY",
"quantity": "0.001",
"price": "95261.64",
"timeInForce": "TIME_IN_FORCE_GTC",
"transactTime": "2024-11-14T12:42:36Z",
"symbol": "BTC/USD"
}
}
}
All fields are required.
Field | Description |
---|---|
dry | Set to true so the order is not forwarded to the matching engine. |
clientOrderId | A randomly generated unique identifier for the order. |
subAccountId | The sub-account identifier. |
type | The type of the order. - TYPE_LIMIT - TYPE_POST_ONLY - TYPE_MARKET |
side | The side of the order. - SIDE_BUY - SIDE_SELL |
quantity | The quantity of the order. |
price | The price of the order. It can be omitted for market orders. |
timeInForce | The time in force to be applied to the order. - TIME_IN_FORCE_DAY - TIME_IN_FORCE_GTC - TIME_IN_FORCE_IOC - TIME_IN_FORCE_FOK |
transactTime | The time at which the order has been requested. |
symbol | The symbol of the pair to submit the order. |
Replies
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "tdx:order_create_received"
}
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "tdx:order_create_submitted"
}
Cancel an order
Prerequisite
A valid subscription for subaccount-orders
must be active.
Request
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "tdx:order_cancel",
"a": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.LwimMJA3puF3ioGeS-tfczR3370GXBZMIL-bdpu4hOU",
"d": {
"orderId": "8e896189-136f-4d54-833f-0bfc924eaf02",
"subAccountId": "8cc80065-6679-4426-9f96-d7023220226c"
}
}
All fields are required.
Field | Description |
---|---|
orderId | The unique identifier of the order |
subAccountId | The unique identifier of the sub-account. |
Replies
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "tdx:order_cancel_received"
}
{
"t": "8cc80065-6679-4426-9f96-d7023220226c@subaccount-orders",
"e": "tdx:order_cancel_submitted"
}
Cancel on disconnect
It is possible to enable the cancellation of all orders once the stream gets disconnected.
Request
{
"e": "tdx:cancel_on_disconnect",
"a": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.LwimMJA3puF3ioGeS-tfczR3370GXBZMIL-bdpu4hOU"
}
Reply
{
"e": "tdx:cancel_on_disconnect_succeeded"
}
Updated 25 days ago