RPC notifications
RPC notifications are only available when using websockets. To receive notifications, use the subscribe endpoint.
trade_event
This notification can be subscribed to by subscribing to the 'trade' channel. It is sent whenever a trade takes place.
Contents
The result
field contains a list of trades. Each trade consists of:
This notification reports a list of trades in its result
field. Each field consists of:
name | type | example | description |
---|---|---|---|
tradeId |
int | 3 |
trade id |
timeStamp |
int | 1418152290669 |
The trade timestamp in ms |
instrument |
string | "BTC-22JAN16" |
name of the traded instrument |
quantity |
int | 61 |
quantity, in contracts ($10 per contract for futures, ฿1 — for options) |
price |
int | 415 |
float, USD for futures, BTC for options |
state |
string | "closed" |
order state |
direction |
string | "buy" |
direction of the taker's order |
orderId |
int | 10 |
order id (the taker's order) |
matchingId |
int | 6 |
id of matching order (the maker's order) |
makerComm |
float | 0.0001 |
The maker commission in BTC |
takerComm |
float | 0.0005 |
The taker commission in BTC |
indexPrice |
420.69 |
index price | |
label |
string | user defined label for the order from side of the subscribed user. | |
me |
string | "t" |
"t" - if the subscriber is taker, "m" - the subscriber is maker, "" - empty string if the trade is between other users (trade without subscriber's participation) can be used to quickly detect subscriber's trades between other user trades |
tickDirection |
int | 0 |
Direction of the "tick". Valid values: 0 = Plus Tick; 1 = Zero-Plus Tick; 2 = Minus Tick; 3 = Zero-Minus Tick |
my_trade_event
my_trade_event
is similar to trade_event
, except only subscriber's trades are reported.
This notification reports a list of trades in its result
field. Each field consists of:
name | type | example | description |
---|---|---|---|
tradeId |
int | 3 |
trade id |
timeStamp |
int | 1418152290669 |
The trade timestamp in ms |
instrument |
string | "BTC-22JAN16" |
name of the traded instrument |
quantity |
int | 61 |
quantity, in contracts ($10 per contract for futures, ฿1 — for options) |
price |
float | 415 |
float, USD for futures, BTC for options |
state |
string | "closed" |
order state |
direction |
string | "buy" |
direction of the order, from the the perspective of the end user |
orderId |
int | 10 |
order id (the taker's order) |
liquidity |
string | "T" |
T for taker, M for maker |
matchingId |
int | 6 |
id of matching order (the maker's order) |
indexPrice |
float | 420.69 |
index price |
label |
string | user defined label for the order from side of the subscribed user (up to 4 chars) | |
me |
string | "t" |
"t" - if the subscriber is taker, "m" - the subscriber is maker, "" - empty string if the trade is between other users (trade without subscriber's participation) can be used to quickly detect subscriber's trades between other user trades |
tickDirection |
int | 0 |
Direction of the "tick". Valid values: 0 = Plus Tick; 1 = Zero-Plus Tick; 2 = Minus Tick; 3 = Zero-Minus Tick |
order_book_event
Notifies about a change of order book for certain instrument.
This notification reports a list of order books in its result
field. Each order book consists of:
name | type | example | description |
---|---|---|---|
bids |
list | (see below) | The list of all bids, best bid first. See below for entry details |
asks |
list | (see below) | The list of all asks, best ask first. See below for entry details |
state |
string | "open" |
The state of the order book. Possible values include "open" and "closed". |
settlementPrice |
float | 11013.37 |
The settlement price for this currency |
instrument |
string | "BTC-23FEB18" |
REQUIRED, The name of the instrument. |
tstamp |
int | 1517329113791 |
The order book timestamp in milliseconds |
last |
float | 10350 |
The price for the last trade |
low |
float | 10296.11 |
The 24H low for the instrument |
high |
float | 10916.03 |
The 24H high for the instrument |
mark |
float | 10334.06 |
The mark price for the instrument |
uPx |
float | 10408.16 |
(Only for option) underlying price used for ask/bid implied volatility |
uIx |
float | "BTC-30MAR18" |
(Only for option) underlying future instrument name or "index_price" |
iR |
float | 0 |
(Only for option) interest rate used for implied volatility calculations |
markIv |
float | 135 |
(Only for option) implied volatility for mark price |
askIv |
float | 130.06 |
(Only for option) implied volatility for best ask |
bidIv |
float | 109.99 |
(Only for option) implied volatility for best bid |
max |
float | (Only for futures) The maximum price for the future | |
min |
float | (Only for futures) The minimum price for the future |
The fields bids
and asks
are lists of order book price level entries, sorted from best to worst.
name | type | example | description |
---|---|---|---|
quantity |
int | 800 |
The total quantity of orders for this price level |
price |
float | 10322.5 |
The price level |
cm |
int | 800 |
The cumulative quantity |
user_order_event
Notifies about a change of user's orders. This event is triggered for all changes of the user orders, it doesn't depend on 'instrument' argument at subscription.
This notification reports a list of orders in its result
field. Each order consists of:
name | type | example | description |
---|---|---|---|
id |
int | 1031 |
order identifier (for compatibility with older API version) |
orderId |
int | 1031 |
order identifier |
instrument |
string | "BTC-22JAN16" |
instrument name |
direction |
string | "sell" |
direction of the order "buy" or "sell" |
price |
float | 426 |
price, units depend on the asset type |
quantity |
int | 10 |
quantity, in contracts ($10 per contract for futures, ฿1 — for options) |
filledQuantity |
int | 0 |
filled quantity, in contracts ($10 per contract for futures, ฿1 — for options) |
state |
string | "open" |
order state "open", "cancelled", "filled" |
avgPrice |
float | 6591.2 |
average price |
label |
string | "" |
order label |
created |
int | 1453454229858 |
Timestamp (in ms) when the order was created |
modified |
int | 1453454229858 |
Timestamp (in ms) when the order was last changed |
announcements
Notifies with titles of new announcements.
The result
field contains a list of announcements. Each announcement has the following fields:
name | type | example | description |
---|---|---|---|
title |
string | "Example announcement" |
The title of the announcement |
body |
string | "An announcement" |
The HTML body of the announcement |
important |
bool | false |
Whether the announcement is marked as important |
id |
int | 19288317 |
A unique identifier for the announcement |
date |
int | 1527844253000 |
Timestamp in ms at which the announcement was published |
index
This notification reports two index prices in the result
field.
name | type | example | description |
---|---|---|---|
btc |
float | 11628.81 |
The current index price for BTC-USD |
edp |
float | 11628.81 |
Estimated delivery price for BTC-USD. For more details, see Documentation > General > Expiration Price |
portfolio_event
Notifies the user of any changes that occur to his portfolio.
The result
field will contain two entries: portfolio
and positions
.
The portfolio
field contains a list of portfolio summaries for each of the currencies in your account. A portfolio summary consists of:
name | type | example | description |
---|---|---|---|
currency |
string | "BTC" |
Code of the currency |
equity |
0.481203297 |
The total net equity of that currency | |
maintenanceMargin |
0.000064855 |
The amount of the currency needed to maintain the current positions. | |
initialMargin |
0.000123813 |
The amount of the currency needed to open or increase positions | |
availableFunds |
0.481079484 |
Total funds available (after reservations) | |
unrealizedPl |
5.65e-7 |
Unrealized profit or loss. These funds will be added (or deducted) to your available funds at the next settlement. | |
realizedPl |
0 |
Realized profit or loss | |
totalPl |
0.0005624 |
Total profit or loss |
The positions
field consists of a list of positions. Each position consist of:
name | type | example | description |
---|---|---|---|
instrument |
"BTC-30MAR18" |
name of the instrument | |
kind |
string | "future" |
The type of instrument. "future" or "option" |
size |
integer | 5893 |
The position size in contracts. Can be negative (short) or positive (long) |
averagePrice |
float | 9693.502194671 |
average price for the position |
direction |
string | "buy" |
The direction of the position. Can be "buy" (long) or "sell" (short) |
sizeBtc |
float | 7.14775214 |
position size in BTC |
floatingPl |
float | -0.703874042 |
floating PnL |
realizedPl |
float | 0, | realized PnL |
estLiqPrice |
float | 99999.99 |
Estimated liquidation price |
markPrice |
float | 8244.55 |
mark price |
indexPrice |
float | 8242.12 |
index price |
maintenanceMargin |
float | 0.214432564 |
maintenance margin |
initialMargin |
float | 0.357387607 |
initial margin |
settlementPrice |
float | 9145.26 |
The settlement price for the instrument |
delta |
float | 7.14775214 |
The position delta |
openOrderMargin |
float | 0 |
The margin used to back the position |
profitLoss |
float | -1.068422015 |
The PnL for the position |