For the complete documentation index, see llms.txt. This page is also available as Markdown.

Python SDK

A thin, typed, synchronous Python client over Native Core's POST /info and POST /trade.

native-core-python-sdk is a thin, typed, synchronous Python client over Native Core. It wraps the two REST endpoints — reads through POST /info, writes through POST /trade — as two classes that return the API's JSON as plain, TypedDict-annotated dicts. Import name native_core; requires Python 3.10+; runtime deps are requests, eth-account, and eth-utils.

pip install native-core-python-sdk

What it is

Two classes, split by direction. Info handles reads (market data, balances, order status); Exchange handles writes (place, cancel, modify, batch) and owns an internal Info as exchange.info. Both build from a connection bundle you create once in the web app:

from native_core import Exchange, is_accepted, order_state

exchange = Exchange.from_bundle("bundle.json")   # dict, JSON string, or file path
info = exchange.info                             # reads share the same client
  • Info + Exchange. One reads, one writes. Construct with Info.from_bundle(...) / Exchange.from_bundle(...), or Info(base_url) / Exchange(wallet, base_url, owner=...) by hand.

  • Synchronous. Calls block for the result. exchange.place(...) submits, then reads the matching orderStatus; info.wait_for_open, info.wait_for_order, and info.reconcile_by_cloid resolve an order by its cloid.

  • Decision-ready fields. A business rejection is data on the response body, not an exception. Helpers such as is_accepted, is_rejected, is_timeout, next_action, and order_state collapse a response into one field to branch on, so you never parse prose.

What it is NOT

  • Not async or concurrent. Calls block. Wrap them in your own executor if you need concurrency, and share one Exchange per API wallet across threads (the nonce is a per-instance, lock-guarded, monotonic counter; two instances on one key collide nonces).

  • It cannot move funds. The SDK signs with an API wallet, a protocol-level agent key scoped only to placing and cancelling orders. Deposits, withdrawals, and approving or revoking the API wallet happen in the Native web app with your main wallet — never in the SDK.

  • Mainnet and testnet. It trades on whichever network your connection bundle names.

In this section

Getting StartedCore ConceptsAPI ReferenceAI Agents & MCPExamplesTroubleshooting

See also

Last updated