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

# Venues

> What the API supports on Kalshi, Polymarket, Polymarket US, Hyperliquid and Lighter.

Lean trades on five venues: Kalshi, Polymarket, Polymarket US, Hyperliquid and Lighter. One sports
market can list on several of them, and Lean reads every listing's book, prices the order across
them and places it where it fills best. Lighter lists crypto markets, which trade on Lighter alone.
This page shows what each venue supports, so you know where an order can go before you send it.

Wherever a request or response names a venue, `venue` is one of `kalshi`, `polymarket`,
`polymarket_us` or `hyperliquid`. Markets, books, prices, trades, candles, the stream, orders,
fills, positions, PnL, canceling every open order, closing positions, the account config's
`venues`, transfers and a trading account's allowed venues can also name `lighter`. A stop loss, limit chase or conditional sell naming `lighter` is refused
with `422` and reason `NO_EXECUTABLE_VENUE`.

## What each venue supports

| Feature | Kalshi | Polymarket | Polymarket US | Hyperliquid | Lighter |
| - | - | - | - | - | - |
| [Markets](https://docs.lean.xyz/markets.md), books, trades, candles and prices | Yes | Yes | Yes | Yes | Yes |
| [Previews](https://docs.lean.xyz/preview.md) | Yes | Yes | Yes | Yes | Yes |
| [Quotes](https://docs.lean.xyz/markets.md#quotes-and-liquidity) | Yes | Yes | Yes | Yes | No |
| [Orders](https://docs.lean.xyz/orders.md) and cancels | Yes | Yes | Yes | Yes | Yes |
| Amends | Yes | Yes | Yes | Yes | No |
| Fills, positions and PnL | Yes | Yes | Yes | Yes | Yes |
| Balances | Yes | Yes | Yes | Yes | No |
| [Stop losses](https://docs.lean.xyz/stop-losses.md) and take profits | Yes | Yes | Yes | Yes | No |
| [Limit chases](https://docs.lean.xyz/limit-chases.md) | Yes | Yes | Yes | Yes | No |
| [Conditional sells](https://docs.lean.xyz/conditional-sells.md) | Yes | Yes | Yes | Yes | No |
| `gtc` orders | Yes | Yes | Yes | Yes | No |
| `post_only` orders | Yes | No | Yes | Yes | Yes |
| `gtd` orders | Yes | Yes | Yes | Yes | Yes |
| `fok` orders | Yes | Yes | No | No | No |
| Paying for a buy with cash on another venue, and `best_price` | No | Yes | No | Yes | No |
| [Self signed routed orders](https://docs.lean.xyz/routed-orders.md) | No | Yes | No | Yes | No |
| [Deposits and withdrawals](https://docs.lean.xyz/funding.md) | No | Yes | No | Yes | No |
| [Transfers](https://docs.lean.xyz/transfers.md) | No | Yes | No | Yes | Live keys only |
| [Test mode](https://docs.lean.xyz/test-mode.md) | Yes | Yes | Yes | Yes | Yes |

## Lighter

Lighter lists crypto price markets on BTC and ETH. Each one asks whether the price ends a 15 minute
window up or down. A window is two markets, Up and Down, with `kind` `time_window` and
`category` `crypto`. List them with `GET /v1/markets?category=crypto` or
`GET /v1/markets?venue=lighter`. See [Crypto windows](https://docs.lean.xyz/markets.md#crypto-windows).

Preview, place and cancel orders on them with the usual order routes. Every window closes when it
ends, so its orders follow the window:

* `time_in_force` is `gtd` or `ioc`. `gtc` and `fok` are refused, and nothing rests past the window
  end.
* A `gtd` order's `expires_at` is at or before the window end and at least 6 minutes away. Closer to
  the end, use `ioc`.
* Orders are sized in shares, at least 5, at a whole cent from `0.01` to `0.99`.
* An order trades on Lighter alone, paid from the Lighter account's own cash. `venues`,
  `best_price` and `all_or_none` are refused.
* `post_only` orders must use `gtd`.
* Orders cannot be amended. Cancel and place a new one.
* `POST /v1/positions/close` sells Lighter positions with the rest. Its limit sells on Lighter are
  `ioc`, whatever `time_in_force` asks, and each sell is at least 5 shares.
* A window that has ended no longer trades, so an order or preview on it returns
  `409 MARKET_NOT_TRADABLE`.

A live order needs a Lighter account connected to the key's trading account in the Lean app. If a
trading account limits its venues, include `lighter` in its allowed venues to trade Lighter
markets. Otherwise orders on Lighter are refused with `VENUE_NOT_ALLOWED`.

Move USDC to and from Lighter with [transfers](https://docs.lean.xyz/transfers.md). Test keys cannot name `lighter` in a
transfer.

## Accounts and venue API keys

Polymarket and Hyperliquid balances belong to a trading account. Each trading account has its own
cash and shares there.

Kalshi and Polymarket US accounts belong to the user. Every trading account and API key of the user
shares the same Kalshi and Polymarket US cash and shares, so `GET /v1/balances` and
`GET /v1/positions` show the same figures for those venues under each of them.

A live order on Kalshi or Polymarket US goes out under the user's own API key for that venue. Connect
it once in the Lean app:

* Without it, a live order that needs that venue is refused with `403 FORBIDDEN`. Connect the key,
  or leave the venue out with `venues`.
* Test keys never reach a venue, so test orders on Kalshi and Polymarket US need no venue key.

## Naming markets

Each venue listing of a market is a leg with its own `ticker`:

| Venue | Leg `ticker` |
| - | - |
| Kalshi | The Kalshi market ticker, such as `KXNBAGAME-…` |
| Polymarket | Starts with `pm:`, such as `pm:0x…` |
| Polymarket US | Starts with `pmus:` |
| Hyperliquid | Starts with `hl:`, such as `hl:12` |
| Lighter | Starts with `lt:`, such as `lt:120` |

`GET /v1/markets?symbol=` takes any of these tickers and lists the markets that trade it, so you can
find the Lean market ID for a Kalshi or Polymarket US market. A Lighter `lt:` ticker lists both the
Up and the Down market of its window. `GET /v1/markets?venue=` lists only
markets with a leg on that venue. Store the market ID and use it everywhere else. See
[Market IDs](https://docs.lean.xyz/markets.md#market-ids).

## Cash on each venue

| Venue | Cash | How to fund it |
| - | - | - |
| Kalshi | USD | On Kalshi directly |
| Polymarket | pUSD | Lean [deposits](https://docs.lean.xyz/funding.md) and [transfers](https://docs.lean.xyz/transfers.md) |
| Polymarket US | USD | On Polymarket US directly |
| Hyperliquid | USDC in spot | Lean [deposits](https://docs.lean.xyz/funding.md) and [transfers](https://docs.lean.xyz/transfers.md) |
| Lighter | USDC | Lean [transfers](https://docs.lean.xyz/transfers.md) from another venue |

Lean routes an order only to the venues that can pay for it. Between Polymarket and Hyperliquid, a
buy can pay with cash on the other venue: Lean moves the cash and buys on the venue with the book,
in the same call, and the order's `route` says so. A buy on Kalshi or Polymarket US pays with the
cash already on that venue. Shares never move between venues, so a sell or a stop loss sells on the
venue that holds the shares.

A test key starts with 10,000 simulated on each venue: USD on Kalshi and Polymarket US, pUSD on
Polymarket and USDC on Hyperliquid.

## Order terms on each venue

Each venue takes prices only on its own tick:

| Venue | Tick | Prices |
| - | - | - |
| Kalshi | Set by Kalshi for each market, such as `0.01`. | From one tick to 1 minus one tick. |
| Polymarket | Set by Polymarket for each market, such as `0.01` or `0.001`. | From one tick to 1 minus one tick. |
| Polymarket US | Set by Polymarket US for each market, such as `0.01`. | From one tick to 1 minus one tick. |
| Hyperliquid | `0.00001` | From `0.00001` to `0.99999`. |

`limit_price` must sit on the tick of every venue that could place the order. Lean never rounds it.

`quantity` moves in steps of `0.01` on Kalshi, Polymarket and Polymarket US, and in whole shares on
Hyperliquid. Lean refuses a quantity off those steps with `400 VALIDATION_ERROR`, except
on a sell of your whole position, which it rounds down to the step and leaves the rest held. See
[Quantity steps](https://docs.lean.xyz/orders.md#quantity-steps).

Some order terms narrow the venues an order can reach:

* A `post_only` order rests on Kalshi, Polymarket US or Hyperliquid. Polymarket can't rest a post
  only order.
* A `gtd` order can go to any venue. Hyperliquid has no order expiry, so Lean cancels what is left
  there at `expires_at`.
* A `fok` order goes whole to one venue: Polymarket, else Kalshi. Hyperliquid has no fill or kill,
  and Polymarket US can fill part of a fill or kill order and expire the rest. Polymarket takes a
  `fok` buy sized with `notional` only, so a `fok` buy sized with `quantity` goes to Kalshi.

When no venue that lists the market can take the order, it is refused with
`400 VALIDATION_ERROR`. See [Orders](https://docs.lean.xyz/orders.md) for every term.

## Polymarket US and Lighter books

Lean reads Polymarket US and Lighter books from a live copy that starts on the first read of a
market and stops a few seconds after the last one. A read of a market no one read lately waits up
to a second for the copy. If it is still not ready:

* a quote, preview or order that needs the book answers `503 UPSTREAM_ERROR` with a `Retry-After`
  header, and nothing is placed. Send the same request again after that time.
* [`GET /v1/markets/{id}/book`](https://docs.lean.xyz/api-reference/markets/retrieve-market-book) and
  [`GET /v1/prices`](https://docs.lean.xyz/markets#prices) answer `200` and list the venue in `unavailable`, with the
  other venues' levels when the market has any. Read again after a moment.


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