1. Support Center
  2. Getting Ready for Trading

How do I execute a trade?

Navigate to the /api/trades POST API, expand it, and click Try it out.

Now that we know how to generate a quote, we can proceed to execute a trade. Navigate to the /api/trades POST API, expand it, and click Try it out. You’ll see there’s only one input to the request body JSON, and that’s the Quote ID. The trade process is simply executing the details from the Quote ID you provide.

In the JSON request body, enter the Quote ID from the previous step, ensuring that you generated the quote less than 30 seconds ago. If the quote is still valid, you’ll see something similar to this:

{
"guid": "your_trade_guid",
"customer_guid": "your_customer_guid",
"quote_guid": "your_quote_guid",
"symbol": "BTC-USD",
"side": "buy",
"state": "storing",
"receive_amount": 10000000,
"deliver_amount": 293063,
"fee": 0,
"created_at": "2022-05-11T19:56:42.856Z"
}
 

Note that the state is initially storing. To check if the trade completed successfully, expand the /api/trades/{trade_guid} GET API, and enter the trade GUID from the executed trade. Assuming all is well, you should see something similar to this:

{
"guid": "your_trade_guid",
"customer_guid": "your_customer_guid",
"quote_guid": "your_quote_guid",
"symbol": "BTC-USD",
"side": "buy",
"state": "completed",
"receive_amount": 10000000,
"deliver_amount": 293063,
"fee": 0,
"created_at": "2022-05-11T19:56:42.856Z"
}
 

The trade state is now completed. There’s a few other states that the trade can be in, including:

  • Storing - Trade details are being stored in the platform
  • Initiating - Trade execution has begun
  • Settling - Platform is waiting for the trade to complete
  • Completed - Trade has successfully completed
  • Failed - Platform was not able to successfully complete the trade

To verify your trade completed successfully, head over to the /api/accounts GET call, expand it, click Try it out, and Execute. Look for the account associated with your customer. You should see something similar to this:

{
"type": "trading",
"guid": "your_acconut_guid",
"created_at": "2022-05-11T16:55:55.775Z",
"asset": "BTC",
"name": "Bitcoin Account",
"customer_guid": "your_customer_guid",
"platform_balance": 10000000,
"platform_available": 0
}
 

The platform_balance indicates a balance of 10,000,000! Congrats, you’ve successfully executed a trade for your customer in the sandbox environment.