Skip to main content

Official Python SDK for the Nexode prediction-market API

Project description

nexode-sdk

Official Python SDK for the Nexode prediction-market API.

pip install nexode-sdk
from nexode import Nexode, Outcome, OrderSide

nx = Nexode(api_key="nxd_...")          # or set NEXODE_API_KEY

market = nx.markets.list()[0]
print(nx.markets.ticker(market.id, Outcome.YES).best_bid)

order = nx.orders.create(
    market_id=market.id, outcome=Outcome.YES,
    side=OrderSide.BUY, price="0.55", quantity=100,
)
nx.orders.cancel(order.id)

Create an API key in Settings → Developer. The SDK exchanges it for short-lived access tokens and refreshes them automatically.

You work in terms of a market and an outcome (yes/no); the SDK handles the routing. nx.markets and nx.events browse markets, nx.orders/nx.trades trade and report fills, and nx.mints/nx.redeems/ nx.burns cover account activity.

Browsing is filtered and sorted server-side:

from nexode import EventSort

events = nx.events.list(
    category="sports",
    sort=EventSort.TRENDING,   # ending / trending / new / markets / name
    hide_stale_settled=True,
    limit=20,
)

event = nx.events.by_slug("nba-finals")     # markets too: nx.markets.by_slug(...)

Outcomes carry display labels — on a game market yes/no might read "Lakers"/"Celtics". The SDK maps both ways:

market.labels                       # {Outcome.YES: "Lakers", Outcome.NO: "Celtics"}
market.outcome_label(Outcome.YES)   # "Lakers" (falls back to "Yes"/"No")
market.outcome_for_label("Celtics") # Outcome.NO — trade by team name
market.winning_label                # label of the resolved outcome, or None

nx.api_keys lists and revokes keys on your account; create them in Settings → Developer.

nx.portfolio.snapshot() returns the raw inputs for PnL in one call — trades, open orders, mints, redeems, burns, the markets involved, and current tickers:

s = nx.portfolio.snapshot()
# s.trades[i].market_id / .outcome / .price / .quantity
# s.markets[market_id].collateral_price        # cost basis / resolution
# s.tickers[f"{market_id}:{outcome}"].best_bid # mark open positions

See the full reference at docs.nexode.io.

Development

cd nexode-sdk
pip install -e '.[dev]'
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexode_sdk-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nexode_sdk-0.1.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file nexode_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: nexode_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for nexode_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cadc1d7e6c208f93b9e349848e141ce53cf1aa6641cf9fa2988c542306cb3358
MD5 22377c3aeba7eb2ce02008e28c459a63
BLAKE2b-256 dbb3ca1240af368aaa4e1509bbdb3ad56d26f1fb2af081fafb524ec7f812c7b3

See more details on using hashes here.

File details

Details for the file nexode_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nexode_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for nexode_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 903d8c483c0491148ae4dfd4efe439b2284ea6bade110793cac64b0f4ece65dd
MD5 633bf03ea731d19a414739542c2cf0df
BLAKE2b-256 6592bc335ca8d4207654306159fd9246b13c4cf63c6a02d6bcf73f86fcce5cfc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page