# Stellar DEX (SDEX) Order Book & Trades API
> The Stellar Decentralized Exchange (SDEX) central-limit order book, live from the public Stellar Horizon API — no key, nothing cached. Where the pools reader covers Stellar's AMM and the asset reader covers token metadata, this surfaces the on-chain order book the others miss. Pull the live bids and asks for any asset pair with their price and amount, plus the derived best bid, best ask, mid price and spread. Get a compact ticker for a pair — best bid/ask, mid, spread and the last executed trade. And read the most recent executed trades, network-wide or filtered to a single pair, with their price and base/counter amounts. Defaults to the deeply-traded XLM/USDC pair; quote any pair by passing the selling and buying assets (asset code plus issuer, or XLM for native). The order-book-and-trading layer for Stellar wallets, swap UIs, market-makers and analytics. Live from horizon.stellar.org.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/stellardex-api/..."
```

## Pricing
- **Free** (Free) — 6,800 calls/Mo, 3 req/s
- **Starter** ($11/Mo) — 132,000 calls/Mo, 9 req/s
- **Pro** ($37/Mo) — 768,000 calls/Mo, 22 req/s
- **Business** ($100/Mo) — 4,900,000 calls/Mo, 55 req/s

## Endpoints

### Order Book

#### `GET /v1/orderbook` — Live order book for a pair (bids/asks, best bid/ask, mid, spread)

**Parameters:**
- `selling` (query, optional, string) — Selling asset code (XLM for native); default XLM Example: `XLM`
- `buying` (query, optional, string) — Buying asset code; default USDC Example: `USDC`
- `buy_issuer` (query, optional, string) — Issuer of the buying asset (required for non-native) Example: `GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN`
- `limit` (query, optional, string) — Order book depth (1-50) Example: `20`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/stellardex-api/v1/orderbook?selling=XLM&buying=USDC&buy_issuer=GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN&limit=20"
```

**Response:**
```json
{
    "data": {
        "asks": [
            {
                "price": 0.186428,
                "amount": 4476.9567818
            },
            {
                "price": 0.1864281,
                "amount": 4759.1384341
            },
            {
                "price": 0.1865438,
                "amount": 5000
            },
            {
                "price": 0.1865458,
                "amount": 5000
            },
            {
                "price": 0.18655239,
                "amount": 8000
            },
            {
                "price": 0.18662528611755896,
                "amount": 226.8538417
            },
            {
                "price": 0.18665489000000002,
                "amount": 5000
            },
            {
                "price": 0.1866549,
                "amount": 1000
            },
            {
                "price": 0.18670004863536266,
                "amount": 219.7724838
            },
            {
                "price": 0.18674819,
                "amount": 2400
            },
            {
                "price": 0.1867482,
                "amount": 1000
            },
            {
                "price": 0.18684139,
                "amount": 1600
            },
            {
                "price": 0.1868414,
                "amount": 1000
            },
            {
                "price": 0.1869346,
                "amount": 1000
            },
            {
                "price": 0.18699928603672591,

…(truncated, see openapi.json for full schema)
```

### Ticker

#### `GET /v1/ticker` — Compact pair ticker: best bid/ask, mid, spread, last trade

**Parameters:**
- `selling` (query, optional, string) — Selling asset code; default XLM Example: `XLM`
- `buying` (query, optional, string) — Buying asset code; default USDC Example: `USDC`
- `buy_issuer` (query, optional, string) — Issuer of the buying asset Example: `GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/stellardex-api/v1/ticker?selling=XLM&buying=USDC&buy_issuer=GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN"
```

**Response:**
```json
{
    "data": {
        "note": "A compact Stellar DEX ticker for the pair: best bid/ask, mid price, spread and the last executed trade. Defaults to XLM/USDC; pass selling & buying to quote any pair.",
        "buying": "USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
        "source": "Stellar Horizon",
        "spread": 0.0002128,
        "selling": "XLM",
        "best_ask": 0.186428,
        "best_bid": 0.18621516193642912,
        "mid_price": 0.18632158096821455,
        "last_trade": {
            "time": "2026-06-14T08:03:43Z",
            "price": 0.186428
        },
        "spread_pct": 0.1142
    },
    "meta": {
        "timestamp": "2026-06-14T08:03:48.139Z",
        "request_id": "c1149f8b-09ca-4a37-b138-789cba972348"
    },
    "status": "ok",
    "message": "Ticker retrieved successfully",
    "success": true
}
```

### Trades

#### `GET /v1/trades` — Recent executed trades, network-wide or for a pair

**Parameters:**
- `limit` (query, optional, string) — Number of trades (1-100) Example: `25`
- `selling` (query, optional, string) — Optional: base asset code to filter a pair Example: `XLM`
- `buying` (query, optional, string) — Optional: counter asset code Example: `USDC`
- `buy_issuer` (query, optional, string) — Issuer of the counter asset Example: `GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/stellardex-api/v1/trades?limit=25&selling=XLM&buying=USDC&buy_issuer=GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN"
```

**Response:**
```json
{
    "data": {
        "note": "Most recent executed trades on the Stellar DEX (newest first). Without a pair this is the network-wide trade feed; pass selling & buying to filter to one pair. price is counter per base.",
        "pair": "XLM / USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
        "count": 25,
        "source": "Stellar Horizon",
        "trades": [
            {
                "price": 0.186428,
                "base_asset": "XLM",
                "base_amount": 0.0009596,
                "counter_asset": "USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
                "base_is_seller": true,
                "counter_amount": 0.0001789,
                "ledger_close_time": "2026-06-14T08:03:43Z"
            },
            {
                "price": 0.186428,
                "base_asset": "XLM",
                "base_amount": 0.0010068,
                "counter_asset": "USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
                "base_is_seller": true,
                "counter_amount": 0.0001877,
                "ledger_close_time": "2026-06-14T08:03:43Z"
            },
            {
                "price": 0.186428,
                "base_asset": "XLM",
                "base_amount": 0.0010078,
                "counter_asset": "USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
                "base_is_seller": true,
                "counter_amount": 0.0001879,
                "ledger_close_
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Service metadata

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/stellardex-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "sample": {
            "pair": "XLM/USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
            "mid_price": 0.18632158096821455
        },
        "source": "public Stellar Horizon API (horizon.stellar.org /order_book, /trades), keyless",
        "service": "stellardex-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/ticker": "Compact pair ticker: best bid/ask, mid, spread, last trade (default XLM/USDC).",
            "GET /v1/trades": "Recent executed trades, network-wide or for a pair (limit; optional selling & buying).",
            "GET /v1/orderbook": "Live order book for a pair: bids/asks, best bid/ask, mid, spread (selling, buying; default XLM/USDC)."
        },
        "description": "Read the Stellar Decentralized Exchange (SDEX) central-limit order book live from the public Horizon API: live bids/asks for any pair with derived best bid/ask, mid and spread; a compact pair ticker; and the most recent executed trades (network-wide or per pair). The order-book-and-trading layer for Stellar wallets, swap UIs and market-makers. Live, short cache only.",
        "upstream_status": "ok"
    },
    "meta": {
        "timestamp": "2026-06-14T08:03:48.447Z",
        "request_id": "d69d2d3e-992b-41c8-97f9-7523fe2c8b0d"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/stellardex-api
OpenAPI spec: https://www.oanor.com/api/stellardex-api/openapi.json
