# 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.

## POST /taker/api/swap/quote

> Taker Quote

```json
{"openapi":"3.1.0","info":{"title":"","version":"1.0.0"},"servers":[{"url":"http://127.0.0.1:8090","description":"Local"}],"security":[],"paths":{"/taker/api/swap/quote":{"post":{"summary":"Taker Quote","deprecated":false,"description":"","tags":[],"parameters":[{"name":"Authorization","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"User-Id","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Content-Type","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Host","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Connection","in":"header","description":"","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"symbol":{"type":"string","description":"E.g.: runes-THIRD•THIRD•TEST•TEO/btc-BTC, the latter is the quote currency"},"side":{"type":"string","description":"buy/sell, if runes is at the front, it means buy runes or sell runes"},"quantity":{"type":"string","description":"Quantity"},"enable_channel":{"type":"boolean","description":"Whether to use channel payment"}},"required":["symbol","side","quantity","enable_channel"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","properties":{"quote_id":{"type":"string"},"symbol":{"type":"string"},"from":{"type":"object","properties":{"coin_type":{"type":"string"},"tick":{"type":"string"},"token_id":{"type":"string"},"amount":{"type":"string"}},"required":["coin_type","tick","token_id","amount"]},"to":{"type":"object","properties":{"coin_type":{"type":"string"},"tick":{"type":"string"},"token_id":{"type":"string"},"amount":{"type":"string"}},"required":["coin_type","tick","token_id","amount"]},"price":{"type":"string"}},"required":["quote_id","symbol","from","to","price"]},"req_id":{"type":"string"}},"required":["code","msg","data","req_id"]}}},"headers":{}}}}}}}
```

**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.

## POST /taker/api/swap/submit

> Taker Submit Quote

```json
{"openapi":"3.1.0","info":{"title":"","version":"1.0.0"},"servers":[{"url":"http://127.0.0.1:8090","description":"Local"}],"security":[],"paths":{"/taker/api/swap/submit":{"post":{"summary":"Taker Submit Quote","deprecated":false,"description":"","tags":[],"parameters":[{"name":"Authorization","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"User-Id","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Content-Type","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Host","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Connection","in":"header","description":"","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"quote_id":{"type":"string"},"fee_rate":{"type":"integer"},"slippage":{"type":"string"},"enable_channel":{"type":"boolean"}},"required":["quote_id","fee_rate","slippage","enable_channel"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","properties":{"order_id":{"type":"string"},"tx_id":{"type":"string"}},"required":["order_id","tx_id"]},"req_id":{"type":"string"}},"required":["code","msg","data","req_id"]}}},"headers":{}}}}}}}
```

## 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.

## POST /taker/api/swap/quick

> Taker Quick Trade

```json
{"openapi":"3.1.0","info":{"title":"","version":"1.0.0"},"servers":[{"url":"http://127.0.0.1:8090","description":"Local"}],"security":[],"paths":{"/taker/api/swap/quick":{"post":{"summary":"Taker Quick Trade","deprecated":false,"description":"","tags":[],"parameters":[{"name":"Authorization","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"User-Id","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Content-Type","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Host","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Connection","in":"header","description":"","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"symbol":{"type":"string","description":"E.g.: runes-THIRD•THIRD•TEST•TEO/btc-BTC, the latter is the quote currency"},"side":{"type":"string","description":"buy/sell, if runes is at the front, it means buy runes or sell runes"},"quantity":{"type":"string","description":"Quantity"},"fee_rate":{"type":"integer"},"slippage":{"type":"string"},"enable_channel":{"type":"boolean","description":"Whether to use channel payment"}},"required":["symbol","side","quantity","enable_channel","fee_rate","slippage"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{}}}},"headers":{}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.on.nexus/dotswap/developers/nexus-protocol/taker/trade.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
