> For the complete documentation index, see [llms.txt](https://docs.openmm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openmm.io/api-reference/overview.md).

# API Overview

OpenMM provides a REST API built with Fastify, featuring automatic OpenAPI documentation.

## Base URL

```
http://localhost:3000/api/v1
```

## Starting the Server

```bash
openmm serve --port 3000
```

Options:

* `--port` — Port number (default: 3000)
* `--host` — Host address (default: 0.0.0.0)

## Interactive Documentation

Swagger UI is available at:

```
http://localhost:3000/docs
```

## Response Format

All responses are JSON with consistent structure:

### Success Response

```json
{
  "exchange": "mexc",
  "symbol": "BTC/USDT",
  "data": { ... },
  "timestamp": 1710000000000
}
```

### Error Response

```json
{
  "error": "Error message here"
}
```

## HTTP Status Codes

| Code | Description                        |
| ---- | ---------------------------------- |
| 200  | Success                            |
| 400  | Bad Request — Invalid parameters   |
| 404  | Not Found — Resource doesn't exist |
| 500  | Server Error — Internal error      |

## Endpoints Summary

### Market Data

| Method | Endpoint   | Description                 |
| ------ | ---------- | --------------------------- |
| GET    | /ticker    | Get ticker for trading pair |
| GET    | /orderbook | Get order book              |
| GET    | /trades    | Get recent trades           |

### Account

| Method | Endpoint | Description          |
| ------ | -------- | -------------------- |
| GET    | /balance | Get account balances |

### Orders

| Method | Endpoint    | Description       |
| ------ | ----------- | ----------------- |
| GET    | /orders     | List open orders  |
| GET    | /orders/:id | Get order by ID   |
| POST   | /orders     | Create new order  |
| DELETE | /orders/:id | Cancel order      |
| DELETE | /orders     | Cancel all orders |

### Strategy

| Method | Endpoint              | Description            |
| ------ | --------------------- | ---------------------- |
| POST   | /strategy/grid        | Start grid strategy    |
| DELETE | /strategy/grid        | Stop grid strategy     |
| GET    | /strategy/grid/status | Get strategy status    |
| GET    | /strategy/grid/list   | List active strategies |

### Cardano DEX

| Method | Endpoint               | Description              |
| ------ | ---------------------- | ------------------------ |
| GET    | /cardano/price/:symbol | Get token price          |
| GET    | /cardano/pools/:symbol | Discover liquidity pools |

### Price Comparison

| Method | Endpoint       | Description                     |
| ------ | -------------- | ------------------------------- |
| GET    | /price/compare | Compare prices across exchanges |

## Supported Exchanges

| ID     | Name    | Status         |
| ------ | ------- | -------------- |
| mexc   | MEXC    | ✅ Full support |
| gateio | Gate.io | ✅ Full support |
| bitget | Bitget  | ✅ Full support |
| kraken | Kraken  | ✅ Full support |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.openmm.io/api-reference/overview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
