Generate Quote
How do I generate a quote?
Use the POST /api/quotes endpoint
You’ll need to have your customer GUID handy. If you didn’t copy it earlier, you can head over to the /api/customers GET call and execute it to return a list of customers you’ve created. Copy the customer GUID and head back to /api/quotes.
You’ll also need to specify a symbol. You can see a full list of supported symbols by executing the /api/symbols GET call. The symbols are always in pair format, for example BTC-USD.
Quotes in the sandbox environment are valid for 30 seconds. This is a convenience feature for testing, as production environment quotes are only valid for 8 seconds. As such, you may want to follow through the instructions below to get a feel for generating a quote, then take a look at the guide for executing a trade. When you feel comfortable with that step, come back here to generate another quote and immediately use your quote ID to execute the trade.
In the request body, paste your customer GUID into the customer_guid placeholder string. Update the symbol to your desired cryptocurrency, such as BTC-USD, and set the receive_amount to the amount of BTC you’d like to receive, such as 10,000,000. When you are entering the receive amount, be aware that the number is always in the base unit of the currency. For example, the base unit of Bitcoin is 1 Satoshi, and there are 100,000,000 satoshis in a single Bitcoin. So if you want to purchase 0.1 of a bitcoin, that equates to 10,000,000 satoshis, hence the number we suggested for the receive_amount.
To trade at the bank-level instead of at the customer-level, be sure to provide the bank_guid instead of the customer_guid when creating the quote.
Note that there are two ways to prepare a quote. The first is to enter the receive amount, which specifies the amount of cryptocurrency to provide a fiat quote for. The second is to enter the deliver amount, which specifies the amount of fiat a customer would like to spend, and will determine the resultant amount of crypto they will receive. The request body only accepts one of either receive_amount or deliver_amount, so make sure to include only one.
An example POST /api/quotes response body is below:
{
"guid": "your_quote_guid",
"customer_guid": "your_customer_guid",
"symbol": "BTC-USD",
"side": "buy",
"receive_amount": 10000000,
"deliver_amount": 293407,
"fee": 0,
"issued_at": "2022-05-11T19:47:52.048Z",
"expires_at": "2022-05-11T19:48:22.048Z"
}
Reminder: If you try to execute a trade after the quote has expired, the trade will fail.
Updated 3 months ago