GuidesRecipesAPI ReferenceChangelog
Guides

Execute Trades

Execute a trade against a quote using the Cybrid API.

Execute a trade

After generating a quote, execute a trade via POST /api/trades. The only required field is the quote GUID:

{
  "quote_guid": "quote_guid"
}
{
  "guid": "trade_guid",
  "customer_guid": "customer_guid",
  "quote_guid": "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"
}
⚠️

Quote expiration

The quote must be less than 30 seconds old. Expired quotes cannot be traded.

Check trade status

Poll GET /api/trades/{trade_guid} to verify the trade completed:

{
  "guid": "trade_guid",
  "customer_guid": "customer_guid",
  "quote_guid": "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"
}

Trade states

StateDescription
storingTrade details are being stored
pendingTrade details are stored and being processed
executedTrade has been processed and is awaiting settlement
settlingPlatform is waiting for the trade to settle
cancelledTrade was cancelled
completedTrade successfully completed
failedTrade could not be completed
⚠️

Trade failures

Trades may fail for several reasons, including price movement of the asset between quote generation and trade execution. If the market price moves outside the allowed spread or tolerance, the trade may be rejected as failed. In some cases, adjusting the BPS (basis points, i.e., the fee or spread) can help a trade succeed by increasing the tolerance for price movement. Contact support if you need to temporarily adjust BPS to facilitate a trade.