Synpath
Events & Markets

Get order book

Resting orders on one side of a market, best price first.

GET/venues/{venue}/markets/{market_id}/bookself-hosted · no auth

Self-hosted. Served by synpath serve on your own machine or host, which must be running. Nothing on this page runs on Synpath's servers.

Bids descend, asks ascend, best first on both sides whatever the venue stores.

On Kalshi and Polymarket US one book serves both sides, so the NO view is the YES book reflected through the face value and the response says so with derived: true. On Polymarket the NO book is a real book of its own.

Path parameters

NameTypeDescription
venuestringVenue id: kalshi, polymarket or polymarket_us.
market_idstringA Synpath id (kalshi:KXFOO-25, polymarket:2252244) or this venue's own id. Another venue's id is refused.

Query parameters

NameTypeDescription
sidestring
default yes
yes or no. The prices come back in that side's terms.
depthintegerLevels per side, 1 to 1000. Omit for the whole book.

Response

The book.

import synpath

client = synpath.Client()
book = client.fetch_order_book("polymarket:2252244", depth=5)
print(book.best_bid, book.best_ask)

no = client.fetch_order_book("polymarket:2252244", side="no")
200
{
  "market_id": "kalshi:KXELONMARS-99",
  "side": "yes",
  "venue": "kalshi",
  "bids": [
    {
      "price": 0.1,
      "size": 79.35
    },
    {
      "price": 0.09,
      "size": 735.07
    },
    {
      "price": 0.08,
      "size": 1253
    }
  ],
  "asks": [
    {
      "price": 0.12,
      "size": 265.22
    },
    {
      "price": 0.13,
      "size": 1799.44
    },
    {
      "price": 0.14,
      "size": 10
    }
  ],
  "timestamp": null,
  "datetime": null,
  "book_model": "shared_complement",
  "derived": true,
  "depth_scope": "top_n",
  "info": {
    "...": "the venue's payload"
  },
  "best_bid": {
    "price": 0.1,
    "size": 79.35
  },
  "best_ask": {
    "price": 0.12,
    "size": 265.22
  }
}