Skip to main content
Synpath: one API for every prediction market

Synpath – One API for prediction markets Follow @Synpath_Dev on X

Build on prediction markets without building against each one.
One open-source API across Kalshi, Polymarket, Polymarket US and Opinion: market data, order entry, live streams, and an execution engine that remembers what it sent. In-process from Python, over REST and WebSocket from anywhere.

License: MIT Total Downloads Discord

🆕 New: Smart order routing across Kalshi and Polymarket.
One order, both order books combined, filled from the cheapest price after fees. See how it works →

⭐ If Synpath saves you time, star it on GitHub. It's how other traders find it.


Supported Exchanges

Exchange id Market data Order entry Streams Order books
Kalshi Kalshi kalshi ✓ ✓ WebSocket one book per market, both sides read it
Polymarket Polymarket polymarket ✓ ✓ WebSocket one book per outcome token
Polymarket US Polymarket US polymarket_us ✓ ✓ retail and exchange APIs WebSocket and gRPC one book per market, both sides read it
Opinion opinion ✓ ✓ not yet live-tested WebSocket (API key) one book per outcome token

Why Synpath

  • Liquidity is fragmented. Your time shouldn't be. The same market trades on Kalshi, Polymarket, Polymarket US and Opinion, each with its own API, units and quirks. Synpath gives you one interface for all of them, and smart order routing buys from whichever book is cheapest. Spend your time on alpha, not plumbing.

  • Traders deserve advanced order types. Stops, trailing stops, icebergs, OCO, brackets, TWAP and pegs, on every venue, even where the exchange has none. Orders are journaled before they're sent, so a crash never places one twice.

  • A home after Dome and pmxt. Dome's API shut down in April 2026, and pmxt hasn't shipped since July 2026. Synpath is MIT-licensed, actively maintained, and follows ccxt conventions.

Installation

pip install synpath              # market data, order entry, streams, the engine and the server
pip install "synpath[grpc]"      # + Polymarket US exchange gRPC streams

Python 3.10 or newer. The hot paths (order books, reading the venues' book streams, order signing and the order router) run on a Rust core that ships prebuilt inside the wheel for Linux, macOS and Windows; nothing else to install.

Hosted API. Run synpath login, then synpath keys create. It serves tick-level Kalshi order book and trade history, and cross-venue market matching. Trading stays on your machine: Synpath never holds your keys or funds.

Quick Start

Markets and quotes

import synpath

kalshi = synpath.Kalshi()
market = kalshi.fetch_markets(limit=1)[0]

print(market.title)                                # Will Elon Musk visit Mars before Aug 1, 2099?
print(market.yes.quote.bid, market.yes.quote.ask)  # 0.1 0.12

Order books and search

book = kalshi.fetch_order_book(market.id, depth=5)
book.best_bid, book.best_ask                       # best first on both sides
kalshi.fetch_order_book(market.id, side="no")      # what NO costs

markets = kalshi.fetch_markets(query="trump", limit=10)
fee = kalshi.fetch_fee_schedule(markets[0].id)
fee.estimate(price=0.50, contracts=100)            # 1.75

Same code, every venue

for venue_id in synpath.exchanges:                 # ['kalshi', 'polymarket', 'polymarket_us', 'opinion']
    with synpath.exchange(venue_id) as venue:
        page = venue.fetch_markets(limit=5)

client = synpath.Client()                          # or one client, routed by the id
client.fetch_market("polymarket:2252244")          # every id starts with its venue

Order entry

from decimal import Decimal
from synpath import KalshiTrading, OrderRequest, Side, load_credentials, require

async with KalshiTrading(require("kalshi", load_credentials())) as kalshi:
    order = await kalshi.create_order(OrderRequest(
        market_id=market.id, side=Side.BUY,          # buy takes YES, sell takes NO
        amount=Decimal("10"), price=Decimal("0.42"), # always the YES price
    ))

Live streams

from synpath import PolymarketMarketStream, BookEvent

async with PolymarketMarketStream() as stream:
    await stream.watch_order_book(["polymarket:2252244"])   # both sides of the market
    async for event in stream:
        if isinstance(event, BookEvent):
            print(event.market_id, event.side, event.best_bid, event.best_ask)

Smart order routing: one order across Kalshi and Polymarket

from synpath import Bucket, BucketMember, OrderType, PolymarketTrading
from synpath.engine import Engine, EngineConfig

creds = load_credentials()
async with KalshiTrading(require("kalshi", creds)) as kalshi, \
           PolymarketTrading(require("polymarket", creds)) as poly, \
           Engine({"kalshi": kalshi, "polymarket": poly}, EngineConfig(journal_path="trading.db")) as engine:
    # The same market on both venues; flip=True where a venue asks the question the other way round
    bucket = await engine.save_bucket(Bucket(book="alpha", name="Fed cut in December", members=[
        BucketMember(market_id="kalshi:KXFEDDECISION-26DEC-C25"),
        BucketMember(market_id="polymarket:2252244", flip=True),
    ]))
    # Both order books combined, each level net of fees, filled from the cheapest price outward
    await engine.submit(OrderRequest(
        market_id=bucket.market_id, side=Side.BUY, amount=Decimal("500"),
        type=OrderType.MARKET, price=Decimal("0.45"),   # the worst price you accept
        book="alpha",
    ))

REST server

python -m synpath.server                           # http://127.0.0.1:8000/docs
curl "localhost:8000/venues/kalshi/markets?limit=1"

Trading has its own app, with per-account keys and an append-only audit log:

python -m synpath.server bootstrap --control control.db     # the first key
python -m synpath.server schema --trading --out openapi.json
npx openapi-typescript openapi.json --default-non-nullable false -o src/synpath.d.ts

Documentation

See the API Reference for detailed documentation and more examples.

Development

git clone https://github.com/Synpath-ai/synpath
cd synpath
pip install -e ".[dev]"   # builds the Rust core too: needs a Rust toolchain (rustup.rs)

pytest              # offline, against recorded venue payloads
pytest -m live      # market data against the real venues
pytest -m demo      # order entry on a venue's demo environment
SYNPATH_PURE_PYTHON=1 pytest   # the same tests on the pure-Python fallback
cargo test -p synpath-core     # the Rust core on its own

The Rust core lives in crates/synpath-core (pure Rust) and bindings/python (its PyO3 wrapper, built as synpath._core). Every class it provides has a pure-Python twin with the same interface, and the library uses the twin when the extension is not built. Venue adapters are plain Python: adding a venue needs no Rust.

The demo tests place and cancel real orders on a demo exchange with the credentials in your environment, and leave the account flat. python -m synpath.trading doctor says which venues are configured without printing a secret.

Prior Art

ccxt set the conventions this library follows.

License

MIT

Metadata

Release files for synpath 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for synpath 0.3.1
File Size Uploaded
synpath-0.3.1.tar.gz 373.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for synpath 0.3.1
File
synpath-0.3.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
synpath-0.3.1-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
synpath-0.3.1-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
synpath-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
synpath-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
synpath-0.3.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
synpath-0.3.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 6.9 MB

Release files / synpath-0.3.1.tar.gz

Download URL synpath-0.3.1.tar.gz
Size 373.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d6bddd9333240c1e12d1b6cc0e0215efb1d2369564e6e7055810fdf1cc605068
BLAKE2b-256 checksum
How to use checksums
e4a7ff0bffe9e41ae330539624dde8993b1ad16c490c8ab680ca163d9da31c12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / synpath-0.3.1-cp310-abi3-win_amd64.whl

Download URL synpath-0.3.1-cp310-abi3-win_amd64.whl
Size 801.5 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
1c8981d4030fbf1f87a72877011623a526661b838fc2a26aab4093516c81de80
BLAKE2b-256 checksum
How to use checksums
a9525f7733b33bc5a55de6cb9cfad11a1e4f63e9a96efb8e52c46472ce4fbe2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / synpath-0.3.1-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL synpath-0.3.1-cp310-abi3-musllinux_1_2_x86_64.whl
Size 1.1 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
ab653888773d582f7fccd462a9368459ee6a4c43ffc7fe8ec4ebbb1736d7724c
BLAKE2b-256 checksum
How to use checksums
06e95eb8e9b338593af9259db7d938469e36c9ab66da79d6eaf6b6b85bc2124b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / synpath-0.3.1-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL synpath-0.3.1-cp310-abi3-musllinux_1_2_aarch64.whl
Size 1.1 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
b047fb250db48a0af6051eeaefcdac8c075ceacebbad32f1c0934bf7fd39e351
BLAKE2b-256 checksum
How to use checksums
27b614c1d897804c8fee018ee9074312a3982326f0eb252ec5f54a18fe0b386b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / synpath-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL synpath-0.3.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 915.7 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
5d26c899c848ce22fd71f489581ad6b26477c72ef027904c4323519cd065d6bc
BLAKE2b-256 checksum
How to use checksums
c4f3d74ac7ceb903d8d2154905d7ca623823ce5a9d1d212b516780efbe05bdce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / synpath-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL synpath-0.3.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 898.2 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
db37f6cbeb1d023bf59306cac230f4439fe5c1303c951e0c7fb5ee5a2afabdfb
BLAKE2b-256 checksum
How to use checksums
c449d865c15ef0e75e19f4fe988a06e52031c86425b9fc584f6efde537c7fdc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / synpath-0.3.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL synpath-0.3.1-cp310-abi3-macosx_11_0_arm64.whl
Size 862.1 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4b20f0771ea31009ff504b3530aca0a63d1e9a89df5240b7bccb474399e5d919
BLAKE2b-256 checksum
How to use checksums
b88f9e7fc0535b5992089c83330f9fee1086c375cf4705f31f28732ba4a38ee0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / synpath-0.3.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL synpath-0.3.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 893.4 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b86e2dd908b177302d5534da276144fe0a8050196a51c43e3fa266fe4b0e8777
BLAKE2b-256 checksum
How to use checksums
e492cc2ea691eb985a1edeff5ee02f9688ab841aae17bdc9e4c8af5e7ea027f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.8.1

8 release files

0.8.0

8 release files

0.7.2

8 release files

0.7.1

8 release files

0.7.0

8 release files

0.6.0

8 release files

0.5.1

8 release files

0.5.0

8 release files

0.4.0

8 release files

This release

0.3.1 This release

8 release files

0.3.0

7 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page