Skip to main content

Trading Guide

Overview​

A trade converts between a cryptocurrency and a fiat currency in an account's balance: buying crypto with fiat, or selling crypto for fiat. Trades are always between a cryptocurrency and a fiat currency; direct exchanges between two cryptocurrencies are not supported.

Each trade is on a product, a pair written BASE-QUOTE with a hyphen: BTC-USD, ETH-USD, USDC-MXN, USDT-BRL and so on. GET /api/v2/trade-products lists the products your workspace can trade.

Every call in this guide takes either kind of API key, and both send accountId in the body. A workspace-scoped key names any account of the workspace; an account-scoped key sends its own, and naming another account answers 403. See Key types and permissions.

Trade Flow​

1. Preview the trade​

  • Endpoint: POST /api/v2/trade/preview, with the accountId, the product, the type (market, the only one), the side (buy or sell), the quantity and its quantityCurrency: the fiat currency for a buy (USD to spend), the crypto for a sell (BTC to sell).
  • Result: the estimated rate, fees and amount the account would receive, a previewId, and expiresAt, when the preview lapses. Nothing is reserved or moved.

2. Execute the trade​

  • Endpoint: POST /api/v2/trade/execute, with the same order fields and, optionally, the previewId.
  • Result: the trade's transactionId. The amount being spent is held from the balance while the trade runs.

Sending the previewId asks for the preview's rate and fees, but does not guarantee them: the final rate can still move with the market. The account must have the balance for the trade, and a frozen account cannot trade.

3. Follow the trade​

  • Webhooks: trade_transaction_created when the trade is accepted, then trade_transaction_status_updated when it settles (success) or fails (failed). See Trade Webhooks.
  • Result: on success, the converted amount is credited to the account's balance in the currency it bought.

4. Review past trades​

Key Terminology​

  • Trade: an operation that converts between a cryptocurrency and a fiat currency.
  • Product: the pair a trade is on, such as BTC-USD: the crypto first, the fiat second.
  • Fiat: a government currency held in a bank account: USD, MXN, ARS, COP, BRL or NGN, as your workspace offers them.
  • Exchange rate: the rate at which the crypto converts to the fiat currency.

Important Notes​

  • A preview has a limited validity (expiresAt). Executing with its previewId asks for its terms, but the market can still move the final rate.
  • Once a trade has settled, it cannot be reversed.

Support and Resources​

If you need assistance or have any questions, our support team is here to help. You can contact our support team at support@blockwyre.com.

Stay Updated​

Stay up-to-date with the latest news, updates, and features from BlockWyre by following us on social media:

We are excited to have you on board and look forward to seeing how you leverage BlockWyre's powerful tools to enhance your financial operations. Happy integrating!