# GET /v1/markets

> The keys of every market the recorder holds history for, one per line.

Lists the markets the recorder holds day segments for. Each line is a market key you can use with [`/v1/segments/`](/docs/api/segments).

## Request

```text
GET /v1/markets
HEAD /v1/markets
```

No parameters. A query string is ignored.

## Response

| Header | Value |
|---|---|
| `Content-Type` | `text/plain; charset=utf-8` |
| `Cache-Control` | `no-cache` |

The body has one market key per line, sorted, each line ending in a newline. With no markets yet the body is empty.

A market key is `<Venue>_<SYMBOL>`:

| Part | Values |
|---|---|
| `Venue` | `BinanceSpot`, `BinanceUsdm`, `Bybit`, `Okx`, `Hyperliquid` |
| `SYMBOL` | The venue's own symbol, with any character other than ASCII letters, digits and `-` replaced by `_` |

## How the list is built

The list is every directory in the data directory whose name is a valid market key, except the Hyperliquid directory `hl`. A market appears once its first day segment has been saved, usually within one save interval (60 s by default) of the recorder starting.

Markets that are no longer recorded stay in the list as long as their directory exists, so you can still read their history.

## Status codes

| Status | When |
|---|---|
| `200` | Always, even with an empty list |
| `405` | A method other than `GET` or `HEAD` |

## Example

```bash
curl http://127.0.0.1:8787/v1/markets
```

```text
BinanceSpot_BTCUSDT
BinanceUsdm_BTCUSDT
Bybit_BTCUSDT
Hyperliquid_BTC
Okx_BTC-USDT-SWAP
```

Loop over every market and list its days:

```bash
BASE=http://127.0.0.1:8787
for key in $(curl -fsS $BASE/v1/markets); do
  echo "$key: $(curl -fsS $BASE/v1/segments/$key/ | wc -l) days"
done
```

## Related

- [`/v1/segments/<key>/`](/docs/api/segments#list-days) lists the days of one market.
- [`/v1/hl/coins`](/docs/api/hl-coins) lists the Hyperliquid coins whose positions are recorded. Those are separate from the `Hyperliquid_<COIN>` markets here, which hold footprints and context like any other market.
