Personalized User Data

Personalized data is available only after user authorization and includes:

  1. Account

  2. Funding

  3. Transfer

  4. Positions

  5. Orders

  6. Orders Fees

  7. TpSl

Account

To get information about the current user's account, use the GET /api/user/me method.

The exchange signals account state updates via Async API using the user-{userExchangeId} channel.

Async API Account Event Format
interface AccountEvent {
  user: string;
  marginCall: boolean;
  updatedAt: string;
}

Important: The most critical account field is marginCall. If it's true, immediate action should be taken to reduce the risk of account liquidation.

Funding

To get information about the user's funding, use the the GET /api/user/funding method, which returns an array of funding sources.

Funding updates are signaled via Async API on the funding-{userExchangeId} channel.

Async API Funding Event Format
interface FundingEvent {
  user: string;
  coin: string;
  quantity: string;
  updatedAt: string;
}

Important: To ensure consistency on the client, compare funding snapshots by the updatedAt field.

Important: Positions and open orders do not directly affect the user's funding, as they are accounted for in the trading account's funding.

Funding is affected by the following events:

  1. Trading balance top-up

  2. Trading balance withdrawal

  3. Position reduction with non-zero realized PnL

  4. Exchange fee payments

  5. Funding rate payments

  6. Liquidation fee payments to the reserve fund

Transfer

To get information about the user's withdrawal requests, use the GET /api/transfer method with parameters type=transfer-pfutures-balance&status=pending, returning pending withdrawal requests.

Updates are sent via Async API on the transfer-update-{userExchangeId} channel.

Async API Transfer Event Format
interface Transfer {
  id: string;
  user: string;
  type: TransferType;
  coin: string;
  amount: number;
  fee: number;
  status: TransferStatus;
  createdAt: string;
  updatedAt: string;
}

interface TransferEvent extends Transfer {
  exchangeId: number;
}

Important: For consistency, compare snapshots by updatedAt.

Important: Funds requested for withdrawal are locked immediately upon request and cannot be used as margin.

Positions

To get information about the user's open positions, use the GET /api/position method, which returns an array of user positions.

Updates are sent via Async API on the position-{userExchangeId} channel.

Async API Position Event Format
enum Side {
  Buy = 'BUY',
  Sell = 'SELL'
}

interface Position {
  id: string;
  user: string;
  instrument: string;
  side: Side;
  quantity: number;
  avgPrice: number;
  fundingRate: number;
  leverage: number;
  maintenanceMargin: number;
  createdAt: string;
  updatedAt: string;
}

Important: Compare snapshots by updatedAt for consistency.

Orders

To get information about the user's open orders, use the GET /api/order/opened method, returning the user's open orders array.

Order updates are sent via Async API on the order-{userExchangeId} channel.

Async API Order Event Format
enum Side {
  Buy = 'BUY',
  Sell = 'SELL'
}

enum OrderStatus {
  New = "NEW",
  PartiallyFilled = "PARTIALLY_FILLED",
  Filled = "FILLED",
  Cancelled = "CANCELLED",
  Rejected = "REJECTED",
  Expired = "EXPIRED",
  Replaced = "REPLACED",
}

enum OrderGroup {
  Manually = "manually",
  TpSl = "tpsl",
  Liquidation = "liquidation",
  Adl = "adl",
}

enum OrderType {
  Limit = "LIMIT",
  Market = "MARKET",
  Stop = "STOP",
  StopLimit = "STOP_LIMIT",
}

interface Order {
  id: string;
  user: string;
  instrument: string;
  side: Side;
  type: OrderType;
  quantity: number;
  cashQuantity: number;
  limitPrice: number;
  stopPrice: number | null;
  status: OrderStatus;
  rejectedReason?: string;
  unFilledQuantity: number;
  filledAvgPrice: number;
  realizedPnL: number;
  createdAt: string;
  updatedAt: string;
  triggeredAt: string | null;
  group: OrderGroup;
}

Important: Compare snapshots by updatedAt.

Orders Fees

User orders received via the REST API include a fee field indicating the commission paid. Since commission processing is asynchronous, use the Async API channel order-fee-{userExchangeId} to track updates.

Async API Order Fee Event Format
enum OrderFillFeeType {
  Liquidation = "liquidation",
  Adl = "adl",
  Order = "order",
}

interface OrderFillFee {
  id: string;
  user: string;
  order: string;
  fill: string;
  coin: string;
  type: OrderFillFeeType;
  quantity: string;
  createdAt: Date;
}

TpSl

To get information about active TpSl (Take-Profit/Stop-Loss), use the GET /api/tpsl method, returning the user's open TpSls array.

Updates are sent via Async API on the tpsl-{userExchangeId} channel.

Async API TpSl Event Format
enum TpSlStatus {
  WaitOrder = "waitOrder",
  Active = "active",
  Process = "process",
  Triggered = "triggered",
  Done = "done",
  Cancelled = "cancelled",
}

enum TpSlType {
  TakeProfit = "take-profit",
  StopLoss = "stop-loss"
}

enum Side {
  Buy = 'BUY',
  Sell = 'SELL'
}

interface TpSl {
  id: string;
  instrument: string;
  type: cryptoUtils.TpSlType;
  side: cryptoUtils.Side;
  quantity: string; // Zero for full position
  price: string;
  status: TpSlStatus;
  triggerOrder: string | null;
  triggeredQuantity: string;
  cancelledReason: string;
  createdAt: Date;
  updatedAt: Date;
}

Important: Compare snapshots by updatedAt for consistency.

Important: TpSl is not the same as user orders. When triggered, it automatically creates a new market order on behalf of the user. The status field first changes to triggered, and then to done.

Last updated