Skip to main content
This page walks you through the minimum steps to go from a blank environment to a working T+ session: installing the library, creating a local signing account, fetching an order-book snapshot, and placing a limit order. All you need is Python 3.10 or newer and a reachable T+ instance.
1

Install tpluspy

Install the core package using pip or uv pip. The core install includes the async REST/WebSocket clients and Ed25519 account management—no Ape or EVM dependencies required for this guide.
pip install tpluspy
Confirm the CLI is available after installation:
tplus --help
2

Create a local account

T+ uses Ed25519 keypairs as identities. Your private key is stored as a password-encrypted keyfile under ~/.tplus/users. You never need a separate API key.Option A — CLI (recommended for interactive use):
tplus accounts generate alice
The command prompts you for a password, generates a fresh Ed25519 keypair, and saves it under the alias alice.Option B — Python:
from tplus.utils.user import UserManager

# Generates a keypair and saves it to ~/.tplus/users/alice
UserManager.generate("alice")
List your accounts at any time:
tplus accounts list
Set the TPLUS_ACCOUNT environment variable to your default alias (e.g. export TPLUS_ACCOUNT=alice) so you don’t have to pass --account to every CLI command.
3

Connect and fetch a market snapshot

Load your account and use OrderBookClient to fetch a live order-book snapshot. Prices and quantities on T+ are integers in the book’s native units; the Market object returned by get_market tells you the decimal places to apply.
Replace API_BASE_URL with the address of your T+ instance. For a local development setup this is typically http://127.0.0.1:8000. Contact your T+ operator for the production URL.
import asyncio
from tplus.client import OrderBookClient
from tplus.utils.user import User
from tplus.model.asset_identifier import AssetIdentifier

API_BASE_URL = "http://127.0.0.1:8000"  # replace with your T+ URL

# Load a stored account (prompts for password) or create an ephemeral one.
user = User()  # ephemeral keypair — replace with load_user("alice") for a saved account

async def main():
    async with OrderBookClient(API_BASE_URL, default_user=user) as client:
        asset = AssetIdentifier(200)

        # Fetch market metadata (price/quantity decimal places, etc.)
        market = await client.get_market(asset)
        print(f"Price decimals: {market.book_price_decimals}")
        print(f"Quantity decimals: {market.book_quantity_decimals}")

        # Fetch the current order-book snapshot
        orderbook = await client.get_orderbook_snapshot(asset)
        print(f"Snapshot sequence: {orderbook.sequence_number}")

asyncio.run(main())
AssetIdentifier accepts either a registry index (AssetIdentifier(200)) or an address@chain_id string. Use the registry index for well-known assets; your T+ operator can tell you which index maps to which token.
4

Place your first limit order

Place a Good-Till-Cancelled (GTC) limit sell order for asset 200. Quantities and prices are integers in the book’s native units.
import asyncio
from tplus.client import OrderBookClient
from tplus.utils.user import User, load_user
from tplus.model.asset_identifier import AssetIdentifier
from tplus.model.limit_order import GTC

API_BASE_URL = "http://127.0.0.1:8000"  # replace with your T+ URL

async def main():
    user = load_user("alice")  # loads your saved keypair, prompts for password

    async with OrderBookClient(API_BASE_URL, default_user=user) as client:
        asset = AssetIdentifier(200)

        # Create a GTC limit sell order: 5 units at price 1000
        response = await client.create_limit_order(
            asset_id=asset,
            quantity=5,
            price=1_000,
            side="Sell",
            time_in_force=GTC(),
        )
        print(f"Order placed: {response}")

        # Check your open orders
        user_orders, _ = await client.get_user_orders()
        print(f"Open orders: {user_orders}")

asyncio.run(main())
To place a buy-side market order instead, use create_market_order:
market_response = await client.create_market_order(
    asset_id=asset,
    quantity=10,
    side="Buy",
    fill_or_kill=False,
)
Cancel an order by its ID:
await client.cancel_order(order_id="<order-id-from-response>", asset_id=asset)

What’s next

OrderBookClient reference

Full API reference for placing, replacing, and cancelling orders, plus streaming order events.

Orders concepts

Understand time-in-force options (GTC, GTD, IOC), order lifecycle, and fill behaviour.

CLI overview

Use the tplus shell tool to trade and monitor streams without writing Python.