POST /wallets/{address}/trades
Buys and sells use synthetic funds and update simulated holdings at real-world reference prices. See What can you trade? for asset examples.
Buy AAPL with USD
POST /wallets/01a1f8d3-ea7b-7a12-8b34-56789abcdef0/tradesAuthorization: Bearer <trade-token>Idempotency-Key: <buy-idempotency-key>Content-Type: application/json
{ "operation": "buy", "asset": { "id": "US-AAPL", "units": "0.001" }, "quote": { "currency": "USD", "maximum_price_per_unit": "249.85" }}Response: 201 Created
{ "meta": { "network": "rehearsal", "at": "2026-11-20T15:15:00.124000000Z", "attribution": [ { "text": "Data provided by Databento", "url": "https://databento.com/docs/datasets/equs-mini" } ] }, "data": { "public": { "transaction": "01a1f986-719b-7c34-ad56-789abcdef002", "operation": "buy", "asset": { "id": "US-AAPL", "units": "0.001" }, "quote": { "currency": "USD", "price_per_unit": "249.37", "amount": "0.24937" } } }}Sell AAPL for USD
POST /wallets/01a1f8d3-ea7b-7a12-8b34-56789abcdef0/tradesAuthorization: Bearer <trade-token>Idempotency-Key: <sell-idempotency-key>Content-Type: application/json
{ "operation": "sell", "asset": { "id": "US-AAPL", "units": "0.001" }, "quote": { "currency": "USD", "minimum_price_per_unit": "251.12" }}Response: 201 Created
{ "meta": { "network": "rehearsal", "at": "2026-11-20T15:20:00.124000000Z", "attribution": [ { "text": "Data provided by Databento", "url": "https://databento.com/docs/datasets/equs-mini" } ] }, "data": { "public": { "transaction": "01a1f98b-057b-7d45-be67-89abcdef0001", "operation": "sell", "asset": { "id": "US-AAPL", "units": "0.001" }, "quote": { "currency": "USD", "price_per_unit": "251.43", "amount": "0.25143" } } }}| Input | Meaning and format |
|---|---|
address |
Wallet address. UUIDv7 (RFC 9562), lowercase, 36 characters. |
trade-token |
Wallet trade token. sk-{network}-{lookup}-{secret}. Independent OS CSPRNG values, lowercase hex: lookup has 128-bit entropy (32 characters); secret has 256-bit entropy (64 characters). |
Idempotency-Key |
Client-generated UUIDv4 or UUIDv7. Unique per wallet across trades and transfers. Reuse for retries. Expires 3 hours after acceptance. |
operation |
buy or sell. |
asset.id |
US listing: US-{symbol}. BNB Smart Chain token: crypto-{symbol}. Keep the full symbol, including case and share-class punctuation. Maximum 128 UTF-8 bytes. |
asset.units |
Asset units to buy or sell. Positive plain decimal string, up to 64 characters, representable with 18 decimal places. Maximum 340282366920938463463.374607431768211455. |
quote.currency |
Required for buy and sell. Use USD. |
quote.maximum_price_per_unit |
Maximum price to pay per asset unit, in quote.currency. Positive plain decimal string, up to 64 characters, representable with 18 decimal places. Maximum 340282366920938463463.374607431768211455. Required for buy. |
quote.minimum_price_per_unit |
Minimum price to receive per asset unit, in quote.currency. Positive plain decimal string, up to 64 characters, representable with 18 decimal places. Maximum 340282366920938463463.374607431768211455. Required for sell. |
The API rounds the total in the quote currency to 18 decimal places, up for a buy and down for a sell. It checks that total against the number of units multiplied by your price limit. A small trade can therefore exceed a buy limit or fall below a sell limit even when the displayed price matches the limit. A sale that rounds to zero returns 422.
| Output | Meaning and format |
|---|---|
transaction |
Reference for the asset credit (buy) or asset debit (sell). UUIDv7 (RFC 9562), lowercase, 36 characters. |
operation |
buy or sell. |
asset.id |
Asset ID from the request. |
asset.units |
Asset units bought or sold. Positive plain decimal string, up to 18 decimal places; no trailing fractional zeros. Maximum 340282366920938463463.374607431768211455. |
quote.currency |
USD. |
quote.price_per_unit |
Actual execution price per asset unit, in quote.currency. Positive plain decimal string, up to 18 decimal places; no trailing fractional zeros. Maximum 340282366920938463463.374607431768211455. |
quote.amount |
Amount of synthetic funds paid for a buy or received for a sell, in quote.currency. Positive plain decimal string, up to 18 decimal places; no trailing fractional zeros. Maximum 340282366920938463463.374607431768211455. |
network |
Selected network. String. |
at |
Response time. RFC 3339 (ISO 8601 profile), UTC (Z), exactly 9 fractional digits (nanoseconds). |
meta.attribution |
Sources for the execution price. Each entry has credit text (text) and a source link (url). The HTTP Link header carries the same credit with rel="via". See Attributions. |