#!/bin/sh
# getOrderbook: Get a market's order book on one venue. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base.
curl -sS "${TRENDLINE_API_BASE:-https://systems.trendlinelabs.ai}/public/v1/markets/mk-btc-100k-2026/orderbook?venue=kalshi&depth=2" \
-H "Authorization: Bearer $TRENDLINE_API_KEY""""getOrderbook: Get a market's order book on one venue. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base."""
import os
import requests
BASE = os.environ.get("TRENDLINE_API_BASE", "https://systems.trendlinelabs.ai")
KEY = os.environ["TRENDLINE_API_KEY"]
r = requests.get(f"{BASE}/public/v1/markets/mk-btc-100k-2026/orderbook", params={"venue": "kalshi", "depth": "2"},
headers={"Authorization": f"Bearer {KEY}"}, timeout=10)
r.raise_for_status()
print(r.json())
// getOrderbook: Get a market's order book on one venue. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base.
const BASE = process.env.TRENDLINE_API_BASE ?? "https://systems.trendlinelabs.ai";
const KEY = process.env.TRENDLINE_API_KEY;
const r = await fetch(`${BASE}/public/v1/markets/mk-btc-100k-2026/orderbook?venue=kalshi&depth=2`, { headers: { Authorization: `Bearer ${KEY}` } });
console.log(r.status, await r.json());
{
"age_ms": 1500,
"as_of_ms": 1791266400000,
"max_age_s": 1200,
"no": {
"asks": [
{
"price": 0.6,
"size": 150
}
],
"bids": [
{
"price": 0.59,
"size": 310
}
]
},
"no_source": "book",
"ts_ms": 1791266398500,
"universal_id": "mk-btc-100k-2026",
"venue": "kalshi",
"venue_market_id": "KXBTC-26DEC31-B100000",
"yes": {
"asks": [
{
"price": 0.41,
"size": 310
},
{
"price": 0.42,
"size": 90
}
],
"bids": [
{
"price": 0.4,
"size": 150
},
{
"price": 0.39,
"size": 400
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}Get a market's order book on one venue
A market’s live L2 book on one venue: YES and NO ladders with at most depth levels a side. Prices are 0..1; sizes are in contracts.
The NO side
no_source: book: the venue’s own NO book, while it is live.no_source: derived: computed as 1 - YES. Approximate on Polymarket, whose YES and NO are two real books.
Freshness
ts_ms: when the book last changed, so a quiet live book can be old.age_ms: how old the book is now;max_age_s: the oldest this venue’s book may be before it is refused.
Errors
| Status | Code | When |
|---|---|---|
| 422 | venue_unsupported | A venue whose books are not served. |
| 404 | not_found | Unknown market. |
| 404 | venue_not_listed | The market has no leg on that venue. |
| 410 | market_closed | The leg no longer trades. |
| 503 | dependency_unavailable | Our store is unavailable. |
| 503 | upstream_unavailable | No live book, no timestamp, a timestamp in the future, older than the venue’s bound, or market data unreadable. |
Any route can also answer 401, 403, 429, 500 or 503 dependency_unavailable, described on the Errors page.
#!/bin/sh
# getOrderbook: Get a market's order book on one venue. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base.
curl -sS "${TRENDLINE_API_BASE:-https://systems.trendlinelabs.ai}/public/v1/markets/mk-btc-100k-2026/orderbook?venue=kalshi&depth=2" \
-H "Authorization: Bearer $TRENDLINE_API_KEY""""getOrderbook: Get a market's order book on one venue. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base."""
import os
import requests
BASE = os.environ.get("TRENDLINE_API_BASE", "https://systems.trendlinelabs.ai")
KEY = os.environ["TRENDLINE_API_KEY"]
r = requests.get(f"{BASE}/public/v1/markets/mk-btc-100k-2026/orderbook", params={"venue": "kalshi", "depth": "2"},
headers={"Authorization": f"Bearer {KEY}"}, timeout=10)
r.raise_for_status()
print(r.json())
// getOrderbook: Get a market's order book on one venue. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base.
const BASE = process.env.TRENDLINE_API_BASE ?? "https://systems.trendlinelabs.ai";
const KEY = process.env.TRENDLINE_API_KEY;
const r = await fetch(`${BASE}/public/v1/markets/mk-btc-100k-2026/orderbook?venue=kalshi&depth=2`, { headers: { Authorization: `Bearer ${KEY}` } });
console.log(r.status, await r.json());
{
"age_ms": 1500,
"as_of_ms": 1791266400000,
"max_age_s": 1200,
"no": {
"asks": [
{
"price": 0.6,
"size": 150
}
],
"bids": [
{
"price": 0.59,
"size": 310
}
]
},
"no_source": "book",
"ts_ms": 1791266398500,
"universal_id": "mk-btc-100k-2026",
"venue": "kalshi",
"venue_market_id": "KXBTC-26DEC31-B100000",
"yes": {
"asks": [
{
"price": 0.41,
"size": 310
},
{
"price": 0.42,
"size": 90
}
],
"bids": [
{
"price": 0.4,
"size": 150
},
{
"price": 0.39,
"size": 400
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}Authorizations
Authorization: Bearer tl_live_…
Path Parameters
no control, format, private-use, unassigned, line or paragraph separator character
1 - 256Query Parameters
the venue whose book to read
kalshi, polymarket, limitless, predictfun levels per side
1 <= x <= 10Response
Successful Response
now - ts_ms, floored at 0
when the book was read, unix milliseconds
the age bound applied to this venue
the NO book
Show child attributes
Show child attributes
book: the venue's own NO book; derived: 1 - the YES book, approximate on Polymarket, whose YES and NO are two real books
book, derived the YES book's last change, unix ms
the market universal id
the venue this book is from
kalshi, polymarket, limitless, predictfun the market's id on this venue
the YES book
Show child attributes
Show child attributes