Guides
Payments

Trade

Configure pairs, request a 30-second quote and execute the conversion between accounts.

Bloquo's trade flow has three steps: the customer must have the pair configured, requests a quote (valid for 30 seconds and single-use) and executes the quote. Execution locks the side being spent, and the order moves from PROCESSING to COMPLETED, posting a Debit on one account and a Credit on the other.

Pairs

The root customer comes with USD/BRL, EUR/BRL, USDT/BRL, USDC/BRL, BTC/BRL and USDT/USD. A pair works in both directions. To add another:

bash
curl -X POST https://bloquo.mimicr.dev/api/v1/trade/customer/1001/pair \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"baseCurrency": "GBP", "quoteCurrency": "BRL"}'

GET .../pair lists the pairs ({data, pagination}), PUT .../pair/{pairId} updates and DELETE .../pair/{pairId} removes. Sub-accounts get the pairs from settings.tradingPairs, with the buy and sell spread set there.

Request a quote

side sets the direction: Buy buys the base currency spending the quote currency, Sell sells the base. Send exactly one of baseAmount and quoteAmount, and the accounts that will settle the trade:

bash
curl -X POST https://bloquo.mimicr.dev/api/v1/trade/customer/1001/quote \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"baseCurrency": "USD", "quoteCurrency": "BRL", "baseAccountId": 1007, "quoteAccountId": 1004, "side": "Buy", "baseAmount": 100}'
json
{
  "status": true,
  "result": {
    "orderId": "1ba0dc59-9816-4431-80fd-86358ab51e6c",
    "baseCurrency": "USD",
    "baseAmount": 100,
    "quoteCurrency": "BRL",
    "quoteAmount": 522.6,
    "price": 5.226,
    "side": "Buy",
    "createdAt": "2026-11-05T20:12:29.642Z",
    "expireAt": "2026-11-05T20:12:59.642Z"
  },
  "message": null
}

POST .../quote/direct takes the same body and only works for Institutional customers (others get 403).

Bloquo mentions POST /quote without documenting it, and its examples disagree on what price is. In Mimicr, both routes behave the same and price is how much of the quote currency one unit of the base is worth. The rate comes from the sandbox's BRL price table, with a 0.5% spread against the customer (or the sub-account's pair spread).

Quote errors (400): Currency pair not available., Provide either baseAmount or quoteAmount, never both., Account <id> is not a <currency> account..

Execute

Use the quote's orderId, through either route:

bash
curl -X PUT https://bloquo.mimicr.dev/api/v1/trade/customer/1001/execute/1ba0dc59-9816-4431-80fd-86358ab51e6c \
  -H "Authorization: Bearer <token>"
bash
curl -X POST https://bloquo.mimicr.dev/api/v1/trade/customer/1001/order \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"quoteId": "1ba0dc59-9816-4431-80fd-86358ab51e6c"}'

The execute route returns result.tradeOrder and result.tradeResult; the order route returns the order in result. In both, the order starts PROCESSING, with internalStatus (or tradeStatus.name) and the spent side held.

Execution errors (422):

message
Quote with order <id> not found.
Quote with order <id> expired.
Quote with order <id> already used.
Quote with order <id> belongs to another customer.
Quote with order <id> has no accounts to settle.
Failed to lock customer balance for trade order '<id>'.

Order status

StatusstatusIdMeaning
PROCESSING1Balance locked; waiting for the liquidity provider
WaitingTreasury2Confirmed by the provider; waiting for treasury
COMPLETED3Debit and credit posted
FAILED4Rejected; balance unlocked
REVERTED6Cancelled by the customer

In Mimicr, PROCESSING becomes WaitingTreasury in about 1 second and COMPLETED about 2 seconds later. The Trade webhook goes out on every change, only to the Trade preference (the order takes no webhookUrl).

Cancel

DELETE /api/v1/trade/customer/{customerId}/order/{orderId} cancels an order still in PROCESSING: it moves to REVERTED and the balance comes back. After that the response is 400 Failed to delete trade order.

Test the scenarios

Turn autoSettleOrders off so the order stops at PROCESSING, then decide the outcome:

bash
npx mimicr action bloquo trade.complete tradeId=1ba0dc59-9816-4431-80fd-86358ab51e6c
npx mimicr action bloquo trade.fail tradeId=1ba0dc59-9816-4431-80fd-86358ab51e6c

tradeId takes the orderId (UUID) or the order's numeric id. To change a currency's rate:

bash
curl -X PUT https://api.mimicr.dev/v1/bloquo/rates \
  -H "Authorization: Bearer mk_..." \
  -H "Content-Type: application/json" \
  -d '{"USD": "5.37"}'

Reference: Create currency pair, List currency pairs, Request quote, Request direct quote, Execute trade, Create trade order, List trade orders, Cancel trade order.