Exit Trades
Counter a settling trade to address buyer's remorse using the exit trades feature.
Overview
The exit trades feature creates a new trade that counters a previous
trade currently in state: "settling". This addresses buyer's
remorse — for example, a customer who bought Bitcoin and wants to
reverse the transaction.
The exit trade settles at the same time as the original trade. Price fluctuations between the original and exit quotes may result in gains or losses.
Requirements:
- The original trade must be
state: "settling". - The original trade must not be included in a settlement batch.
Steps:
- Create an exit trade quote.
- Create an exit trade.
Create an exit trade quote
For a trade in state: "settling" that has not been batched, create
a quote via POST /api/quotes:
{
"product_type": "trading_exit",
"customer_guid": "<insert customer_guid>",
"reference_trade_guid": "<insert reference_trade_guid>"
}{
"created_at": "<created_at timestamp>",
"updated_at": "<updated_at timestamp>",
"guid": "<created quote_guid>",
"product_type": "trading_exit",
"customer_guid": "<inserted customer_guid>",
"symbol": "<associated symbol>",
"side": "<associated side>",
"receive_amount": 0,
"deliver_amount": 0,
"fee": 0,
"issued_at": "<issued_at timestamp>",
"expires_at": "<expires_at timestamp>"
}Create the exit trade
Use the quote GUID from above in POST /api/trades:
{
"trade_type": "exit",
"quote_guid": "<insert quote_guid>"
}{
"created_at": "<created_at timestamp>",
"updated_at": "<updated_at timestamp>",
"guid": "<created trade_guid>",
"trade_type": "exit",
"customer_guid": "<associated customer_guid>",
"quote_guid": "<inserted quote_guid>",
"symbol": "<associated symbol>",
"side": "<associated side>",
"state": "storing",
"failure_code": null,
"receive_amount": 0,
"deliver_amount": 0,
"fee": 0,
"reference_trade_guid": "<inserted reference_trade_guid>",
"labels": null
}The trade progresses from state: "storing" to
state: "settling", then to state: "completed".
Poll GET /api/trades/{trade_guid} to confirm completion.
Batched trades cannot be exitedIf the original trade has already been included in a settlement batch, the exit trade progresses to
state: "failed"withfailure_code: "invalid_reference_trade".
Updated 5 days ago
