Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.10.1 instead.
Reason given by maintainers: Release candidate; use the final release

stx-python

The official Python SDK for the STX exchange.

pip install stx-python

Python 3.9 or newer.

Quickstart

You need an API key for the STX exchange you are building against. Environments lists the exchanges and where to get a key, and Authentication shows how to give it to the SDK.

from stx import STX

# Reads your API key and exchange from STX_* environment variables or ~/.stx/credentials.
with STX() as client:
    # status "open": markets that have opened for trading (not scheduled, closed or settled).
    # trading=True: only markets accepting orders right now (an open market can be paused).
    # limit: markets per page. Looping over page gives this page; client.iter_markets() walks every page.
    page = client.markets(status="open", trading=True, limit=5)

    for market in page:
        # bids are what buyers will pay, offers what sellers will accept, best price first.
        # Prices are dollars per contract, as strings; a winning contract pays market.max_price.
        bid = market.bids[0].price if market.bids else "-"  # "-" when nobody is bidding
        offer = market.offers[0].price if market.offers else "-"
        print(f"{market.event_title}: {market.title}  bid {bid}  offer {offer}")

Sample output:

New York Yankees at San Diego Padres: Padres First Run  bid -  offer -
New York Yankees at San Diego Padres: Yankees First Run  bid 0.4200  offer -
Norfolk State Spartans at Old Dominion Monarchs: Old Dominion Score Last  bid -  offer -
Norfolk State Spartans at Old Dominion Monarchs: Norfolk St Score Last  bid -  offer -
Tampa Bay Rays at Philadelphia Phillies: MLB TB @ PHI  bid -  offer -

A bid of 0.4200 on a market whose winning contract pays 1.0000 means a buyer will pay 42 cents for a contract that pays $1 if the Yankees score first.

One market from the response (selected fields)
{
  "market_id": "ddb216af-e752-422c-8688-52f95630b219",
  "symbol": "STXMLB-26SEP042140NYYSD-ESLAWAYFIRSTRUNNA",
  "event_title": "New York Yankees at San Diego Padres",
  "title": "Yankees First Run",
  "question": "Will New York Yankees score the first run of the game?",
  "status": "open",
  "trading": true,
  "event_start": "2026-09-05T01:40:00.000000Z",
  "max_price": "1.0000",
  "last_traded_price": null,
  "bids": [
    { "price": "0.4200", "quantity": "5.00" },
    { "price": "0.2400", "quantity": "4.00" },
    { "price": "0.2300", "quantity": "2.00" }
  ],
  "offers": []
}

Every market is a stx.models.Market; market.model_dump() gives you the dict. Every field is described in the API reference.

For asyncio, AsyncSTX has the same methods to await, and client.websocket() streams the order book, trades and your own orders, fills and balance.

Documentation

MIT license. Use of the STX API and exchange is subject to the STX terms of use and privacy policy: United States (terms of use, privacy policy), Ontario (terms of use, privacy policy).

Metadata

Release files for stx-python 0.7.0rc1

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

Source distribution (sdist)

Source distribution for stx-python 0.7.0rc1
File Size Uploaded Provenance Actions
stx_python-0.7.0rc1.tar.gz 60.5 kB Without provenance Details for stx_python-0.7.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stx-python 0.7.0rc1
File Interpreter ABI Platform Actions
stx_python-0.7.0rc1-py3-none-any.whl Python 3 none any Details for stx_python-0.7.0rc1-py3-none-any.whl

Total release size: 123.7 kB

Release files / stx_python-0.7.0rc1.tar.gz

Download URL stx_python-0.7.0rc1.tar.gz
Size 60.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3caf2e02e7703cd728014123f534c8c316368eeb700ef2045e5c3cd6606c9999
BLAKE2b-256 checksum
How to use checksums
501146e38c575a2af981e57153674ed138610ab5ab9d69d4d1628be9bb198156
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / stx_python-0.7.0rc1-py3-none-any.whl

Download URL stx_python-0.7.0rc1-py3-none-any.whl
Size 63.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b352a7b98c37da5246de90194a925d5908a9310b430483791afa1636c13fd034
BLAKE2b-256 checksum
How to use checksums
b7e8965d4a6b5fe4477e8cb488d8ec021d2eca4c2620336e93a51c75293e1c98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Security for stx-python 0.7.0rc1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.7.0rc1 This release

2 release files No provenance

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