Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

betdex

A Python client for the BetDEX Exchange API (REST and Stream).

  • One typed method per endpoint on a single BetDexClient
  • Responses are dataclasses; each keeps its raw JSON (.raw) plus sent_at, received_at and latency_ms
  • A blocking stream with pluggable listeners.
pip install betdex

Quick Start

from betdex import BetDexClient

client = BetDexClient(app_id, api_key, wallet_id, environment="sandbox")  # or "prod"
client.create_session()

markets = client.get_markets(statuses=["Open"], size=10).markets
live = [m for m in markets if m.is_in_play]

book = client.get_market_prices_v2(markets[0].id).prices[0]
best_back = book.available_to_back(outcome_id)[:1]
best_lay = book.available_to_lay(outcome_id)[:1]

Orders

from betdex.utils import batch, new_reference

order = client.create_order(market_id, outcome_id, "For", price=2.5, stake=10,
                            keep_when_in_play=False, reference=new_reference("bot_")).orders[0]
print(order.status, order.stake_matched, order.liability)

for result in batch(client.create_orders, requests):    # 50 per call
    ...

client.cancel_orders(wallet_ids=[wallet_id])

Paging

  • Many endpoints are paginated. A paginate utility is supplied:
from betdex.utils import paginate

for page in paginate(client.get_markets, event_ids=["123"]):
    ...

Errors

  • All errors derive from BetDexError:
from betdex import BetDexAPIError, BetDexTransportError

try:
    client.get_order("123")
except BetDexAPIError as exc:          # error status: status_code, title, details, response
    print(exc.status_code, exc.title, exc.latency_ms)
except BetDexTransportError as exc:    # no response
    print(exc, exc.latency_ms)

Streaming

import threading
from betdex.streaming import MarketBook, OrderUpdate, StreamListener

listener = StreamListener()
stream = client.create_stream(listener)
stream.subscribe_to_orders()
stream.subscribe_to_market_prices(["123"])         # or no argument for every market
threading.Thread(target=stream.start, daemon=True).start()

while True:
    update = listener.output_queue.get()
    if isinstance(update, MarketBook):
        best_back = update.available_to_back(outcome_id)[:1]
    elif isinstance(update, OrderUpdate):
        filled = update.stake_matched
  • start() blocks; stop() ends it from any thread
  • On a dropped connection start() raises BetDexSocketError; call it again to reconnect and resubscribe
  • Updates missed while disconnected aren't replayed; catch up on orders with get_orders
  • For raw frames, subclass BaseListener and override on_data(raw)

Execution

from betdex.execution import add_ticks, round_down_to_nearest_price

round_down_to_nearest_price(5.55)    # 5.5
add_ticks(1.99, 2)                   # 2.02

Metadata

Release files for betdex 0.2.2

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

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Source distribution (sdist)

Source distribution for betdex 0.2.2
File Size Uploaded Provenance
betdex-0.2.2.tar.gz 33.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for betdex 0.2.2
File Interpreter ABI Platform
betdex-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 80.0 kB

Release files / betdex-0.2.2.tar.gz

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL betdex-0.2.2.tar.gz
Size 33.5 kB
Tags Source
SHA-256 checksum
How to use checksums
749a8da4b81a9bcbc41b4444ccfa4c4ba22526114313615716463d32eac5954c
BLAKE2b-256 checksum
How to use checksums
7c67bd793241662eb660265f021285629a526f260326f553e4692b87249d11f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / betdex-0.2.2-py3-none-any.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL betdex-0.2.2-py3-none-any.whl
Size 46.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afa6e5c20981a01983d5fab5e5343d8e65f1948666b8bb9daf62c8873c678817
BLAKE2b-256 checksum
How to use checksums
f673844f68eed5f29fc91a714b96d0c10dd514d409e0f0f4a6c65f862c303b3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for betdex 0.2.2

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.

Change of provenance

The repository that created this release differs from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Repository

  • Removed 0.2.1 GitHub: brandon-betdex/betdex-sdk-python
  • Added 0.2.2 GitHub: bkw-1491/betdex-sdk-python
Select from 2 files

Attestation for betdex-0.2.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

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.

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