Skip to main content
Version: 1.1.1

Private Stream Events (v1.1.1)

This page documents the private WebSocket stream events for Order, Trade, and Withdraw for version 1.1.1. These events are pushed in real-time from the server to authenticated clients connected to the private ranger endpoint:

wss://dev.yimmit.com/api/v3/ranger/private

Authentication headers are required. See WebSocket Streams for connection and authentication details.


1. Order Event (order)

When Is It Triggered?

The order event is published to the authenticated user's private stream in the following cases:

TriggerDescription
Order CreatedA new limit / stop-loss / take-profit order is submitted
Order UpdatedOrder state changes (e.g. pendingwait)
Order CancelledOrder moves to cancel state
Order CompletedOrder moves to done state (fully filled)

Note: market type orders only trigger the order event when their state becomes done.
Stop-loss and take-profit orders (stop_loss_limit, take_profit_limit, stop_limit) also trigger events on state changes.

Order States

StateValueDescription
pending0Order submitted but not yet active
wait100Order is active and waiting to be filled
done200Order has been fully executed
cancel-100Order has been cancelled
reject-200Order was rejected
under_review-300Order is under manual review
in_review300Order is currently being reviewed

WSS Response Payload

{
"order": {
"id": 23515,
"market": "ethusdc",
"kind": "bid",
"side": "buy",
"bid": "usdc",
"ask": "eth",
"ord_type": "limit",
"price": "2021.97",
"avg_price": "0.0",
"state": "wait",
"origin_volume": "0.0029",
"remaining_volume": "0.0029",
"executed_volume": "0.0",
"at": 1773294648,
"created_at": 1773294648,
"updated_at": 1773294648,
"trades_count": 0,
"maker_fee": "0.0015",
"stop_price": "0.0",
"stop_loss_status": null,
"price_precision": 2,
"amount_precision": 4,
"total_fee": "0.0"
}
}

Payload Fields

FieldTypeDescription
idintegerUnique order ID
marketstringMarket pair (e.g. btcusdt)
kindstringbid (buy) or ask (sell)
sidestringbuy or sell
bidstringQuote currency (e.g. usdt)
askstringBase currency (e.g. btc)
ord_typestringOrder type: limit, market, stop_loss_limit, take_profit_limit, stop_limit
pricestringLimit price (null for market orders)
avg_pricestringAverage execution price
statestringCurrent order state (see table above)
origin_volumestringOriginal order quantity
remaining_volumestringQuantity still to be filled
executed_volumestringQuantity already filled
atintegerUnix timestamp (seconds)
created_atintegerUnix timestamp of order creation (seconds)
updated_atintegerUnix timestamp of last update (seconds)
trades_countintegerNumber of trades that filled this order
maker_feestringMaker fee rate
stop_pricestringStop trigger price (for stop orders)
stop_loss_statusstringnull
price_precisionintegerDecimal precision for price display
amount_precisionintegerDecimal precision for amount display
total_feestringCumulative fee charged so far

Frontend Behaviour

When the order event is received:

  • For market orders in done state → wallet balance is refreshed
  • For all other orders → the open orders list and order history are updated in real-time

2. Trade Event (trade)

When Is It Triggered?

The trade event is published to both the maker and the taker whenever a trade is executed (i.e., two orders are matched). Each party receives a personalised payload that includes their own side and order_id.

A separate public trade event is also broadcast to all subscribers of {marketId}.trades.

ChannelRecipientEvent Key
Private (/private)Maker of the tradetrade
Private (/private)Taker of the tradetrade
Public (/public)All market subscribers{marketId}.trades

WSS Response — Private (trade)

Sent to the maker and taker separately with their own perspective:

{
"trade": {
"id": 789,
"price": "50000.0",
"amount": "0.01",
"total": "500.0",
"market": "btcusdt",
"side": "buy",
"taker_type": "buy",
"created_at": 1741400000,
"order_id": 23515
}
}

Private Trade Payload Fields

FieldTypeDescription
idintegerUnique trade ID
pricestringExecution price
amountstringQuantity traded
totalstringTotal value (price × amount)
marketstringMarket pair (e.g. btcusdt)
sidestringThis user's side: buy or sell
taker_typestringThe taker's side: buy or sell
created_atintegerUnix timestamp of trade execution (seconds)
order_idintegerID of this user's order that was matched

WSS Response — Public ({marketId}.trades)

Broadcast to all users subscribed to btcusdt.trades (or any market):

{
"btcusdt.trades": {
"trades": [
{
"tid": 789,
"taker_type": "buy",
"date": 1741400000,
"price": "50000.0",
"amount": "0.01"
}
]
}
}

Public Trade Payload Fields

FieldTypeDescription
tidintegerUnique trade ID
taker_typestringThe taker's side: buy or sell
dateintegerUnix timestamp of trade (seconds)
pricestringExecution price
amountstringQuantity traded

3. Withdraw Event (withdraw)

When Is It Triggered?

The withdraw event is published to the authenticated user's private stream whenever the withdrawal's state changes through the AASM state machine:

AASM EventFrom StateTo StateWSS Published?
acceptpreparedaccepted✅ Yes
cancelprepared, accepted, skippedcanceled✅ Yes
rejectto_reject, accepted, confirming, under_reviewrejected✅ Yes
processaccepted, skipped, errored, failedprocessing✅ Yes
dispatchprocessing, under_reviewconfirming✅ Yes
donedeposited, acceptedsucceed (fiat only)✅ Yes
successconfirming, deposited, errored, under_reviewsucceed✅ Yes

Withdraw States

StateDescription
preparedWithdrawal requested, awaiting acceptance
acceptedAccepted and funds locked
processingBeing sent on-chain
confirmingTransaction submitted, waiting for block confirmations
under_reviewFlagged for manual review
succeedWithdrawal completed successfully
canceledCancelled by the user
rejectedRejected by admin
failedProcessing failed
erroredA processing error occurred
skippedTemporarily skipped (will be retried)

WSS Response Payload

{
"withdraw": {
"id": 55,
"currency": "usdt",
"amount": "3.0",
"fee": "1.2",
"blockchain_txid": "de9723b3-97e3-43fa-adab-5aa0ec5208d6",
"type": "Withdraws::Coin",
"state": "processing",
"protocol": "sepolia",
"blockchain_key": "eth-testnet",
"transaction_type": "external",
"tid": "TID731049B2E6",
"rid": "0x76dcd3dafb5f7229542f0580d9c5a1612486a42b",
"created_at": "2026-03-12 05:51:23 UTC",
"updated_at": "2026-03-12 05:51:25 UTC"
}
}

Payload Fields

FieldTypeDescription
idintegerUnique withdrawal ID
currencystringCurrency code (e.g. usdt, btc)
amountstringWithdrawal amount (after fee deduction)
feestringNetwork/withdrawal fee
blockchain_txidstringnull
typestringWithdraws::Coin (crypto) or Withdraws::Fiat (fiat)
statestringCurrent state (see table above)
protocolstringBlockchain protocol (e.g. ERC20, TRC20, sepolia)
blockchain_keystringBlockchain network key (e.g. eth-mainnet, eth-testnet)
transaction_typestringexternal or internal
tidstringInternal transaction ID
ridstringRecipient wallet address
created_atstringISO 8601 timestamp of creation
updated_atstringISO 8601 timestamp of last update

Frontend Notifications

The frontend shows toast notifications based on the withdrawal state:

StateNotification TypeMessage
submitted🔵 InfoWithdrawal submitted
succeed✅ SuccessWithdrawal completed
rejected❌ ErrorWithdrawal failed
failed❌ ErrorWithdrawal failed

All state changes also update the withdrawal history list in real-time via the Redux store.


Summary Table

Event KeyChannelEndpointTriggered ByFrontend Action
orderPrivate/privateOrder created / updated / cancelled / filledUpdates open orders & order history in real-time
tradePrivate/privateTrade matched (sent to maker & taker)Updates personal trade list
{marketId}.tradesPublic/publicTrade matched (broadcast to all)Updates public market trade feed
withdrawPrivate/privateWithdrawal state transitionUpdates withdrawal history + shows toast notification
balancePrivate/privateDeposit accepted, Withdrawal success, or Trade fillUpdates wallet balances

4. Balance Event (balance)

When Is It Triggered?

The balance event is published to the user's private stream whenever their account balance changes due to the following actions:

TriggerDescription
Deposit AcceptedWhen a deposit moves to the accepted state
Withdrawal SuccessWhen a withdrawal moves to the succeed state
Trade ExecutionWhen an order is filled (partial or full) during trading
Internal TransferWhen funds are moved between accounts or via internal transfers

WSS Response Payload

{
"balance": {
"currency": "btc",
"balance": "1.50000000",
"locked": "0.50000000",
"prev_pnl": {
"aval_balance": "1.45000000",
"currency_price": "50000.0"
},
"net_inflow": 0.05,
"precision": 8,
"currency_usdt": "51000.0",
"currency_icon": "https://example.com/icons/btc.png",
"currency_type": "coin",
"currency_name": "Bitcoin"
}
}

Payload Fields

FieldTypeDescription
currencystringCurrency ID (e.g. btc, usdt)
balancestringAvailable (free) balance
lockedstringLocked balance (e.g. in open orders)
prev_pnlobjectPrevious 24h PNL data
prev_pnl.aval_balancestringnull
prev_pnl.currency_pricestringnull
net_inflowfloatNet inflow for the current period
precisionintegerDecimal precision for this currency
currency_usdtstringCurrent price of the currency in USDT
currency_iconstringURL to the currency icon
currency_typestringcoin or fiat
currency_namestringFull name of the currency