Quote
Getting a quote is the first step in trading digital assets in Liquidity Hub. A quote provides the price at which you can buy or sell a digital asset. You can then execute the quote to complete the digital asset trade at the quoted price.
To request a quote send aPOST
request to the /quotes/request
endpoint. The response contains the Quote
object which specifies the price at which you can buy or sell a digital asset. This page explains some of the data fields in the request and response bodies.Request body fields
When you send aPOST
request to the /quotes/request
endpoint, you must include a request body specified according to the schema below.Request body schema
baseAsset required | string The unique symbol of a digital asset that the end user wants to buy or sell.
Note: The value of this field must not be |
quoteAsset required | string The unique symbol of an asset that the end user wants to buy or sell.
Note: The value of this field must be |
baseAssetQty | string The number of units of |
quoteAssetQty | string The number of units of |
side required | string Indicates whether to |
endUserGuid | string <uuid> A unique identifier associated with the end user. Used for reconciliation purposes and supplied by the customer. |
Understand the side
field
You use the side
field in the request body to indicate whether you want to buy or sell the baseAsset
. The value of this field determines the trade price listed in the quote you receive.The side
field can have one of the following values:BUY
: Indicates that you want to buy thebaseAsset
.SELL
: Indicates that you want to sell thebaseAsset
.TWO_WAY
: Indicates that you want to get current prices to determine the quantity ofquoteAsset
you can buy or sell in exchange for thebaseAsset
. You can use this quote to make a decision later about buying or selling thebaseAsset
.
side
values:Request body to buy 2 BTC in exchange for USD.
{
"baseAsset": "BTC",
"quoteAsset": "USD",
"side": "BUY",
"baseAssetQty": "2"
}
Request body to sell 2 BTC in exchange for USD.
{
"baseAsset": "BTC",
"quoteAsset": "USD",
"side": "SELL",
"baseAssetQty": "2"
}
Request body to get the price in USD to buy 2 BTC,
as well as how many USD you get by selling 2 BTC.
{
"baseAsset": "BTC",
"quoteAsset": "USD",
"side": "TWO_WAY",
"baseAssetQty": "2"
}
When to use the baseAssetQty and quoteAssetQty fields
The request body for the/quotes/request
endpoint accepts either the baseAssetQty
or the quoteAssetQty
field. The field you specify in the request depends on the parameters of the trade you want to make.When to specify baseAssetQty
The following scenarios explain when to specify the baseAssetQty
field in the request body:- You want to buy 5 Bitcoin by selling US Dollars. In this scenario, your
baseAsset
isBTC
, theside
isBUY
, andquoteAsset
isUSD
. Because you know the quantity of the base asset you want to buy, specifybaseAssetQty
=5
. The quote you receive specifies how muchUSD
you have to spend to buy 5BTC
. - You want to sell 5 Bitcoin to buy US Dollars. In this scenario, your
baseAsset
isBTC
, theside
isSELL
, andquoteAsset
isUSD
. Because you know the quantity of the base asset you want to sell, specifybaseAssetQty
=5
. The quote you receive specifies how muchUSD
you can buy by spending 5BTC
.
When to specify quoteAssetQty
The following examples explain when to specify the quoteAssetQty
field in the request body:- You want to buy Bitcoin by selling 63234.45 US Dollars. In this scenario, your
baseAsset
isBTC
, theside
isBUY
, andquoteAsset
isUSD
. Because you know the quantity of the quote asset you want to spend in this trade, specifyquoteAssetQty
=63234.45
. The quote you receive specifies how muchBTC
you can buy by spending 63234.45USD
. - You want to sell Bitcoin to buy 50000.00 US Dollars. In this scenario, your
baseAsset
isBTC
, theside
isSELL
, andquoteAsset
isUSD
. Because you know the quantity of the quote asset you want to buy in this trade, specifyquoteAssetQty
=50000.00
. The quote you receive specifies how muchBTC
you need to spend to buy 50000.00USD
.
Response fields
The response you receive from the/quotes/request
endpoint contains the Quote
object. The key fields in the response include:quoteId
: The unique ID associated with the quote. You must specify this ID when you execute the quote.- Quote price:
bidPrice
: Specifies the quantity of thequoteAsset
you will receive in return for selling thebaseAsset
.offerPrice
: Specifies the quantity of thequoteAsset
you will have to sell to buy thebaseAsset
.
For the full response object schema, see the Request a quote operation reference.