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 a POST 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 a POST 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 USD.

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 USD.

baseAssetQty
string

The number of units of baseAsset that the end user wants to buy or sell. Specify either baseAssetQty or quoteAssetQty.

quoteAssetQty
string

The number of units of quoteAsset that the end user wants to buy or sell. Specify either baseAssetQty or quoteAssetQty.

side
required
string

Indicates whether to BUY or SELL the baseAsset. Allowed values are BUY, SELL, and TWO_WAY.

Enum: "TWO_WAY" "BUY" "SELL"
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 the baseAsset.
  • SELL: Indicates that you want to sell the baseAsset.
  • TWO_WAY: Indicates that you want to get current prices to determine the quantity of quoteAsset you can buy or sell in exchange for the baseAsset. You can use this quote to make a decision later about buying or selling the baseAsset.
The examples in the following tabs show request bodies with different side values:
side = BUYside = SELLside = TWO_WAY
Copy
Copied!
Request body to buy 2 BTC in exchange for USD.

{
	"baseAsset": "BTC",
	"quoteAsset": "USD",
	"side": "BUY",
	"baseAssetQty": "2"
}
Copy
Copied!
Request body to sell 2 BTC in exchange for USD.

{
	"baseAsset": "BTC",
	"quoteAsset": "USD",
	"side": "SELL",
	"baseAssetQty": "2"
}
Copy
Copied!
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 is BTC, the side is BUY, and quoteAsset is USD. Because you know the quantity of the base asset you want to buy, specify baseAssetQty = 5. The quote you receive specifies how much USD you have to spend to buy 5 BTC.
  • You want to sell 5 Bitcoin to buy US Dollars. In this scenario, your baseAsset is BTC, the side is SELL, and quoteAsset is USD. Because you know the quantity of the base asset you want to sell, specify baseAssetQty = 5. The quote you receive specifies how much USD you can buy by spending 5 BTC.

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 is BTC, the side is BUY, and quoteAsset is USD. Because you know the quantity of the quote asset you want to spend in this trade, specify quoteAssetQty = 63234.45. The quote you receive specifies how much BTC you can buy by spending 63234.45 USD.
  • You want to sell Bitcoin to buy 50000.00 US Dollars. In this scenario, your baseAsset is BTC, the side is SELL, and quoteAsset is USD. Because you know the quantity of the quote asset you want to buy in this trade, specify quoteAssetQty = 50000.00. The quote you receive specifies how much BTC you need to spend to buy 50000.00 USD.

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 the quoteAsset you will receive in return for selling the baseAsset.
    • offerPrice: Specifies the quantity of the quoteAsset you will have to sell to buy the baseAsset.

For the full response object schema, see the Request a quote operation reference.