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.3.tar.gz (27.6 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.3-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: o2_cli-0.1.3.tar.gz
  • Upload date:
  • Size: 27.6 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.3.tar.gz
Algorithm Hash digest
SHA256 aeedf31e71b40802513a620924f2e6e86ffbdc28334c6b10448b55e870987abc
MD5 d00eaf6e2134942c0859b99a90d913bf
BLAKE2b-256 7e21cdc11882e2546d2a9321f3a269df28d97d874f94dafbf9df5da744e5b8cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: o2_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 38.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 12544cd54416d0a1fc7b32e8e7aceac733fcafd37667da1c2d09b90d375614ec
MD5 276433f089bdacf6d39830d7f264bc7d
BLAKE2b-256 d4371c02455e1f993ed8b7a087c24d14e9c8f9bc8c5a7bd3d0e7f36d6f245c61

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