O2 SDK for Python

Python 3.10+ License: Apache 2.0

The official Python SDK for the O2 Exchange — a fully on-chain central limit order book (CLOB) DEX on the Fuel Network.

This SDK provides everything you need to trade programmatically on the O2 Exchange: wallet management, account lifecycle, session-based trading, market data retrieval, and real-time WebSocket streaming.

Tip

For general information about the O2 Exchange platform, see the O2 Exchange documentation.

Quick example

import asyncio
from o2_sdk import O2Client, Network, OrderSide

async def main():
    client = O2Client(network=Network.TESTNET)
    owner = client.generate_wallet()
    account = await client.setup_account(owner)
    session = await client.create_session(owner=owner, markets=["fFUEL/fUSDC"])
    result = await client.create_order(
        "fFUEL/fUSDC", OrderSide.BUY, price=0.02, quantity=100.0
    )
    print(result.tx_id)
    await client.close()

asyncio.run(main())

Project