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.0.tar.gz (24.3 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.0-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: o2_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 24.3 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.0.tar.gz
Algorithm Hash digest
SHA256 301809e67d42860489334fe22620b2122f4271f71fde9394905e7839d07ef551
MD5 e7aed5f8be6841df9af3760c1d78ec5c
BLAKE2b-256 0fe6856a045c7fcead7b5d3059163ede773bc128bea10f9cc262ad83223714e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: o2_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7be8652cd0659bd341e95dcbaaf26678e26017d9a8859fa693870a785d594ed1
MD5 6a06eb116c08fd9c8cf692cd62e02d92
BLAKE2b-256 c3c6a7943d4a9f8d22158f11bbb28282b1f6d7381550ab3204719ce633b0705c

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