1. Support Center
  2. Getting Ready for Trading

How do I generate a quote?

To generate a quote, we’ll use the /api/quotes POST API call. Navigate to the call in the documentation, expand it, and click Try it out.

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 Step 6 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.

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. In our case, delete the deliver_amount key.

Go ahead and click Execute to generate a quote. You’ll see something similar to this:

{
"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: The quote is only valid for 30 seconds. If you try to execute a trade after 30 seconds the trade will error out.


STEP 7: Executing a trade