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)

Preview an order's fees before placing it — same numbers the matching engine charges:

quote = nx.markets.fee_quote(
    market.id, Outcome.YES, side=OrderSide.BUY, price="0.55", quantity=100,
)
quote.taker_fee        # fee on a full fill at the limit price
quote.max_taker_fee    # hard ceiling across every fill pattern
quote.meets_minimum    # passes the market's minimum-notional gate

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.2.tar.gz (14.7 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.2-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nexode_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 97bc1422476d57ea5c056c2c8460cc1e64756fab2c7cb71f15d8b7f4c6f7221a
MD5 399cefebabc9ec108db6f6f25c4febed
BLAKE2b-256 1fcb95bcb25a43913fa8d91dbb57bcbe958c93eb17b13de07428278a67b272e1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nexode_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 205b3d99bb869468c29db505eb73fe8cd93034c60c7e737001213dfa10a277cb
MD5 25533ce4b734bd7128d0ab46df0853fd
BLAKE2b-256 afdb067b355f5f19a3b78c6eaa2d00507be2a26a10da551a681342023143c238

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