Metadata-Version: 2.4
Name: nexode-sdk
Version: 0.1.1
Summary: Official Python SDK for the Nexode prediction-market API
Project-URL: Homepage, https://nexode.io
Project-URL: Documentation, https://docs.nexode.io
Project-URL: Source, https://github.com/k2flabs/nexode
Author: Nexode
License-Expression: MIT
Keywords: nexode,prediction-markets,sdk,trading
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.7
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# nexode-sdk

Official Python SDK for the [Nexode](https://nexode.io) prediction-market API.

```bash
pip install nexode-sdk
```

```python
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:

```python
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:

```python
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:

```python
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:

```python
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](https://docs.nexode.io).

## Development

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