Account orders and trades

Order

FieldDescription
idThe identifier of the order.
subAccountIdThe identifier of the sub-account having created the order.
userIdThe identifier of the user having created the order.
pairIdThe identifier of the pair of the order book where the order has been created.
clientOrderIdThe identifier sent by the user.
sideSIDE_BUY or SIDE_SELL
quantityThe quantity of the order.
executedQuantityThe quantity that has been executed.
priceThe price of the order.
statusThe current status of the order.
typeThe type of the order.
symbolThe symbol of the order book.
timeInForceThe time in force applied to the order.
createdAtThe time at which the order has been created.
updatedAtThe time at which the order has been updated the latest.

Trade

FieldDescription
idThe identifier of the trade.
orderIdThe identifier of the order.
pairIdThe identifier of the pair of the order book where the order has been created.
subAccountIdThe identifier of the sub-account having created the order.
clientAccountIdThe identifier of the client account.
userIdThe identifier of the user having created the order.
sideSIDE_BUY or SIDE_SELL
quantityThe quantity of the trade.
originalQuantityThe original quantity of the order (<= quantity).
cumulativeQuantityThe executed quantity of the order after the trade (<= quantity).
priceThe price of the trade.
grossAmountThe gross amount of the trade (price * quantity).
transactionFeeThe transaction fees applied to this trade.
swissStampTaxThe swiss stamp tax applied to this trade.
executedAtThe time at which the trade has been executed.
isTakertrue 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.

FieldDescription
drySet to true so the order is not forwarded to the matching engine.
clientOrderIdA randomly generated unique identifier for the order.
subAccountIdThe sub-account identifier.
typeThe type of the order.

- TYPE_LIMIT
- TYPE_POST_ONLY
- TYPE_MARKET
sideThe side of the order.

- SIDE_BUY
- SIDE_SELL
quantityThe quantity of the order.
priceThe price of the order. It can be omitted for market orders.
timeInForceThe 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
transactTimeThe time at which the order has been requested.
symbolThe 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.

FieldDescription
orderIdThe unique identifier of the order
subAccountIdThe 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"
}



  © 2018-2023 Taurus SA. All rights reserved.