ZebPay Build is a platform where users can create their own applications for trading like other crypto trading applications.
Developers can create trading bots using ZebPay Build. Users can also build their own applications (console/web/API) using our platform and will be able to:
1. Buy and Sell Crypto Assets.
2. Fetch the market data.
3. Fetch open/completed orders.
4. Cancel open orders.
5. Get the latest balance of their crypto assets.
All Market and Trading related data/methods are available through RESTful API.
To start using the API, you first need to log in or register with ZebPay and create a new application. If you don't have a ZebPay account, you can sign up here.
To create a new application in ZebPay Build, go to the Application section in Build and click on the "Create Application" button. Fill in all the required details, then click the "Submit" button, and your application will be created.
Once your application is created, our team will review and approve it. After the application is approved, you will receive the client ID and client secret key.
You will also need the authorisation token to perform API calls.
The API calls must be performed in the following sequence:
1) /user/login
2) /user/verifyotp
3) /user/verifypin
Please ensure that the requests contain the following headers.
Received after creating Application.
A timestamp for your request, in ticks.
application/json
A Unique GUID Request Token (Generate new request id on every request).
This API is used to authenticate the user. The user will receive a verification_code in the response, which needs to be used in the /user/verifyotp API call.
POST /user/login
User country code for example: mt, au
User mobile number without country code
Received after creating Application.
Received after creating Application.
{
"verification_code": "Verification_code",
"access_token": null,
"expires_in": null,
"token_type": null,
"refresh_token": null,
"message": null,
"error": null,
"error_description": null
}
"statusCode": 200,
"statusDescription": "OK"
This API is used to authenticate the verify-OTP call. The user will receive a verification_code in the response, which needs to be used in the /user/verifypin API call.
POST /user/verifyotp
Received on user's mobile number.
Received in the /user/login API.
Received after creating Application.
Received after creating Application.
{
"verification_code": "Verification_code",
"access_token": null,
"expires_in": null,
"token_type": null,
"refresh_token": null,
"message": null,
"error": null,
"status": "pending"
}
"statusCode": 200,
"statusDescription": "success"
This API is used to authenticate VerifyPin. After a successful API call, the user will receive an access_token, which must be used in all subsequent API calls.
POST /user/verifypin
user_credentials
User account pin.
Daily trade limit.
Daily withdrawal limit.
total trade limit.
Total withdrawal limit.
verification_code received in the /user/verifyotp API.
Allowed scopes for the application.
For example trade:read, trade:create, wallet:transactions:read
Received after creating Application.
Received after creating Application.
{
"verification_code": null,
"access_token": "access_token",
"expires_in": "3600",
"token_type": "Bearer",
"refresh_token": null,
"message": null,
"error": null,
"error_description": "pending"
}
"statusCode": 200,
"statusDescription": "success"
User can place a limit order only when there is a sufficient amount of quote asset available in the account. Upon placing the order, the amount of quote assets for the given pair will be held for the duration of the order.
Received after creating Application.
A timestamp for your request, in ticks.
application/json
The bearer token, mandatory for all trade API's.
A Unique GUID Request Token (Generate new request id on every request).
POST /orders
Description
The trade pair must be valid matching product available in the list of pairs for trading. Eg. BTC-INR
It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.
Size indicates the amount of base currency required to Bid or Ask against the quote currency.
The price should be in a multiple of minimum tick size.
For example: BTC-INR pair will have the minimum tick size as 0.01 .
Possilbe values are 1, 2 and 3.
1 is for limit type of order, 2 is for market type of order and 3 is for stoploss type of order
Optional: Applicable if tradeType is of stopploss type of order(3).
Description
Order id
The price should be in a multiple of minimum tick size.
For example: BTC-INR pair will have the minimum tick size as 0.01 .
Size indicates the amount of base currency required to Bid or Ask against the quote currency.
Limit order is the default order type which requires specifying the price and size. If the limit order is not seen filled, it will become the part of the order book unless filled or cancelled by the user.
The trade pair must be valid matching product available in the list of pairs for trading. Ex:BTC-INR.
It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.
This indicates the Date and time when the order is placed.
The status of the order can be determined and then classified into 'pending' or 'complete'. Eg : A limit order will show pending unless "filled or cancelled"
{
"trade_pair": "BTC-INR",
"side": "ask",
"size": 1,
"price": 2000000
}
{
"id": 555677,
"price": 2000000,
"size": 1,
"type": "limit",
"trade_pair": "BTC-INR",
"side": "ask",
"created_at": 1538576785865,
"status": "pending"
}
Overview and general information about the ZebPay Build API's.
All our API requests and responses use the application/json content type and follow standard HTTP response status codes for success and failure. All API requests are made over HTTPS. All POST requests must specify the parameters in x-www-form-urlencoded format.
A successful response is indicated by an HTTP status code of 200 and may contain an optional body. If the response includes a body, it will be documented for each API.
Unless otherwise stated, bad requests will respond with HTTP 4xx status codes. The response body will also contain a message parameter indicating the cause of the error. Ensure that your language's HTTP library is configured to provide message bodies for non-2xx responses, so you can read the message field from the body. The following table provides more details about error codes and their descriptions.
Bad Request – Invalid request format
Unauthorized – Invalid API Key
Forbidden – You do not have access to the requested resource
Not Found
Internal Server Error – We had a problem with our server
When the rate limit is exceeded, a status of "429 Too Many Requests" will be returned.
All our Date/Time properties are represented as a 'Unique Timestamp in milliseconds' (Unix time, also known as POSIX time or UNIX Epoch time). This system describes a point in time as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC) on Thursday, January 1, 1970. Users can convert this value to any timezone. Please note that if your library supports only seconds, divide the value by 1000 before converting it to a date object.
We support pagination in APIs that return a list. Users need to pass parameters like ?limit=10&page=1. By default, the system will limit the records to 20 and fetch the latest data.
A public sandbox is available for testing API connectivity and web trading. The sandbox environment offers the full functionality of the production exchange, allowing you to experiment with the API. Login sessions and API keys are separate from the production environment. Use the sandbox web interface to create keys specifically for sandbox use.
https://www.zebpay.co/api/v1
https://www.zebpay.co/pro/v1
The ZebPay Build production environment is available for API connectivity and web trading.
Login sessions and API keys are distinct from the production environment.
https://www.zebapi.com/api/v1
https://www.zebapi.com/pro/v1
Client libraries can help you integrate with our API quickly.
Github Repository
Users need to register on the application before getting started. Upon successful registration, they will receive the following information, which must be saved.
This information will be used in the OAuth flow:
A unique GUID that must be provided for authentication.
A unique GUID that must be provided for authentication.
Used to generate the hash signature, which will authenticate the user.
Users must restrict the scope of the application. They can select the appropriate permissions during the application registration process:
Permission to read trade data.
Permission to execute trades.
Permission to view wallet balances.
All requests must contain the following headers:
Received after creating the application.
A timestamp for your request, in ticks.
application/json
The bearer token, mandatory for all trade APIs.
A unique GUID request token (generate a new request ID for every request).
ZebPay Build provides a page where developers can register their application as 'web'. When registering the application, developers should keep the following in mind:
For .NET MVC Core applications, app.UseAuthentication() must be used for authentication.
http://xxxx-baseurl-xxx/signin-oidc
http://xxxx-baseurl-xxx/signout-callback-oidc
Code Sample for .net MVC Core application (developers should use Authorize attribute on Controller)
.AddOpenIdConnect("oidc", options => {
options.SignInScheme = "Cookies";
options.Authority = "Auth server Url";
options.RequireHttpsMetadata = true;
options.ClientId = "ClientID";
options.ClientSecret = "ClientSecret";
options.ResponseType = "id_token";
options.Events.OnRemoteFailure = OnRemoteFailure;
//Mandatory Scopes
options.Scope.Add("openid");
options.Scope.Add("profile");
//IMplemented scopes (custom)
options.Scope.Add("wallet:transactions:read");
options.Scope.Add("trade:read");
options.Scope.Add("trade:create");
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
});
ZebPay provides a page where developers can register their application as 'Console'.
A series of APIs are available for login purposes, which need to be called in the following sequence:
/user/login,
/user/verifyotp,
/user/verifypin,
/user/logout.
Refer to the User API documentation for detailed request and response information.
Upon successful authentication, the user will receive an access_token, which can be used to access other APIs.
An access token is always required to call any authenticated API. In scenarios where the client is a program or bot, manual intervention is typically needed to input an OTP during the authentication process. To eliminate this dependency, we offer an interactive UI where developers can generate an access token and integrate it into their program.
To generate an access token, users must go to their application detail page and navigate to the 'Generate Token' tab. You can generate a token for all scopes or a specific subset. The system will prompt you to input a one-time password before generating the token.
There are two segments in Websocket collection:
Users can subscribe to the WebSocket to receive real-time updates on market data, such as the order book, trades, and ticker information.
Websocket Endpoint:
socket.zebapi.com/api/v1/websocket/public
Live Subscribing/Unsubscribing
The following data can be sent through the WebSocket instance to subscribe or unsubscribe.
{
"request": <request-path>
}
{
"request": <request-path>,
"subscribe": false,
}
It pushes the order book snapshot, trade data, and ticker information for a trading pair.
Request path: exchange/<symbol>
{
"request": "exchange/BTC-INR"
}
// Last 24 hour Price Change percentage
{
"data": -1.78,
"requestType": "BTC-INR",
"type": "exchange-pricechange"
}
// Last 24 hour volume
{
"data": 1.5,
"requestType": "BTC-INR",
"type": "exchange-volumechange"
}
// Last 24 hour exchange high price
{
"data": 6299991,
"requestType": "BTC-INR",
"type": "exchange-high"
}
// Last 24 hour exchange low price
{
"data": 4899108.005,
"requestType": "BTC-INR",
"type": "exchange-low"
}
// Order book snapshot
{
"data": {
"asks": [
{
"amount": 6000,
"price": "5885000"
},
{
"amount": 7347,
"price": "5907694.21"
},
{
"amount": 126049,
"price": "5950000"
},
…
],
"bids": [
{
"amount": 579032,
"price": "5882166.82"
},
{
"amount": 169454,
"price": "5880000"
},
…
]
},
"requestType": "BTC-INR",
"type": "exchange-book"
}
// Executed trades
{
"data": {
"fill_flags": 1,
"fill_price": 2102991,
"is_buyer": "maker" or "taker",
"fill_qty": 4758,
"inbound_order_filled": true,
"lastModifiedDate": 1677154922164,
"trans_id": 871549,
},
"requestType": "BTC-INR",
"type": "exchange-fill"
}
// Top Buy Price
{
"data": 5885000,
"requestType": "BTC-INR",
"type": "exchange-topbuy"
}
// Top Sell Price
{
"data": 5882166.82,
"requestType": "BTC-INR",
"type": "exchange-topsell"
}
// Last traded price
{
"data": 5882166.82,
"requestType": "BTC-INR",
"type": "exchange-marketprice"
}
The buy and sell prices in Quick Trade can be retrieved by subscribing to the Quick Trade updates.
Request path: qt/<symbol>
{
"request": "qt/BTC-INR"
}
{
"data": {
"BTC-INR": {
"BuyRate": 5969972.00442825,
"LTP": 5902775.445,
"PercentChange": "0.15",
"SellRate": 5864271.73969875
}
},
"type": "qt-instant-trade-rate"
}
The ticker data for all pairs on the exchange can be retrieved by subscribing to Exchange Trending updates.
Request path: exchange/trending/<mother_currency>/<quote_currency>/data
{
"request": "exchange/trending/INR/INR/data"
}
{
"data": [
{
"CurrencyCode": "BTC",
"CurrencyHoverImage": "https://static.zebpay.com/multicoins/ic_coin_bitcoin_hover.png",
"CurrencyName": "Bitcoin",
"IsNew": false,
"MessageText": "",
"PercentDiff": -2.42,
"Rate": 5840000,
"Sender": "Zrevamp.Trade",
"Sequence": 4,
"TradeValue": 451291.13,
"Volume": 0.07727588
},
{
"CurrencyCode": "MATIC",
"CurrencyHoverImage": "https://static.zebpay.com/multicoins/ic_coin_polygon_hover.png",
"CurrencyName": "Polygon",
"IsNew": false,
"MessageText": "",
"PercentDiff": -28.75,
"Rate": 65.19725,
"Sender": "Zrevamp.Trade",
"Sequence": 5,
"TradeValue": 421320.26,
"Volume": 6462.2398
},
...
],
"requestType": "INR/INR",
"type": "exchange-trending"
}
The ticker data for all pairs in Quick Trade can be retrieved by subscribing to Quick Trade Trending updates.
Request path: qt/trending/<mother_currency>/<quote_currency>/data
{
"request": "qt/trending/INR/INR/data"
}
{
"data": [
{
"CurrencyCode": "BTC",
"CurrencyName": "Bitcoin",
"IsNew": false,
"MessageText": "",
"PercentDiff": -2.06,
"Rate": 5902484.56,
"SellRate": 5798607.26,
"Sender": "Zrevamp.Trade",
"Sequence": 10,
"TradeRateBefore24Hours": 6027030.1005408,
"TradeValue": 1080140.15,
"Volume": 0.18299754
},
{
"CurrencyCode": "ETH",
"CurrencyName": "Ether",
"IsNew": false,
"MessageText": "",
"PercentDiff": -0.86,
"Rate": 290244.25,
"SellRate": 285124.2,
"Sender": "Zrevamp.Trade",
"Sequence": 11,
"TradeRateBefore24Hours": 292788.076028,
"TradeValue": 1004865.33,
"Volume": 3.46213681
},
...
],
"requestType": "INR/INR",
"type": "qt-trending"
}
{
"request": "PING"
}
{
"response": "PONG"
}
The client disconnects the socket connection if no messages are sent or received for 1 minute.
To disconnect or close the socket connection, you can send the following request.
{
"request": "STOP"
}
User can listen to websocket for fetching the real time updates on user data like balance and order.
Websocket Endpoint:
socket.zebapi.com/api/v1/websocket/public
Live Subscribing/Unsubscribing:
The following data can be sent through the websocket instance in order to subscribe/unsubscribe.
{
"request": <request-path>,
"token": <auth_token>
}
{
"request": <request-path>,
"subscribe": false
}
It provides wallet balance information whenever there is a change in the wallet balance.
Request path: balance
{
"request": "balance"
"token": "<auth_token>"
}
{
"data": [
{
"currency": "INR",
"balance": "6280469.9",
"last_updated": "1723805866866",
"pending_trade_balance": "769.4",
"isVirtual": false,
"lending_balance": "0",
"pack_balance": "0",
"qt_locked_balance": "15420.44"
},
{
"currency": "BTC",
"balance": "2501.86179663",
"last_updated": "1723805866866",
"pending_trade_balance": "0",
"isVirtual": true,
"lending_balance": "4.60763963",
"pack_balance": "0.0113988",
"qt_locked_balance": "0"
}
],
"type": "BALANCE"
}
It provides information related to orders.
Request path: order
{
"request": "order"
"token": "<auth_token>"
}
{
"data": [
{
"id": 5781331,
"tradePair": "BTC-INR",
"status": "OPEN",
"side": "Bid",
"orderType": "LIMIT",
"avgPrice": "0",
"price": "5883917.16",
"size": "0.00013",
"volumeOpen": "0.00013",
"volumeExecuted": "0",
"fee": "0",
"tradeValue": "0",
"marketOrderAmount": "0",
"stopPrice": "0",
"tax": "0",
"tds": "0",
"createdAt": 1723642482773
},
{
"id": 5781451,
"tradePair": "ETH-INR",
"status": "OPEN",
"side": "Bid",
"orderType": "LIMIT",
"avgPrice": "0",
"price": "408121.98",
"size": "0.002",
"volumeOpen": "0.002",
"volumeExecuted": "0",
"fee": "0",
"tradeValue": "0",
"marketOrderAmount": "0",
"stopPrice": "0",
"tax": "0",
"tds": "0",
"createdAt": 1723806235036
},
{
"id": 5781450,
"tradePair": "ETH-INR",
"status": "OPEN",
"side": "Bid",
"orderType": "LIMIT",
"avgPrice": "0",
"price": "408121.98",
"size": "0.001",
"volumeOpen": "0.001",
"volumeExecuted": "0",
"fee": "0",
"tradeValue": "0",
"marketOrderAmount": "0",
"stopPrice": "0",
"tax": "0",
"tds": "0",
"createdAt": 1723806192664
}
],
"type": "ORDER"
}
{
"request": "PING"
}
{
"response": "PONG"
}
The client disconnects the socket connection if no messages are sent or received for 1 minute.
To disconnect or close the socket connection, you can send the following request.
{
"request": "STOP"
}
There are two segments in Futures websocket collection:
Market Data Streams provide real-time access to essential market information through WebSocket connections. By subscribing to specific streams, users can receive live updates on various market metrics. Following streams are available to subscribe to:
Connection Setup:
To access public market data streams, establish a WebSocket connection to the following URL using a socket client like socket.io
WS URL:
wss://futuresws.zebpay.com/socket.io
Namespace: /
Subscribing & Unsubscribing to Data Streams:
The WebSocket connection allows users to subscribe to different data streams and receive real-time updates on market events.
Subscribe to Data Streams:
Send a message with the "subscribe" action, specifying the streams you want to receive in the params list
Unsubscribe from Data Streams:
To stop receiving data from a specific stream, send an unsubscribe message specifying the stream names in the params list.
Listening to Events:
Upon successful subscription, the WebSocket server will emit events whenever there is new data for the subscribed streams.
Each event type has a unique payload structure as detailed below.
Action: send
Message Name: "subscribe"
Message Data:
{
"params":[
"btcinr@kline_1m",
"btcinr@markPrice" //streamsto subscribe to
]
}
Action: send
Message Name: "unsubscribe"
Message Data:
{
"params": [
"btcinr@kline_1m",
"btcinr@markPrice" //streams to unsubscribe from
]
}
Provides real-time updates to the order book's bids (buy orders) and asks (sell orders) for a specific symbol, showing the depth of market liquidity.
Action: receive
Message Name: "depthUpdate"
Message Data:
{
"e": "depthUpdate", // Event type
"E": 1707636353921, // Event time (in ms)
"T": 1707636353915, // Transaction time (in ms)
"s": "BTCINR", // Symbol
"U": 3960811287130, // First update ID in event
"u": 3960811297623, // Last update ID in event
"pu": 3960811281312, // Previous final update ID
"b": [ // Bids (buy orders) array
["4240107.8", "0.710"], // [Price, Quantity]
["4240116.5", "0.230"]
],
"a": [ // Asks (sell orders) array
["4240353.6", "17.892"], // [Price, Quantity]
["4240362.4", "1.206"]
]
}
Provides real-time candlestick data for a specified trading interval, including open, close, high, low, and volume information.
Action: receive
Message Name: "kline"
Message Data:
{
"e": "continuous_kline", // Event type
"E": 1730749500239, // Event time
"ps": "ETHINR", // Symbol
"ct": "PERPETUAL", // Contract type
"k": {
"t": 1730749500000, // Kline start time
"T": 1730750399999, // Kline close time
"i": "1m", // Interval (15 minutes)
"f": 1, // First update ID
"L": 1, // Last update ID
"o": "211211", // Open price
"c": "211224", // Close price
"h": "211467", // High price
"l": "211188", // Low price
"v": "778.018", // Volume
"n": 1, // Number of trades
"x": false, // Is this kline closed?
"q": null, // Quote asset volume (null here)
"V": null, // Taker buy volume (null here)
"Q": null, // Taker buy quote asset volume
"B": null // Ignore
}
}
Real-time details of aggregated trades grouped by price for a specific symbol.
Action: receive
Message Name: "aggTrade"
Message Data:
{
"e": "aggTrade", // Event type
"E": 1730749897776, // Event time
"a": 1828600727, // Aggregate trade ID
"s": "ETHINR", // Symbol
"p": "211156", // Price
"q": "0.211", // Quantity
"f": 4586488827, // First trade ID
"l": 4586488828, // Last trade ID
"T": 1730749897666, // Trade time
"m": true // Is the buyer the market maker?
}
Provides the mark price, index price, and funding rate for a specific symbol.
Action: receive
Message Name: "markPriceUpdate"
Message Data:
{
"e": "markPriceUpdate", // Event type
"E": 1707634490000, // Event time
"s": "BTCINR", // Symbol
"p": "4334823.66859808", // Market price
"P": "4335379.542328075", // Estimated settle price
"i": "4336589.925536482", // Index price
"r": "-0.0027", // Funding rate
"T": 1707638400000 // Next funding time
}
Provides rolling 24-hour price statistics, including last trade price, highest/lowest prices, and volume.
Action: receive
Message Name: "24hrTicker"
Message Data:
{
"e": "24hrTicker", // Event type
"E": 1707635719309, // Event time
"s": "BTCINR", // Symbol
"p": "87845.124", // Price change over 24 hours
"P": "2.116", // Price change percentage
"w": "4188295.5225", // Weighted average price
"c": "4239633.639", // Last price
"Q": "0.003", // Last quantity
"o": "4151788.515", // Open price
"h": "4267566", // High price
"l": "4112704.2840000005", // Low price
"v": "222797.117", // Base asset volume
"q": "10626810856.19", // Quote asset volume
"O": 1707549300000, // Open time
"C": 1707635719307, // Close time
"F": 4575372791, // First trade ID
"L": 4578191477, // Last trade ID
"n": 2818668 // Number of trades
}
Provides general details for all contracts, including last trade price, market price, and 24-hour price change percentage.
Action: receive
Message Name: "allContractDetails"
Message Data:
{
"XRPINR": {
"lastPrice": "46.2545", // Last trade price
"marketPrice": "46.2366455382", // Current market price
"priceChangePercent": "0.725", // 24-hr price change %age per
"baseAssetVolume": "487166675.8" // base asset volume in 24 hrs
},
"MATICINR": {
"lastPrice": "74.9827",
"marketPrice": "75.02073812399999",
"priceChangePercent": "0.845",
"baseAssetVolume": "236293682"
},
// Additional symbols...
}
The private socket API enables real-time access to user-specific data such as order updates, position status, and balance changes. This secure data stream requires authentication via the access_token.
Connection Setup:
To access private user order specific data streams, establish a WebSocket connection to the following URL using a socket client like socket.io
WS URL:
wss://futuresws.zebpay.com/socket.io
Namespace: /auth-stream
Authentication:
The private socket requires clients to pass an access_token and client_type during the handshake.
The token should be included as part of the auth object in the WebSocket client’s connection request.
Listening to Events:
To listen for events, establish a WebSocket connection with the required authentication token and client type fields.
Each event type has its own payload structure as defined below.
{
"url": "wss://futuresws.zebpay.com/socket.io",
"namespace": "/auth-stream",
"transport": "websocket",
"auth": {
"token": "access_token", // JWT token for authentication
"clientType": "api" // 'api' for api client type
}
}
Order-related events for actions like filled, partially filled, canceled, failed, and new orders.
Listening Event Name:
1. newOrder: New active order in the open order book.
Action: receive
Message Name: "newOrder" or “orderFilled or “orderPartiallyFilled”, “orderCancelled” or “orderFailed”
Message Data:
{
"eventTime": "1696425435000000000",
"accountId": 5,
"orderId": 3133,
"clientOrderId": "07227f7c2236b71b4b31-5-ext",
"time": "2024-05-10T13:26:00.144Z",
"updateTime": "2024-05-10T13:26:00.237Z",
"symbol": "BTCINR",
"baseAsset": "BTC",
"quoteAsset": "INR",
"contractType": "PERPETUAL",
"type": "MARKET",
"side": "BUY",
"price": 5739874,
"status": "NEW",
"avgPrice": 0,
"executedPrice": 0,
"orderAmount": 0.002,
"executedAmount": 0,
"filledAmount": 0,
"cumQty": 0,
"linkId": "07227f7c2236b71b4b31-5-ext",
"linkType": "ORDER",
"subType": "PRIMARY",
"placeType": "ORDER_FORM",
"market": "INR",
"marginAsset": "INR"
}
Position-related events for new, updated, and closed positions.
Event Types:
1. newPosition: Creates a new entry in the position book.
Action: receive
Message Name: "newPosition" or "updatePosition" or "closePosition"
Message Data:
{
"eventTime": "1696425435000000000",
"accountId": 5,
"contractPair": "BTCINR",
"contractType": "PERPETUAL",
"entryPrice": 5705246,
"leverage": 10,
"liquidationPrice": 5199116,
"marginType": "ISOLATED",
"margin": 3441.36,
"positionAmount": 0.002,
"positionId": "3aa3b75a-20fb-4f1f-a49f-333bc45559c3",
"positionSize": 34231.48,
"positionStatus": "OPEN",
"positionType": "LONG",
"realizedProfit": 0,
"quantity": 0.006,
"market": "INR",
"marginAsset": "INR",
"marginConversionRate": 1,
"marginSettlementRate": 1,
"marginInMarginAsset": 3441.36,
"realizedProfitInMarginAsset": 0
}
Real-time updates to user balances, including total, locked, and available balances.
Event Types:
balanceUpdate: Provides any update to the user’s wallet balances.
Action: receive
Message Name: "balanceUpdate"
Message Data:
{
"eventTime": "1696425435000000000", // Event timestamp in nanosecs
"accountId": 7, // account ID
"updatedWalletBalance": 1989.26, // Total balance after update
"updatedLockedBalance": 1053.18, // Balance currently locked
"updatedAvailableBalance": 936.08, // Balance available for use
"asset": "INR" // Asset in which bal is updated
}
Triggered when a new trade is executed for a specific account. Provides details of the trade.
Listening Event Name: newTrade
Action: receive
Message Name: "newTrade"
Message Data:
{
"eventTime": "1696425435000000000", // in nanosecs
"accountId": 5, // ID of the user account
"tradeId": 2616, // Unique trade identifier
"clientOrderId": "be9c210d2934b67b7a82-5-ext",
"tradeTime": "2024-05-10T13:28:36.377Z",
"symbol": "BTCINR", // Trading pair symbol
"side": "BUY",
"executedPrice": 5701423,
"executedQuantity": 0.029,
"fee": 0, // Fee for the trade
"realizedPnl": 0,
"role": "maker",
"market": "INR",
"marginAsset": "INR",
"positionId": "examplePositionId" // Position ID linked to trade
}
Events triggered to notify the user when they are over leveraged or have been liquidated.
Event Types:
1. marginCallAlert: Triggered when the utilisation ratio hits 80%
Action: receive
Message Name: "marginCallAlert"
Message Data:
{
"eventTime": "1696425435000000000", // margin call ts in nanosecs
"accountId": 7,
"contractPair": "BTCINR",
"marginRequired": 500.00, // margin reqd to prevent liquidation
"currentMargin": 200.00, // current margin level for the position
"positionType": "LONG",
"positionId": "88e19883-e7e2-4318-95ba-bb9db39117ad",
}
Action: receive
Message Name: "liquidationAlert"
Message Data:
{
"eventTime": "1696425435000000000", // liquidation ts in nanosecs
"accountId": 7,
"contractPair": "BTCINR",
"liquidationPrice": 3448000.64,
"positionType": "LONG",
"quantity": 0.003, // Qty of asset liquidated
"positionId": "88e19883-e7e2-4318-95ba-bb9db39117ad"
}