Introduction

Zebpay Build is a platform where users can create their own applications for trading like other cryptocurrency trading applications. Developers can create trading bots using Zebpay Build. Users can also build 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 crypto assets.

All Market and Trading related data/methods are available through REST-ful API.

Quick Start

To start using API, first you need to login or register with zebpay, then you need to create a new application. If you do not have zebpay account, you can sign up here.

Create Application

To create new Application in zebpay build, go to the application section in build and then click on the create application button. Please fill all required details and click on the submit button and your application will be created.

Create Application

Get it Approved

Once your application is created, our team will review and approve it. After approval of application, you will get the client id and client secret key.

You also need the Authorization token to perform the API calls. You have to perform these API call in sequence
1) /user/login,
2) /user/verifyotp,
3) /user/verifypin

Please ensure above requests must contain the following headers.

client_id

Received after creating Application.

timestamp

A timestamp for your request, in ticks.

Content-Type

application/json

RequestId

A Unique GUID Request Token (Generate new request id on every request).

Get it Approved

Login

This API is used to authenticate the user. User will get the verification_code in response which needs to be used in /user/verifyotp API call.

Request URL

POST /user/login

Request parameters

country_code

User country code for example: mt, au

mobile_number

User mobile number without country code

client_id

Received after creating Application.

client_secret

Received after creating Application.

Sample Response

                    
                                {
"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"

OTP

This API is used to authenticate verifyOtp call. User will get the verification_code in response which needs to be used in /user/verifypin API call.

Request URL

POST /user/verifyotp

Request parameters

otp

Received on user's mobile number.

verification_code

Received in the /user/login API.

client_id

Received after creating Application.

client_secret

Received after creating Application.

Sample Response

                    
                                {
"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"

PIN

This API is used to authenticate VerifyPin. After the API is called successfully user will get the access_token which needs to be used in all API calls.

Request URL

POST /user/verifypin

Request parameters

grant_type

user_credentials

pin

User account pin.

daily_trade_limit

Daily trade limit.

daily_withdraw_limit

Daily withdrawal limit.

total_trade_limit

total trade limit.

total_withdraw_limit

Total withdrawal limit.

verification_code

verification_code received in the /user/verifyotp API.

scope

Allowed scopes for the application.
For example trade:read, trade:create

client_id

Received after creating Application.

client_secret

Received after creating Application.

Sample Response

                    
                                {
"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"

Example API call

User can place a limit order and it can be done only when there is sufficient amount of Quote currencies available in the account. On placing the order, the amount of quote currency for the given pair will be kept on hold for the duration of the order.

Request Headers
client_id

Received after creating Application.

timestamp

A timestamp for your request, in ticks.

Content-Type

application/json

Authorization

The bearer token, mandatory for all trade API's.

RequestId

A Unique GUID Request Token (Generate new request id on every request).

Request URL

POST /orders

Request parameters
Param

Description

trade_pair

The trade pair must be valid matching product available in the list of pairs for trading. Eg. BTC-INR

side

It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.

size

Size indicates the amount of base currency required to Bid or Ask against the quote currency.

price

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 .

tradeType

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

stopRate

Optional: Applicable if tradeType is of stopploss type of order(3).

Responses
Param

Description

id

Order id

price

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

Size indicates the amount of base currency required to Bid or Ask against the quote currency.

type

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.

trade_pair

The trade pair must be valid matching product available in the list of pairs for trading. Ex:BTC-INR.

side

It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.

created_at

This indicates the Date and time when the order is placed.

status

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"

Sample Request

                    
                            {
"trade_pair": "btc-inr", "side": "ask", "size": 1, "price": 2000000
}

Sample Response

                    
                            {
"id": 555677, "price": 2000000, "size": 1, "type": "limit", "trade_pair": "btc-inr", "side": "ask", "created_at": 1538576785865, "status": "pending"
}

Postman Collection

The fastest way to get started is by importing our API collection into postman from the below link.

https://www.getpostman.com/collections/395aa8fe824c80b54a7e

Overview

Overview and general information about the Zebpay Build API's.

Requests

All our API requests and responses are application/json content type and follow typical HTTP response status codes for success and failure. All API requests are called by the standard HTTPS. All POST calls need to specify the parameters of the format to x-www-form-urlencoded.

Success

A successful response is indicated by HTTP status code 200 and may contain an optional body. If the response has a body it will be documented under each API.

Error Handling

Unless otherwise stated, errors to bad requests will respond with HTTP 4xx or status codes. The body will also contain a message parameter indicating the cause. Your language's HTTP library should be configured to provide message bodies for non-2xx requests so that you can read the message field from the body.

Following table gives more details about error code and description.

400

Bad Request – Invalid request format

401

Unauthorized – Invalid API Key

403

Forbidden – You do not have access to the requested resource

404

Not Found

500

Internal Server Error – We had a problem with our server

Rate Limits

When a Rate limit is exceeded, a status of "429 Too Many Requests" will be returned.

DateTime Format

All our Datetime properties has value as "Unique Timestamp in milliseconds" (Unix time, also known as POSIX time[citation needed] or UNIX Epoch time[1]) is a system for describing a point in time, defined as an approximation of the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970.

User can convert the same to any timezone. Please note that, in case your library supports only seconds, divide the value by 1000 before converting to date object.

Pagination Support

We support pagination in API’s which return a list. User has to pass the value parameterized like "?limit=10&page=1". By default system will limit the record to 20, and fetch the latest data.

Sandbox

A public sandbox is available for testing API connectivity and web trading. The sandbox environment provides all of the functionality of the production exchange and allows you to play around with API.

Login sessions and API keys are separate from production. Use the sandbox web interface to create keys in the sandbox environment.

REST API

https://www.zebpay.co/api/v1

Market REST API

https://www.zebpay.co/pro/v1

Production

Zebpay Build production environment is available for API connectivity and Web trading.

Login sessions and API keys are separate from production.

REST API

https://www.zebapi.com/api/v1

Market REST API

https://www.zebapi.com/pro/v1

Client Libraries

Client libraries can help you integrate with our API quickly.

Github Repository

Authentication

Generating API Key

User will need to register on Application before getting started. Upon successful registration you will get the following information which needs to be saved.

This information will be used in the OAuth flow

Client Id

A unique GUID which need to be provided for authentication.

Client Secret

A unique GUID which need to be provided for authentication.

Api Secret

It is used to generate the hash signature,by which user will get authenticated.

Scope Permission

User must restrict the scope of Application.User can select this permission at the time of application registration.

Trade:read

Permission to read the trade.

Trade:Create

Permission to execute the trade.

API - Request Headers

All Request must contain the following headers.

client_id

Received after creating Application.

timestamp

A timestamp for your request, in ticks.

Content-Type

application/json

Authorization

The bearer token, mandatory for all trade API's.

RequestId

A Unique GUID Request Token (Generate new request id on every request).

Web Application

Zebpay Build provides a page where developers can register the application as "web". At the time of application registration developers need to keep the following things in mind:

When creating .net MVC Core application, app.UseAuthentication() should be used for authentication.

Call Back Url

http://xxxx-baseurl-xxx/signin-oidc

PostLogoutUrl

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;
});

Backend/Console Application

Zebpay provides a page where developers can register the application as "Console".

Zebpay provides a series of API's for login purpose.

The API's need to be called in a sequence : /user/login, /user/verifyotp, /user/verifypin, /user/logout. See User API for detail request/response.

After successfull authentication user will get access_token and user can use this access_token to access API.

UI to generate Access-Token

We always need an access token to call any authenticated API. Considering a scenario where the client is a program/bot they will ideally need a manual intervention to key-in OTP in our authentication process. To get rid of this dependency we have an interactive UI where developers can generate access token and setup inside their program.

To generate access token, user needs to go to his/her application detail page, and then navigate to GenerateToken tab. You can generate token for all your scope or for a smaller set as well. System will prompt for a one time password to key-in before generating the actual token value.

User API

Login

This API is used to authenticate the user. User will get the verification_code in response which we need to be used in /user/verifyotp API call.

Request URL

POST /user/login

Request parameters

country_code

User country code for example: mt, au

mobile_number

User mobile number without country code

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                                {
"verification_code": "Verification_code", "access_token": null, "expires_in": null, "token_type": null, "refresh_token": null, "message": null, "error": null, "error_description": null "publicGuid": "36abcdea-3xyz-45e8-8efg-fb9d0293dabc"
} "statusCode": 200, "statusDescription": "OK"

Verify OTP

This API is used to authenticate “verifyOtp”. User will get the verification_code in response which needs to be used in /user/verifypin API call.

Request URL

POST /user/verifyotp

Request parameters

otp

Received on user's mobile number.

verification_code

Received in the /user/login API.

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                                {
"verification_code": "Verification_code", "access_token": null, "expires_in": null, "token_type": null, "refresh_token": null, "message": null, "error": null, "error_description": null "publicGuid": ""
} "statusCode": 200, "statusDescription": "success"

Verify PIN

This API is used to authenticate “VerifyPin”. After successful API call, user will get the access_token which needs to be used for all API calls.

Request URL

POST /user/verifypin

Request parameters

grant_type

user_credentials

pin

User account pin.

daily_trade_limit

Daily trade limit.

daily_withdraw_limit

Daily withdrawal limit.

total_trade_limit

Total trade limit.

total_withdraw_limit

Total withdrawal limit.

verification_code

Received in the /user/verifyotp API.

scope

Allowed scopes for the application.
For example trade:read, trade:create

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                                {
"verification_code": null, "access_token": "access_token", "expires_in": "3600", "token_type": "Bearer", "refresh_token": null, "message": null, "error": null, "error_description": "pending" "publicGuid": null
} "statusCode": 200, "statusDescription": "success"

Logout

This is used to logout from the application.

Request URL

POST /user/logout

Request parameters

access_token

Access token generated in the /user/verifypin API.

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                                {
"verification_code": null, "access_token": null, "expires_in": "null, "token_type": null, "refresh_token": null, "message": success, "error": null, "error_description": null "publicGuid": null
} "statusCode": 200, "statusDescription": "You have been successfully logged out!"

Market API

These APIs returns market details including ticker(s), book (pending orders), trades (executed orders) etc.

Market

Users can get a list of 24 hr stats for available pair by this API. Volume is in base currency units.

Request URL

GET /market

Scope

Param

Description

buy

Current Buy Rate

sell

Current Sell Rate

volumeEx

Volume - Exchange

volume

Volume for last 24 Hrs

pricechange

Change in price

24hoursHigh

Highest Price in last 24 hours.

24hoursLow

Lowest Price in last 24 hours.

pair

Current trade pair

currency

Currency

volumeQt

Volume - Quick trade

Note: Pass query string parameter ?group=singapore

Sample Response

                    
                    [
                    
{ "buy": "0", "sell": "180.02", "market": "180.02" "volumeEx": 0, "volume": 0, "pricechange": "0.00", "24hoursHigh": "180.02", "24hoursLow": "180.02", "pair": "1INCH-INR", "virtualCurrency": "1INCH", "currency": "INR" "volumeQt": 0, },
... ]

Ticker

Users can get the ticker information for the current Trade Pair with daily volume and current Price by using this API.

Request URL

GET /market/{tradepair}/ticker

Scope

Param

Description

Tradepair

Example BTC-INR, ETH-INR etc.

buy

Current Buy Rate

sell

Current Sell Rate

volume

Volume for last 24 Hrs

pricechange

Change in price

24hoursHigh

Highest Price in last 24 hours.

24hoursLow

Lowest Price in last 24 hours.

volumeEx

Volume on Exchange

volumeQT

Volume on Quick Trade

pair

Current trade pair

Note: Pass query string parameter ?group=singapore

Sample Response

                    
                            {
"buy": "271941.98", "sell": "271500", "volumeEx": 72.937237, "market": "271843.6", "volume": 77.759131, "24hoursHigh": "278000", "24hoursLow": "270000", "pricechange": "0.33", "pair": "ETH-INR", "virtualCurrency": "ETH", "currency": "INR", "volumeQt": 4.821894
}

Book

Users can get a list of open orders for a trade pair by using this API.

Request URL

GET /market/{tradepair}/book

Scope

Param

Description

Tradepair

Example BTC-INR, ETH-INR etc.

asks

List of recent ask's Rates, with Price & Amount.

bids

List of recent bid's Rates, with Price & Amount.

pair

Current trade pair.

Note:

  • - Pass query string parameter ?group=singapore
  • - Pass query string parameter ?converted=1 to get the amount in BTC. Default value will be 0.
  • - This endpoint provides bid and ask of the size 15. To fetch the size of 50, use the endpoint /market/{tradepair}/book_long.

Sample Response

                    
                            {
                    
"asks": [ { "price": "272497.11", "amount": 9660000 } ], "bids": [ { "price": "271680.85", "amount": 6250423 } ], "pair": "ETH-INR"
}

Trade API

This endpoint can be used to read order data as well as create a new order. User can also cancel a previously placed order.

Place a New Order

User can place a limit order and it can be done only when there are sufficient amount of Quote currencies available in the account. On placing order, the amount of quote currency for the given pair will be kept on hold for the duration of the order.

Request URL

POST /orders

Request parameters
Param

Description

trade_pair

The trade pair must be a valid matching product available in the list of pairs for trading. Ex:BTC-INR

side

It indicates the side at which the order is placed.
Bid side indicates a downtick and conversely Ask side indicates the uptick.

size

It indicates the amount of base currency required to Bid or Ask against the quote currency.

price

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 .

tradeType

1 = Limit, 2 = Market, 3 = Stoploss

stopRate

Provide stopRate When tradeType is "Stoploss" else default value should be 0

marketOrderValue

Provide marketOrderValue when tradeType is "Market" else default value should be 0

Responses
Param

Description

id

Order id

price

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

It indicates the amount of base currency required to Bid or Ask against the quote currency.

type

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.

trade_pair

The trade pair must be a valid matching product available in the list of pairs for trading. Ex:BTC-INR.

side

It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.

created_at

This indicates the date and time when the order is placed.

status

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"

Request

                    
                            {
"trade_pair": "btc-inr", "side": "ask", "size": 1, "price": 2000000
}

Response

                    
                            {
"id": 555677, "price": 2000000, "size": 1, "type": "limit", "trade_pair": "btc-inr", "side": "ask", "created_at": 1538576785865, "status": "pending"
}

List Trade Orders

Users can list their current orders and can also view open as well as settled orders. User needs to pass ORDER STATUS "Pending" to get all unsettled orders, "all" to get all orders.

Request URL

GET /orders

Request parameters
Param

Description

trade_pair

The trade pair must be valid matching product available in the list of pairs for trading. Ex:BTC-INR

status

Optional: Default value is 'pending'. The status of the order can be determined and then classified into 'pending' or 'complete'. Order will have 'complete' status if it is fully executed in other cases, status will be 'pending'.

orderid

Optional: Order Id

page

Optional: Page Number of the records to be seen.

limit

Optional: Number of records to be fetch in Single Page

Response parameters
Param

Description

id

Order Id

price

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

It indicates the amount of base currency required to Bid or Ask against the quote currency.

type

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.

trade_pair

The trade pair must be a valid matching product available in the list of pairs for trading.

side

It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.

created_at

This indicates the date and time when the order is placed.

executed_value

Executed value is filled_size * [price]

open_size

Pending Quantity in crypto

filled_size

Quantity of order executed

status

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"

market_order_amt

Market order amount when order type is Market Order

stop_price

Stop price when order type is Stop Loss

Sample Response

                    

                            [{
                    
"id": 555583, "price": 17, "size": 0.5, "type": "limit", "trade_pair": "BTC-INR", "side": "Ask", "created_at": 1538576785865, "executed_value": 8.5, "open_size":0.00070000, "filled_size": 0.5, "status": "complete", "market_order_amt": 0.00000000, "stop_price": 0.00000000, "reference_id":null
}]

Fills

Users can get a single order's detail/fills by order id by using this API

Request URL

GET /orders/{orderid}/fills

Scope

Param

Description

orderid

Valid Order Id

Sample Response

                    
                            {
                            "orderDetail":{
                    "id": 555806,
                    "type": "Limit",
                    "side": "Bid",
                    "size": 1.00000000,
                    "openQty": 0.00000000,
                    "executedQty":  0.00000809,
                    "cancelQty": 0.99999191,
                    "price":  5000.00000000,
                    "orderValue":  0.000000,
                    "openOrderValue":  0.000000,
                    "totalFees": 0.00009500,
                    "avgExecutedPrice": 3999.38190000,
                    "effectivePrice": 4011.17920000,
                    "tradePair":"BTC-TUSD",
                    "feeCurrency": "TUSD",
                    "createDate": 1532608626000,
                    "status":  "cancel",
                    "orderStatus": 40,
                    "marketOrderAmount":  0.00000000
                            }
                            },
                            "fills":[{
                    
"orderId": 555806, "size": 0.00000010, "price": 4003.00000000, "amount": 0.000400, "feesType": "taker", "fees": 0.00000100, "intradayFees": 0.00000000, "totalFees": 0.00000100, "feeCurrency": "TUSD", "createDate": 1538576785865
}]

Cancel Trade Order

Users can cancel previously placed order by using this API.

Request URL:

DELETE /orders/{orderid}

Scope:

Param

Description

orderid

Valid Order Id

Sample Response

                    

                {
                    
"data": null, "statusCode": 200, "statusDescription": "success"
}

Cancel All Trade Orders

Users can cancel all the previously placed order(s) for trade pair by using this API.

Request URL:

DELETE orders/CancelAll?trade_pair = BTC-INR

*To cancel orders from all trade pairs use DELETE orders/CancelAll?tradepair=ALL

Scope:

Param

Description

trade_pair

Valid Trade Pair

Sample Response

                    

                {
                    
"data": null, "statusCode": 200, "statusDescription": "success"
}

TDS and Fees

Provides TDS and Fees information

Request URL:

GET tradefees/BTC-INR

Scope:

Param

Description

trade_pair

Valid Trade Pair

side

buy/sell

Sample Response

                     

                        {
                            "customerLevel":"Regular"
                            "feeProcessTitle": "How are Fees Processed?",
                            "feeProcessDescription": "You will be charged a Maker or Taker fee when your order is executed.........",
                            "tradeValue30Days": 2693.0,
                                "feeList": [
                                    
{ "id":1, "feeTitle": "Maker Fee", "feeDescription": "Maker Fee Description", "fee": 0.15, }, { "id":2, "feeTitle": "Taker Fee", "feeDescription": "Taker Fee Description", "fee": 0.25, }, { "id":3, "feeTitle": "Intraday Fee", "feeDescription": "Intraday Fee Description", "fee": 0.1, }, { "id":4, "feeTitle": "TDS", "feeDescription": "TDS Description", "fee": 0.0, }
]}

Deepstream

The deepstream feed provides real-time market data updates for following events:

  • 1. Tickers
  • 2. Orderbook
  • 3. Trades or History


Connection Overview

                    
const ds = window.deepstream;

const config = {
    password: "zebpay",
    userName: "zebpay",
    url: "wss://data.zebapi.com",
};

const client = ds(config.url, {
    // Reconnect after 10, 20 and 30 seconds
    reconnectIntervalIncrement: 10000,
    // Try reconnecting every thirty seconds
    maxReconnectInterval: 30000,
    // We never want to stop trying to reconnect
    maxReconnectAttempts: Infinity,
    // Send heartbeats only once a minute
    heartbeatInterval: 60000,
});

client.login(
  {
    username: config.userName,
    password: config.password,
  },
    (success, data) => {
        if (success) {
            console.log("Login Success");
        } else {
            console.log("Login Failed");
        }
    }
);

client.on("error", (error, event, topic) => {
    console.log("error", error, event, topic);
});

client.on("connectionStateChanged", (connectionState) => {
    console.log("connection state", connectionState); // will be called with 'CLOSED' once the connection is successfully closed.
});

                        
                          

Event Subscription

Once the connection is established, user can request a “record” with the respective topic name. The Format for event names are as follows:

Event Event Name Format Example
Ticker ticker_singapore/{tradepair} ticker_singapore/BTC-INR
Orderbook book_singapore/{tradepair} book_singapore/BTC-INR
History history_singapore/{tradepair} history_singapore/BTC-INR
Instant Rates traderates/{tradepair} traderates/BTC-INR

Ticker (To subscribe realtime ticker event for BTC-INR)

Event:ticker_singapore/{tradepair}

                    
                            let tickerRecord = client.record.getRecord('ticker_singapore/BTC-INR');
                            tickerRecord.subscribe(data => {
                            console.log(data)
                            })
                        
                    

Sample response for ticker data

                    
                            {
                            high24hr: "4200000"
                            low24hr: "4180000"
                            marketPrice: "4200000"
                            priceChangePercent24hr: "0.48"
                            topBuy: "4200000"
                            topSell: "4180000"
                            volumeTotal24hr: "0"
                            volumeTraded24hr: "1120880"
                            }
                        
                    


Order book (To subscribe realtime order book event for BTC-INR)

Event:book_singapore/{tradepair}

                    
                            let bookRecord = client.record.getRecord('book_singapore/BTC-INR');
                            bookRecord.subscribe(data => {
                            console.log(data)
                            })
                        
                    

Sample response for order book data

                    
{
    "bids": [
    {
        "price": "4180000.00000000",
        "amount": 48872613
    },
    {
        "price": "3300000.00000000",
        "amount": 3207453
    }
   ],
    "asks": [
    {
        "price": "4200000.0",
        "amount": 4471192
    },
    {
        "price": "4300000.0",
        "amount": 600000
    }
   ]
}
                        
                    


Trade history (To subscribe realtime trade history event for BTC-INR)

Event:{tradepair}-txHistory_singapore

                    
                            client.event.subscribe('BTC-INR-txHistory_singapore', data => {
                            console.log(data)
                            });
                        
                    

Sample response for trade history data

                    
                            {
                            "trans_id": 49,
                            "fill_qty": 6120,
                            "fill_price": 4180000,
                            "fill_flags": 1,
                            "inbound_order_filled": true,
                            "currencyPair": "BTC-INR",
                            "lastModifiedDate": 1649187243341
                            }
                        
                    


Note:-The amount and fill_qty in orderbook and trade history are represented in the lower denomination. To convert to standard denomination it should be divided by 10^tradeCurrencyDisplayDecimalPlaces.


The value for tradeCurrencyDisplayDecimalPlaces for respective tradepair can be fetched using the tradepair API.

Endpoint: https://www.zebapi.com/api/v1/tradepairs/{country_code}

Example: https://www.zebapi.com/api/v1/tradepairs/IN

Instant Rates

Event: traderates/{tradepair}

                    
                            let bookRecord = client.record.getRecord('traderates/KAVA-INR');
                            bookRecord.subscribe(data => {
                            console.log(data)
                            })
                        
                    

Sample response

                    
                            {
                            BuyRate: 322.8211668,
                            SellRate: 321.05697108
                            }