Trade
The Nexus DEX provides three trading interfaces to accommodate different usage scenarios:
1. Two-Step Trading Process
For scenarios requiring quote confirmation before execution:
Step 1: Get Quote - Use /taker/api/swap/quote to obtain a price quote for your desired trading pair. This endpoint returns a quote_id along with detailed information about the exchange rate and amounts.
Apifox/1.0.0 (https://apifox.com)application/json*/*127.0.0.1:8942keep-aliveE.g.: runes-THIRD•THIRD•TEST•TEO/btc-BTC, the latter is the quote currency
buy/sell, if runes is at the front, it means buy runes or sell runes
Quantity
Whether to use channel payment
POST /taker/api/swap/quote HTTP/1.1
Host: 127.0.0.1:8090
Authorization: text
User-Id: text
User-Agent: text
Accept: text
Connection: text
Content-Type: application/json
Content-Length: 107
{
"symbol": "runes-DOG•GO•TO•THE•MOON/btc-BTC",
"side": "sell",
"quantity": "4000",
"enable_channel": true
}{
"code": 0,
"msg": "",
"data": {
"quote_id": "qt_1998957042239864832",
"symbol": "runes-DOG•GO•TO•THE•MOON/btc-BTC",
"from": {
"coin_type": "btc",
"tick": "BTC",
"token_id": "",
"amount": "8195"
},
"to": {
"coin_type": "runes",
"tick": "DOG•GO•TO•THE•MOON",
"token_id": "",
"amount": "1000"
},
"price": "1.2 DOG•GO•TO•THE•MOON/sat"
},
"req_id": "1998957042151817216"
}Step 2: Submit Trade - Use /taker/api/swap/submit with the quote_id from step 1 to execute the trade. This allows you to review the quote before committing to the transaction.
Apifox/1.0.0 (https://apifox.com)application/json*/*127.0.0.1:8942keep-alivePOST /taker/api/swap/submit HTTP/1.1
Host: 127.0.0.1:8090
Authorization: text
User-Id: text
User-Agent: text
Accept: text
Connection: text
Content-Type: application/json
Content-Length: 88
{
"quote_id": "qt_1992877903283023872",
"fee_rate": 2,
"slippage": "12",
"enable_channel": true
}{
"code": 0,
"msg": "",
"data": {
"order_id": "dex_v2_mt_lighting_1999015317438267392",
"tx_id": "4e3efcb6bddc03c9c38549b89649a6676f31d450c05590ccacd3e877a1016dad"
},
"req_id": "1999015317430054912"
}2. Quick Trading
For streamlined trading without separate quote generation:
Quick Trade - Use /taker/api/swap/quick to get a quote and submit the trade in a single request. This endpoint combines both steps for faster execution when immediate trading is desired.
Apifox/1.0.0 (https://apifox.com)application/json*/*127.0.0.1:8942keep-aliveE.g.: runes-THIRD•THIRD•TEST•TEO/btc-BTC, the latter is the quote currency
buy/sell, if runes is at the front, it means buy runes or sell runes
Quantity
Whether to use channel payment
POST /taker/api/swap/quick HTTP/1.1
Host: 127.0.0.1:8090
Authorization: text
User-Id: text
User-Agent: text
Accept: text
Connection: text
Content-Type: application/json
Content-Length: 138
{
"symbol": "runes-THIRD•THIRD•TEST•TEO-/btc-BTC-",
"side": "sell",
"quantity": "4000",
"fee_rate": 2,
"slippage": "12",
"enable_channel": true
}{}Last updated