For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

Taker Quote

post
Header parameters
AuthorizationstringRequired
User-IdstringRequired
User-AgentstringRequiredExample: Apifox/1.0.0 (https://apifox.com)
Content-TypestringRequiredExample: application/json
AcceptstringRequiredExample: */*
HoststringRequiredExample: 127.0.0.1:8942
ConnectionstringRequiredExample: keep-alive
Body
symbolstringRequired

E.g.: runes-THIRD•THIRD•TEST•TEO/btc-BTC, the latter is the quote currency

sidestringRequired

buy/sell, if runes is at the front, it means buy runes or sell runes

quantitystringRequired

Quantity

enable_channelbooleanRequired

Whether to use channel payment

Responses
200Success
application/json
codeintegerRequired
msgstringRequired
req_idstringRequired
post/taker/api/swap/quote
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
}
200Success
{
  "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.

Taker Submit Quote

post
Header parameters
AuthorizationstringRequired
User-IdstringRequired
User-AgentstringRequiredExample: Apifox/1.0.0 (https://apifox.com)
Content-TypestringRequiredExample: application/json
AcceptstringRequiredExample: */*
HoststringRequiredExample: 127.0.0.1:8942
ConnectionstringRequiredExample: keep-alive
Body
quote_idstringRequired
fee_rateintegerRequired
slippagestringRequired
enable_channelbooleanRequired
Responses
200Success
application/json
codeintegerRequired
msgstringRequired
req_idstringRequired
post/taker/api/swap/submit
POST /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
}
200Success
{
  "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.

Taker Quick Trade

post
Header parameters
AuthorizationstringRequired
User-IdstringRequired
User-AgentstringRequiredExample: Apifox/1.0.0 (https://apifox.com)
Content-TypestringRequiredExample: application/json
AcceptstringRequiredExample: */*
HoststringRequiredExample: 127.0.0.1:8942
ConnectionstringRequiredExample: keep-alive
Body
symbolstringRequired

E.g.: runes-THIRD•THIRD•TEST•TEO/btc-BTC, the latter is the quote currency

sidestringRequired

buy/sell, if runes is at the front, it means buy runes or sell runes

quantitystringRequired

Quantity

fee_rateintegerRequired
slippagestringRequired
enable_channelbooleanRequired

Whether to use channel payment

Responses
200Success
application/json
objectOptional
post/taker/api/swap/quick
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
}
200Success
{}

Last updated