Private Channels

Authentication

You can use JWT-token, mentioned above, that is used for access to private API to authorize within web socket connection. To make it send next message: ["auth", "Generated JWT Token"]

cli = clients.ALPAuthClient(
    key='**API_KEY**',
    secret='**API_KEY**',
)
await client.auth(cli)

Account Order Update

After the authorization, you will receive updates of your orders on trades.

Order Fields

  • Type: The type of the message is set to "o" indicating that it's an order event.
  • Timestamp: The Unix timestamp of the message.
  • Order Id: The unique identifier for the order.
  • Symbol: The trading symbol associated with the order.
  • Side: The side of the order (e.g., 'buy' or 'sell').
  • Order Type: The type of order (e.g., 'limit' or 'market').
  • Base Amount: The quantity of the base currency in the order.
  • Limit Price: The specified price for a limit order.
  • Amount Unfilled: The quantity of the order that remains unfilled.
  • Amount Filled: The quantity of the order that has been filled.
  • Amount Cancelled: The quantity of the order that has been cancelled.
  • Value Filled: The total value of the order that has been filled.
  • Price Avg: The average price at which the order has been filled.
  • Done At: The timestamp indicating when the order was completed.
  • Status: The current status of the order (e.g., 'open', 'completed', 'cancelled').
  • Quote Amount: The amount in the quote currency.
  • Wallet Type: The balance type associated with the order (e.g., 'spot', 'margin').
  • Stop Price: The specified stop price for a stop order.
  • Stop Operator: The operator for the stop price (e.g., 'greater_than', 'less_than').

Order Example

[
  "o",
  1694178331,
  12345,
  "BTC_USDT",
  "SELL",
  "LIMIT",
  "0.5",
  "48000.00",
  "0.2",
  "0.3",
  "0.0",
  "14400.00",
  "48000.00",
  1631386242.567,
  "FILLED",
  "14400.00",
  "SPOT",
  "0.00",
  ""
]

Account Trade Update

After authorization, you will receive updates when your account is involved in a trade (as buyer or seller).

Trade Account Fields

  • Type: The type of the message is set to "ta" indicating a trade account event.
  • Timestamp: The Unix timestamp of the trade event.
  • Trade ID: The unique identifier of the match/trade.
  • Symbol: The trading pair symbol (e.g., "BTC_USDT").
  • Amount: The trade amount as a decimal string.
  • Price: The trade price as a decimal string.
  • Side: The side of your participation: "buy" or "sell".

Trade Account Example

[
  "ta",
  1694178331,
  "293107798",
  "BTC_USDT",
  "0.20285052",
  "25705.02000000",
  "buy"
]

Account Balance Update

After authorization, you will receive updates of your balances after each change.

Balance Fields

  • Type: The type of the message is set to "w" indicating that it's a balance update event.
  • Timestamp: The Unix timestamp of the message.
  • Code: The currency code (e.g., "USDT").
  • Wallet Type: The balance type (e.g., 'spot', 'margin').
  • Symbol: The symbol of the margin isolated pair (empty for other types).
  • Balance: The current balance amount.
  • Reserve: The reserved (locked) amount.

Balance Example

[
  "w",
  1694178331,
  "USDT",
  "SPOT",
  "",
  "5.0",
  "1.0"
]