Skip to main content

Private Socket Messages

info

Private socket messages are delivered only to authenticated users and contain account-specific events.

UserTrade

Sent when one of the user's order is matched (fully or partially).

Message Type

400

Message

400|{
"id": 1003163838839889300,
"orderId": 433596,
"externalOrderId": "hft-order-id",
"price": 47750,
"timestamp": 1710535431775,
"accountId": "1db31fd2df9642d5b2ecbe09129697d9",
"side": "Sell",
"feeType": "Taker",
"pairSymbol": "ETHTRY",
"amount": -0.001,
"feePercentage": 0.000666667,
"taxPercentage": 0.2,
"orderPrice": 47750,
"numeratorAmount": -0.001,
"denominatorAmount": 47.75,
"feeAmount": -0.03183334925,
"taxAmount": -0.00636666985
}

Field Descriptions

FieldTypeDescription
idInt64Unique trade identifier
orderIdInt64Internal order identifier
externalOrderIdStringClient-provided order identifier
priceDecimalExecution price
timestampInt64Execution timestamp (Unix ms)
accountIdStringAccount identifier
sideStringTrade side (Buy, Sell)
feeTypeStringLiquidity role (Maker, Taker)
pairSymbolStringTrading pair
amountDecimalExecuted base asset quantity
feePercentageDecimalApplied fee rate
taxPercentageDecimalApplied tax rate
orderPriceDecimalOriginal order price
numeratorAmountDecimalBase asset amount
denominatorAmountDecimalQuote asset amount
feeAmountDecimalCalculated fee amount
taxAmountDecimalCalculated tax amount

Enum Values

  • Side

    • 0 : Buy
    • 1 : Sell
  • FeeType

    • 0 : Maker
    • 1 : Taker

Behavior Notes

  • A UserTrade message is sent for each execution event.
  • Partial fills may generate multiple UserTrade messages.
  • This message represents the execution detail, not the full order state.

Order Updated

Sent when an order state changes due to matching or cancellation.

Message Type

402

Message

402|{
"id": 564177,
"accountId": "0009f8b0832c429dac75a7f882ee58f8",
"pairSymbol": "ETHTRY",
"method": "Limit",
"type": "Buy",
"status": "Partial",
"createdAt": "2024-07-11T07:36:40.6483668",
"createdBy": "[email protected]",
"externalOrderId": "hft-order-id",
"feePercentage": 0.0001666666666667,
"taxPercentage": 0.0000000000000000,
"price": 1.5000000000000000,
"initialAmount": 0.5000000000000000,
"currentAmount": 0.3000000000000000,
"matchedAmount": 0.2000000000000000,
"initialTotal": 0.7501250000000000,
"currentTotal": 0.4500750000000000,
"matchedTotal": 0.3000500000000000
}

Field Descriptions

FieldTypeDescription
idInt64Order identifier
accountIdStringAccount identifier
pairSymbolStringTrading pair
methodStringOrder method (Limit, Market)
typeStringOrder side (Buy, Sell)
statusStringCurrent order status
createdAtStringOrder creation timestamp (ISO 8601)
createdByStringCreator identifier
externalOrderIdStringClient-provided order identifier
feePercentageDecimalFee rate
taxPercentageDecimalTax rate
priceDecimalOrder price
initialAmountDecimalOriginal order quantity
currentAmountDecimalRemaining quantity
matchedAmountDecimalExecuted quantity
initialTotalDecimalOriginal total value
currentTotalDecimalRemaining total value
matchedTotalDecimalExecuted total value

Order Status Values

  • Untouched
  • Partial
  • Closed
  • Canceled

For trade-related updates, the status will be either:

  • Partial
  • Closed

Create Order Request

Creates a new order on behalf of the authenticated user.

Message Type

501

Request

501|{
"quantity": "1.00",
"price": "42350.00",
"orderMethod": "Market", //Limit, Market
"orderType": "Buy", //Buy, Sell
"pairSymbol": "BTCTRY",
"externalOrderId": "hft-order-id",
"userEmail": "[email protected]"
}

Request Field Descriptions

FieldTypeDescription
quantityString (Decimal)Order quantity
priceString (Decimal)Order price
orderMethodStringLimit or Market
orderTypeStringBuy or Sell
pairSymbolStringTrading pair symbol
externalOrderIdStringClient-provided unique order identifier
userEmailStringUser identifier (must match authenticated account)

Create Order Response

Message Type

601

Response

601|{
"statusCode": 201,
"content": {
"id": 433598,
"accountId": "0009f8b0832c429dac75a7f882ee58f8",
"pairSymbol": "ETHTRY",
"feePercentage": 0.000083333,
"taxPercentage": 0.2,
"initialAmount": 0.001,
"currentAmount": 0.001,
"matchedAmount": 0,
"price": 10000,
"initialTotal": 10.000999996,
"currentTotal": 10.000999996,
"matchedTotal": 0,
"method": "Limit",
"type": "Buy",
"externalOrderId": "hft-order-id"
}
}

Success Field Descriptions

FieldTypeDescription
statusCodeInt32HTTP-style status code (201 = Created)
content.idInt64Internal order identifier
content.accountIdStringAccount identifier
content.pairSymbolStringTrading pair
content.feePercentageDecimalApplied fee rate
content.taxPercentageDecimalApplied tax rate
content.initialAmountDecimalOriginal order quantity
content.currentAmountDecimalRemaining quantity
content.matchedAmountDecimalExecuted quantity
content.priceDecimalOrder price
content.initialTotalDecimalOriginal order total
content.currentTotalDecimalRemaining order total
content.matchedTotalDecimalExecuted total value
content.methodStringLimit or Market
content.typeStringBuy or Sell
content.externalOrderIdStringClient-provided order identifier

Order Creation Failed

If the request fails, a 601 message is returned with an appropriate statusCode.

601|{
"statusCode": 400,
"content": {
"type": "501",
"title": "NotNullValidator",
"status": 400,
"detail": "PairSymbol is required",
"instance": "CreateOrderRequest"
},
"request": {
"pairSymbol": null,
"quantity": "0.05",
"price": "31733",
"externalOrderId": "hft-order-id",
"orderMethod": "Limit",
"orderType": "Buy",
"userEmail": "[email protected]"
}
}

Behavior Notes

  • statusCode follows HTTP semantics:
    • 201 → Order created
    • 400 → Validation error
    • 429 → Rate limit exceeded
  • For Market orders, the price field may be ignored by the matching engine.
  • If the order is immediately matched, subsequent UserTrade (400) and OrderUpdated (402) messages will follow.
  • externalOrderId user friendly identifier can be used to ensure idempotency on the client side.

Cancel Order Request

Cancels an existing open order.

info

Order cancellation is not guaranteed. If a matching order is already pending or being processed, the order may be executed (partially or fully) before the cancellation takes effect.

Message Type

502

Request

502|{"orderId": 433312}

Cancel Order Response

Message Type

602

Order Cancel Request Accepted (Queued for Processing)

If the cancellation request is successfully accepted for processing:

602|{
"statusCode": 202,
"content": {
"orderId": 433598,
"externalOrderId": "hft-order-id"
}
}

Note: 202 Accepted means the request has been received and queued. The actual cancellation result will be delivered asynchronously via message type 401.

Already Cancelled

If the order is already cancelled:

602|{
"statusCode": 204,
"content": {
"orderId": 433599,
"externalOrderId": "hft-order-id"
}
}

Order Cancel Request Failed

If the cancellation request fails, a 602 message is returned with an appropriate statusCode.

602|{
"statusCode": 404,
"content": {
"type": "502",
"title": "OrderNotFound",
"status": 404,
"detail": "Order is not found.",
"instance": "CancelOrderRequest"
},
"request": {
"orderId": 98984984985
}
}

Order Cancelled

When the order is successfully cancelled, the server sends a private socket event:

Message Type

401

Message

401|{
"id":457889,
"accountId":"bdf248d5337d486cbed3c85a558d749f",
"pairSymbol":"AAVETRY",
"feePercentage":0.0001000000000000,
"taxPercentage":0.0000000000000000,
"initialAmount": 0.001,
"currentAmount": 0.001,
"matchedAmount": 0,
"price": 10000,
"initialTotal": 10.000999996,
"currentTotal": 10.000999996,
"matchedTotal": 0,
"method": "Limit",
"type": "Buy",
"status": "Canceled",
"externalOrderId": "hft-order-id",
"createdAt":"2024-09-10T08:31:54.3534227",
"updatedAt":"2024-09-10T08:31:56.6866329Z"
}

Field Descriptions

FieldTypeDescription
idInt64Unique order identifier
accountIdStringAccount identifier
pairSymbolStringTrading pair symbol
feePercentageDecimalApplied fee rate for the order
taxPercentageDecimalApplied tax rate
initialAmountDecimalOriginal order quantity
currentAmountDecimalRemaining (unmatched) quantity
matchedAmountDecimalExecuted quantity
priceDecimalOrder price
initialTotalDecimalOriginal total order value
currentTotalDecimalRemaining total order value
matchedTotalDecimalExecuted total value
methodStringOrder method (Limit, Market)
typeStringOrder side (Buy, Sell)
statusStringOrder status (Untouched, Partial, Closed, Canceled)
externalOrderIdStringClient-provided order identifier
createdAtString (ISO 8601)Order creation timestamp (UTC)
updatedAtString (ISO 8601)Last update timestamp (UTC)

Order Status Values

  • Untouched
  • Partial
  • Closed
  • Canceled

For a successful cancellation, the status will be: Canceled


Cancel All Request

info

Order cancellation is not guaranteed. If a matching order is already pending or being processed, the order may be executed (partially or fully) before the cancellation takes effect.

Request

The Cancel All request must be sent using only one of the following fields:

  • pairSymbol
  • pairSymbols
  • denominatorSymbol

These fields cannot be used together in the same request.

The Cancel All Request optionally contains following fields:

  • side

1. Cancel All Open Orders

504|{}

Cancels all open orders for the account.

2. Cancel by Single Pair Request

504|{
"pairSymbol": "BTCUSDT"
}

Cancels all open orders for a single trading pair.

3. Cancel by Multiple Pairs Request

504|{
"pairSymbols": ["BTCUSDT", "ETHUSDT"]
}

Cancels open orders for multiple trading pairs.

Rules

  • Maximum 20 pairs
  • If more than 20 pairs are provided → request rejected
  • If any pair symbol is invalid → request rejected

4. Cancel by Denominator Request

504|{
"denominatorSymbol": "USDT"
}

Cancels open orders for all pairs under a specific denominator.

Rules

  • Accepted values: USDT, TRY
  • Any other value → request rejected

5. Cancel by Side Request

504|{
"side": 0
}
504|{
"side": 1
}

Rules:

  • Accepted values for side:
    • 0 -> Buy
    • 1 -> Sell
    • Accepts Buy and Sell as case insensitive string values.
  • Any other value is rejected

Cancel All Response

Message Type

604

Successful Response

If the request is accepted for processing:

401|{
"statusCode":202,
"content":{
"orderIds": [""],
"externalOrderIds": [""],
"pairSymbol": "",
"pairSymbols": [""],
"denominatorSymbol": "",
"side": 0
}
}

Error Response

All error responses follow the same schema used in other private requests (601, 602).

  • statusCode: 400
  • The content field follows the same error schema and semantics as the Cancel Request API
604|{
"statusCode": 400,
"content": {
"type": "504",
"title": "ErrorTitle",
"status": 400,
"detail": "Error description",
"instance": "CancelAllRequest"
},
"request": {
...
}
}

Error Scenarios

HTTP CodeTitleDescription
400InvalidCancelAllRequestMultiple filter fields were used together
400PairLimitExceededMore than 20 pair symbols provided
400InvalidSymbolOne or more pair symbols are invalid
400InvalidDenominatorSymbolDenominator symbol is invalid
429RateLimitExceededOnly one cancel request per second is allowed
500CancelAllFailedInternal processing error

Behavior Summary

Flow:

  1. Client sends 504
  2. Server returns 604
  3. If accepted, server emits multiple 401 order update events
  4. Cancellation is completed asynchronously

Get All Open Orders

This request is used to fetch open orders. You can optionally filter by pairSymbol and/or statuses.

  • If you want to retrieve all orders for all symbols, set "ps": null.
  • If you want to include all order statuses (only Untouched and Partial are supported), send "st": [].

Data source: in-memory

Examples:

503|{"ps": "BTCTRY", "st": ["Untouched", "Partial"]}
503|{"ps": null, "st": []}
  • Both ps (Pair Symbol) and st (Statuses) are optional.
  • Only Untouched and Partial orders are returned from this channel.

The response is sent through channel 603. It returns an array of open orders matching the given filters.

603|[
{
"id": "13978706", // Id
"aid": "602bc0e03fda43a1a1a203a649aa396d", // AccountId
"ps": "BTCUSDT", // PairSymbol
"fep": "0.001200", // FeePercentage
"txp": "0.000000", // TaxPercentage
"ia": "0.0549003600000000", // InitialAmount
"ca": "0.0043732200000000", // CurrentAmount
"ma": "0.0505271400000000", // MatchedAmount
"p": "89326.7900000000000000", // Price
"m": "Limit", // Method
"t": "Sell", // Type
"st": "Partial", // Status
"eid": "0c48ec75-cd3f-4bbd-95eb-13fb8fe1c3b0", // ExternalOrderId
"crt": "2025-02-25T09:35:37.303Z", // CreatedAt
"crb": "[email protected]" // CreatedBy
}
]

Field Descriptions

FieldTypeDescription
idstringUnique identifier for the order. This ID is generated by the system and is used to reference the specific order.
aidstringAccount ID associated with the order. Identifies the user account that placed the order.
psstringTrading pair symbol. Example: BTCUSDT. Indicates the pair of assets being traded.
fepstringFee percentage applied to the order, represented as a decimal. Example: 0.001200 (which equals 0.12%).
txpstringTax percentage applied to the order, represented as a decimal. Example: 0.000000 (indicating no tax).
iastringInitial amount specified when the order was created. This is the total quantity the user intended to trade.
castringCurrent amount remaining in the order. This reflects the quantity that has not yet been filled.
mastringMatched amount of the order. Represents the quantity that has already been executed.
pstringPrice at which the order was placed. Indicates the price per unit of the asset.
mstringOrder method. Possible values: Limit, Market. Specifies how the order is executed.
tstringOrder type. Possible values: Buy, Sell. Indicates whether the order is a buying or selling action.
ststringOrder status. Possible values: Untouched, Partial, Filled, Cancelled. Reflects the current state of the order.
eidstringExternal order ID, represented as a UUID. This may be used for tracking orders across different systems.
crtstringTimestamp when the order was created, in ISO 8601 format (e.g., 2025-02-25T09:35:37.303Z).
crbstringEmail address of the user who created the order.

Account & Transfer Events (Private Socket)

1. Deposit Confirmed

Sent when a deposit is successfully credited to the user's account.

Message Type

404

Message

404|{
"id": "string",
"accountId": "string",
"assetId": "string",
"assetSymbol": "string",
"address": "string",
"memoTag": "string",
"amount": "string",
"transactionHash": "string",
"status": "Unknown",
"createdAt": "2025-09-03T13:51:39.068Z",
"createdBy": "string"
}

2. Withdrawal Confirmed

Sent when a withdrawal request is successfully completed.

Message Type

405

Message

405|{
"id": "string",
"accountId": "string",
"assetId": "string",
"assetSymbol": "string",
"address": "string",
"memoTag": "string",
"amount": "string",
"feeAmount": "string",
"transactionHash": "string",
"status": "Unknown",
"externalTransactionId": "string",
"createdAt": "2025-09-03T13:49:48.864Z",
"createdBy": "string",
"updatedAt": "2025-09-03T13:49:48.864Z"
}

3. Withdrawal Failed

Sent when a withdrawal request fails.

Message Type

406

Message

406|{
"id": "string",
"accountId": "string",
"assetId": "string",
"assetSymbol": "string",
"address": "string",
"memoTag": "string",
"amount": "string",
"feeAmount": "string",
"transactionHash": "string",
"status": "Unknown",
"externalTransactionId": "string",
"createdAt": "2025-09-03T13:49:48.864Z",
"createdBy": "string",
"updatedAt": "2025-09-03T13:49:48.864Z"
}

4. Internal Fund Transfer

Sent when an internal balance transfer occurs between accounts.

Message Type

403

Message

403|{
"id": "string",
"senderAccountId": "string",
"receiverAccountId": "string",
"amount": 0,
"brokerCurrencyId": "string",
"corporateId": "string",
"status": "Unknown",
"failReason": "string",
"createdAt": "2025-09-03T14:02:03.216Z",
"createdBy": "string",
"updatedAt": "2025-09-03T14:02:03.216Z",
"updatedBy": "string"
}

Common Field Descriptions

FieldTypeDescription
idStringUnique transaction identifier
accountIdStringUser account identifier
assetIdStringInternal asset identifier
assetSymbolStringAsset symbol (e.g., BTC, USDT)
addressStringBlockchain address
memoTagStringMemo / Tag (if applicable)
amountDecimal (String)Transaction amount
feeAmountDecimal (String)Network fee amount
transactionHashStringBlockchain transaction hash
externalTransactionIdStringExternal reference ID
statusStringCurrent transaction status
createdAtStringCreation timestamp (ISO 8601, UTC)
updatedAtStringLast update timestamp
failReasonStringFailure description (if applicable)

Status Values

Depending on the event type:

  • Pending
  • Confirmed
  • Failed
  • Completed

Behavior Notes

  • These messages are event-driven.
  • They are sent only to the related authenticated account.
  • Clients should rely on the id or externalTransactionId field for idempotent processing.