Skip to main content
kashdao-protocol-sdk is the direct-to-chain Python SDK for Kash. It talks straight to the Kash market program on Solana mainnet-beta, with the same trust model and the same client shape as the TypeScript @kashdao/protocol-sdk. Use it for Python trading bots, market makers, AI agents and notebook analysis. For a hosted, API-key-authed integration instead, call the REST API directly.
The package is in beta (0.3.0b2, Solana only). Pin the version you test against. Positions from the earlier Base markets need 0.2.0b2.

Trust model

The package never holds keys, never sponsors fees and never contacts ZeroID-hosted infrastructure. You bring the RPC endpoint and the signer (a solders Keypair, or any object implementing the SolanaSigner protocol). The SDK builds the instructions, asks your signer to sign, and sends through your RPC.

Install

Requires Python 3.10 or later.

Supported clusters

mainnet-beta is the default. Pass cluster=CustomSolanaDeployment(program_id=..., usdc_mint=...) for a local validator.

Client surface

create_solana_client(rpc_url=...) returns an async client (use it with async with, or call await client.aclose()): Differences from the TypeScript SDK are ergonomic only: every client method is async, names are snake_case, and amounts are plain int.

Key concepts

  • Market references. A market is named by its numeric id (5) or its market account address. The REST API’s contractAddress for a Solana market is that address.
  • Amounts. USDC is an atomic int with 6 decimals (1_000_000 = 1 USDC). Outcome balances are WAD ints with 18 decimals.
  • Positions are not SPL tokens. Each position is a balance in a program account. build_buy opens it when missing, and close_position reclaims its rent once it is empty.
  • Slippage is mandatory. Every trade takes max_slippage_bps or an explicit floor (min_tokens_out_wad / min_amount_out_usdc).
  • Errors use the same class names and codes as the TypeScript SDK (KashValidationError, KashSimulationRevertedError, KashTransactionOutcomeUnknownError, …); see Error handling.

Where to next

Quickstart

Read, quote, buy, sell and redeem from a keypair.

Error handling

Which failures are safe to retry. Shared with the TypeScript SDK.

TypeScript SDK

The same program, in TypeScript.

Source

KashDAO/protocol-sdk-python on GitHub, with runnable examples.