Skip to main content

CLI for O2 DEX Trading Platform

Project description

O2 CLI

Command-line interface for O2 DEX Trading Platform.

Install

pip install o2-cli

Quick Start

# Login (dev environment)
o2 auth test-login

# View markets (public, no login needed)
o2 --json markets list

# Check balance
o2 --json balance show

# Place a market order (long 0.001 BTC)
o2 --json orders create -m 1 -s long -t market -a 0.001

# View positions
o2 --json positions list

Vibe Coding Tool Setup

After installing, run the setup wizard to install skill files for your AI coding tool:

# Interactive wizard
o2 setup

# Non-interactive
o2 setup --tool claude-code --scope global
o2 setup --tool cursor --scope project

# Update all installed tools
o2 setup --update

Supported tools: Claude Code, Cursor, Codex (OpenAI), Windsurf, Cline, Trae

Key Rules

  1. --json must come before the subcommand: o2 --json balance show (not o2 balance show --json)
  2. Public commands (no login): markets list, fees rates
  3. Other commands require o2 auth test-login first
  4. Exit codes: 0 = success, 1 = error

Commands

Group Commands Auth Required
auth test-login, me, session No (login)
markets list, orderbook, candles, trades No
fees rates, estimate No
balance show, history Yes
orders create, list, cancel, cancel-all, modify, batch Yes
positions list, market, close, risk Yes
trades list, summary Yes
deposits address, history Yes
withdrawals create, status, cancel, list Yes
settings get, leverage, margin-mode Yes
notifications list, unread, read Yes
account overview Yes
mm status, start, stop, stats, orders API Key
admin gas-status, proxy-list, api-keys, reconcile Admin JWT
setup wizard, --tool, --update, --status No

Configuration

Config file: ~/.o2/config.yaml

active_profile: default
profiles:
  default:
    api_url: http://localhost:8000/api/v1
    timeout: 30
    auth_type: jwt
    token: eyJ...  # auto-saved

Override at runtime:

o2 --profile production --json balance show
o2 --api-url https://api.example.com/api/v1 --json markets list

Development

git clone https://github.com/dylanwu19850222/o2-cli.git
cd o2-cli
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check o2_cli/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

o2_cli-0.1.2.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

o2_cli-0.1.2-py3-none-any.whl (38.2 kB view details)

Uploaded Python 3

File details

Details for the file o2_cli-0.1.2.tar.gz.

File metadata

  • Download URL: o2_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for o2_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 343caa5bbe8e606603e74699a9177e5cb80e0022655764046b183b8cdc46f920
MD5 eb1f5725bc3d90cd1bcde141fc9e5d8e
BLAKE2b-256 cf8b528acefdcf7c8129ac9ab261457c51bcaeebd245a14312f5e6b45fe9a905

See more details on using hashes here.

File details

Details for the file o2_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: o2_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 38.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for o2_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 38badf1d7579c526d0d35a26f1216cbaecc90888d91b80694427eeff457f060f
MD5 932aebc6c06f6753e862570dba4121fa
BLAKE2b-256 3f46a66f0a9b75d28b81d7f041c7bec2df778b3fbf24182ef1a358419de48a44

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page