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.1.tar.gz (26.4 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.1-py3-none-any.whl (36.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: o2_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 26.4 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.1.tar.gz
Algorithm Hash digest
SHA256 2f16cc81de95d5a50fa24e775940f40b705340d2e3921d7ac272aae6f425e834
MD5 abf026fd9df9330665a4678baebaaac7
BLAKE2b-256 4a294a912b4dd652d0bebaaa0f9b82685d8ec00c194c173dd08f337f24b237bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: o2_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 36.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bad62e3cca4c728927cfc5deb196d1ad1adb1356a808f30876c764a6017c18f1
MD5 c3d1c1e9af44cd7cc34477553669af7e
BLAKE2b-256 71fe083830106aaeaa8d0a03d8c48f232861b54901cfdfa0b0b5a54fe88df06d

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