# Molecule - [Molecule Overview: Prediction Market Execution API](https://molelcule.mintlify.app/introduction.md): Molecule is a non-custodial prime brokerage and execution API for prediction markets. Access Polymarket, Kalshi, and Demo from one interface. - [Quickstart: Install the SDK and Place Your First Order](https://molelcule.mintlify.app/quickstart.md): Install the Molecule Python SDK, configure your signing key, search a market, inspect the order book, and submit your first order in under five minutes. - [Molecule API Authentication: Trading Keys and JWTs](https://molelcule.mintlify.app/authentication/overview.md): Molecule enforces Ed25519 signing for trading routes and JWT bearer tokens for management routes. Learn which credential to use for each class of endpoint. - [Molecule API: Generating and Managing Trading Keys](https://molelcule.mintlify.app/authentication/key-management.md): Ed25519 trading keys authenticate every signed request. Generate a keypair, register the public key with Molecule, and store the private seed securely. - [Market Data: Search, Order Books, and Candles | Molecule](https://molelcule.mintlify.app/guides/market-data.md): Search prediction market instruments, retrieve order books, query historical candles, and stream real-time price updates using the Molecule markets API. - [Submit and Manage Orders Using the Molecule Orders API](https://molelcule.mintlify.app/guides/orders.md): Create LIMIT and MARKET orders, configure routing modes, manage order lifecycle, and retrieve fill history using the Molecule orders API. - [Place Complex Orders with Molecule: ICEBERG, STOP, and More](https://molelcule.mintlify.app/guides/complex-orders.md): Submit ICEBERG, PEG, STOP, TP_SL, and SMART_ROUTE complex orders via Molecule. Cancelling a parent order automatically cancels all its children. - [Manage Positions, Balances, and Risk with Molecule](https://molelcule.mintlify.app/guides/portfolio.md): Query open positions, account balances, fill history, realized and unrealized PnL, fees, and configure risk limits using the Molecule portfolio API. - [Subscribe to Real-Time Streams via Molecule WebSockets](https://molelcule.mintlify.app/guides/websockets.md): Subscribe to real-time order, fill, position, balance, order book, and trade print streams over signed WebSocket connections using the Molecule API. - [Molecule Venue Overview: Prediction Market Connections](https://molelcule.mintlify.app/venues/overview.md): Molecule connects to multiple prediction market venues through a single API. Each venue has its own instruments, settlement rules, and market structure. - [Polymarket on Molecule: Discover Markets and Submit Orders](https://molelcule.mintlify.app/venues/polymarket.md): Polymarket is a decentralized prediction market platform. Access Polymarket instruments via the Molecule API using venue="Polymarket" in market queries. - [Kalshi on Molecule: Discover Markets and Submit Orders](https://molelcule.mintlify.app/venues/kalshi.md): Kalshi is a prediction market exchange. Access Kalshi instruments and submit orders via the Molecule API using venue="Kalshi" in market queries. - [Non-Custodial Architecture: Your Keys, Your Control](https://molelcule.mintlify.app/security/non-custodial.md): Molecule never holds assets or private keys. Venue accounts are owned by you, and Molecule routes orders only when authorised by a signed request. - [Ed25519 Request Signing: Molecule API Authentication](https://molelcule.mintlify.app/security/request-signing.md): Molecule API requests are signed with Ed25519. The SDK handles signing automatically. This page covers the canonical format and replay protection. - [Molecule Python SDK: Installation and Configuration](https://molelcule.mintlify.app/sdk/installation.md): Install the Molecule Python SDK via pip or directly from GitHub. Requires Python 3.10 or later. Dependencies: httpx, pynacl, websockets. - [Molecule Python SDK Client: Constructor and Methods](https://molelcule.mintlify.app/sdk/client.md): Complete reference for the Molecule and AsyncMolecule Python client classes, including constructor parameters, sub-API namespaces, and convenience methods. - [Molecule Python SDK Error Handling and Exception Types](https://molelcule.mintlify.app/sdk/errors.md): The Molecule SDK maps API error codes to typed Python exceptions. Catch specific subclasses to handle auth failures, conflicts, and rate limits precisely. - [Search and Discover Prediction Market Instruments API](https://molelcule.mintlify.app/api/markets/search.md): Search prediction market instruments by keyword, venue, status, or category. Covers markets.search, markets.list, markets.match, markets.get, and lookup. - [Fetch Order Books and Trade History via Molecule API](https://molelcule.mintlify.app/api/markets/book.md): Retrieve order book snapshots, aggregated cross-venue books, recent trades, trade prints, and market statistics using the Molecule markets API. - [Candles and Price History for Prediction Markets API](https://molelcule.mintlify.app/api/markets/candles.md): Query candlestick OHLCV data and tick-level price history for prediction market instruments using the Molecule candles and prices API. - [POST /v1/orders — Create a Prediction Market Order](https://molelcule.mintlify.app/api/orders/create.md): Submit a LIMIT or MARKET order to a prediction market venue via Molecule. Supports DIRECT, BEST_PRICE, and SPLIT routing modes with idempotent submission. - [Complex Orders — ICEBERG, PEG, STOP, TP_SL, SMART_ROUTE](https://molelcule.mintlify.app/api/orders/complex.md): Create ICEBERG, PEG, STOP, TP_SL, and SMART_ROUTE complex orders via Molecule. Parent orders manage child order lifecycle automatically. - [Order Lifecycle — Amend, Cancel, Batch, and Fill History](https://molelcule.mintlify.app/api/orders/manage.md): Retrieve, amend, cancel, and batch-cancel orders. Fetch fill history for a subaccount. Endpoints: GET, PATCH, DELETE /v1/orders and GET /v1/fills. - [GET /v1/positions — Query Subaccount Open Positions](https://molelcule.mintlify.app/api/portfolio/positions.md): Retrieve open positions for a subaccount. Returns instrument holdings with size, cost basis, and unrealized PnL. Endpoint: GET /v1/positions. - [GET /v1/balances — Query Subaccount Venue Balances](https://molelcule.mintlify.app/api/portfolio/balances.md): Retrieve cash and collateral balances for a subaccount across Demo, Polymarket, and Kalshi prediction market venues. Endpoint: GET /v1/balances. - [GET /v1/fills — Query Subaccount Execution Fill Records](https://molelcule.mintlify.app/api/portfolio/fills.md): Retrieve fill records for a subaccount, including instrument, price, quantity, and timestamp for each execution. Endpoint: GET /v1/fills. - [Risk Controls — Limits, Kill Switch, and Cancel All](https://molelcule.mintlify.app/api/portfolio/risk.md): Query risk state, configure per-subaccount risk limits, and activate the kill switch to halt all order activity. Endpoint: GET/PUT /v1/risk/limits. - [WebSocket API Overview for Molecule Real-Time Streams](https://molelcule.mintlify.app/api/websockets/overview.md): Connect to Molecule WebSocket streams for real-time orders, fills, positions, balances, orderbooks, and trade prints. Connections require Ed25519 signing. - [Molecule WebSocket Streams — URL Builder Reference](https://molelcule.mintlify.app/api/websockets/streams.md): URL builder methods for all Molecule WebSocket streams: ws.orders, ws.fills, ws.positions, ws.balances, ws.orderbooks, ws.tradeprints, and generic asset. - [Molecule Python SDK — Changelog and Release History](https://molelcule.mintlify.app/changelog.md): Release history for the Molecule Python SDK. Version 0.1.0 introduces the initial public REST and WebSocket client with Ed25519 request signing. This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.