> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gains.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# Market data

> Markets, prices, the virtual order book, candles, recent trades and funding. All public, no credentials.

Public endpoints need no headers. They are rate limited per IP; use the [WebSocket](https://docs.gains.trade/developer/trading-api/websocket.md) for anything you would otherwise poll.

## Markets

`GET /v1/{chain}/markets` lists every pair with everything you need before placing an order:

| Field | Use |
| - | - |
| `symbol`, `pairIndex` | `symbol` (`BTC/USD`) in bodies; `pairIndex` for on-chain correlation. `pairIndex` is also the Hyperliquid asset id on the facade. |
| `group`, `isOpen` | `crypto`, `forex`, `stocks`, `indices`, `commodities`, and whether the session is open now. |
| `minLeverage`, `maxLeverage` | Accepted leverage range. |
| `minCollateralUsd`, `minPositionUsd` | Smallest collateral a new position accepts (five times the minimum fee), and that collateral at the minimum leverage. The API rejects an order whose notional is below `minPositionUsd` with `SIZE_BELOW_MINIMUM`. |
| `pricePrecision`, `sizePrecision` | Maximum decimals for prices and sizes. |
| `spreadRate` | Fixed spread as a fraction of price (`0.0004` = 0.04 %). Half of it is charged on each fill, on open and on close; price impact comes on top. |
| `fees.openFeeRate`, `fees.closeFeeRate` | Fractions of position size (`0.00035` = 0.035 %), before fee-tier or referral discounts. On pairs with a close fee decay configured, a position closed soon after opening can pay a different closing rate. |
| `fees.minPositionSizeUsd` | Fee floor: a position smaller than this pays the fee of a position this size, so the minimum fee on each open and each close is `minPositionSizeUsd` × fee rate. It is not a minimum trade size. |
| `funding` | Current hourly funding and borrowing rates, open interest per side, skew. |
| `collaterals` | Tokens accepted as collateral on this chain, with decimals and address. |
| `onlyIsolated` | Always `true` in v1. |

`GET /v1/{chain}/markets/{symbol}` returns one market. Write the symbol as `BTC-USD` or `BTC%2FUSD` in the path.

## Prices

`GET /v1/{chain}/prices` returns the `mark` and `index` price of every market. Mark is the execution price (spot plus skew for core crypto, futures for volatile crypto); index is the price liquidations use. They differ on volatile crypto pairs and are equal elsewhere. Updates arrive every 25 ms on the `prices` WebSocket channel.

## Order book

`GET /v1/{chain}/markets/{symbol}/book?levels=20`

Gains has no resting order book: execution goes through shared vault liquidity with deterministic price impact. The endpoint returns the **virtual order book** derived from the on-chain depth bands: each level is the liquidity available at that price offset, exactly what the trading interface displays.

```json theme={null}
{
  "market": "BTC/USD",
  "markPrice": "65000",
  "bids": [{ "price": "64993.5", "size": "3.8461", "sizeUsd": "250000", "cumulativeUsd": "250000" }],
  "asks": [{ "price": "65006.5", "size": "3.8457", "sizeUsd": "250000", "cumulativeUsd": "250000" }],
  "timestamp": 1700000000000
}
```

`size` is in base asset, `sizeUsd` in USD, `cumulativeUsd` the depth from the mark to that level. Bids are ordered from the best (highest) price, asks from the best (lowest).

## Candles

`GET /v1/{chain}/markets/{symbol}/candles?interval=1h&from=1700000000000&to=1700086400000`

Intervals: `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d`. `from` and `to` are epoch milliseconds. Candles are mark-price OHLC; there is no volume on a synthetic book. The `candles` WebSocket channel streams the live candle.

## Recent trades

`GET /v1/{chain}/markets/{symbol}/trades?limit=100` returns the last executed trades on the market (opens, closes, liquidations), newest first, with `price`, `sizeUsd`, `side`, `action`, `timestamp` and `txHash`.

## Funding

`GET /v1/{chain}/markets/{symbol}/funding` returns the current rates:

| Field | Meaning |
| - | - |
| `fundingRateLongHourly` | Fraction of position size paid by longs per hour (`0.00001` = 0.001 % per hour). Negative means longs receive. |
| `fundingRateShortHourly` | Same for shorts. |
| `borrowingRateHourly` | Fraction of position size paid per hour by both sides for vault liquidity. |
| `openInterestLongUsd`, `openInterestShortUsd`, `skewUsd` | Open interest and net exposure. |

Funding on Gains is velocity-based: the rate drifts with the skew instead of resetting every eight hours. Read the rate again before assuming it is constant.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.