Python SDK


Hxro provides a Python SDK that closely resembles the REST API for traders & developers who wish to write trading bots or build on top of the protocol directly from their Python applications.

How to get it

The SDK is currently available on Test Pypi for Linux only at A MacOS version will follow soon, as well as moving to main Pypi.

How to instantiate it

Start by creating a virtualenv and installing the SDK
pip install partimutuelsdk
Then instantiate the SDK, passing in a validator URL (public or private), the parimutuel program id (the program id on devnet is 3kjK4HA6A4K86NgNB93gGhSt257wtN4QAqXMNPQ4fVTm and on mainnet is GUhB2ohrfqWspztgCrQpAmeVFBWmnWYhPcZuwY52WWRe) and the private key for the owner of the system account that will be used to pay for transactions and which owns the ATAs holding the settlement token (USDC) and any HXRO tokens. Note you can get an airdrop for both using our devnet UI, see Web3 Example UI (Devnet Version) for more information.
import parimutuelsdk as psdk
url = ""
private_key_bytes = bytes(json.load(open(in_file, 'rb')))
private_key = base58.b58encode(private_key_bytes).decode("ascii")
program_id = "3kjK4HA6A4K86NgNB93gGhSt257wtN4QAqXMNPQ4fVTm"
sdk = psdk.SDKClientImpl(url, private_key, program_id)

Example usage

The SDK attempts to replicate the existing API described here at We recommend wrapping the SDK in a user defined class that allows adding type hints, for example:
class ParimutuelSDK(ParimutuelClient):
def __init__(self, url: str, private_key: str, program_id: str):
self._sdk = psdk.SDKClientImpl(
url, private_key, program_id)
def get_series_ids(self) -> List[psdk.Series]:
series = self._sdk.get_series_ids_py()
return series
def get_contest_ids(self, series_id: str) -> List[psdk.Contest]:
contests = self._sdk.get_contest_ids_py(series_id)
return contests
def enter_contest(
user_id: str,
contest_id: str,
contest_type: str,
direction: str,
wager: float,
) -> psdk.ContestEntry:
contest_entry = self._sdk.enter_contest_py(
return contest_entry
def get_contest_entry(
) -> psdk.ContestEntry:
contest_entry = self._sdk.get_contest_entry_py(user_id, contest_entry_id)
return contest_entry
def get_contest_history(
) -> List[psdk.ContestEntry]:
contest_entries = self._sdk.get_contest_history_py(user_id)
return contest_entries
def get_account_info(
user_id: str,
) -> List[psdk.AccountBalance]:
account_balances = self._sdk.get_account_info_py(user_id)
return account_balances

Comments, Feedback, Suggestions

Please find us on the #dev-chat channel on Discord at