From dbb0a4b0f496d3647b0070db331965a526e5663a Mon Sep 17 00:00:00 2001 From: Kimi Claw Date: Thu, 5 Mar 2026 08:29:08 +0800 Subject: [PATCH 1/2] chore: prepare v0.7.0-rc.1 release - Update version to 0.7.0-rc.1 - Add CHANGELOG entries for Dashboard MVP (#157) Highlights: - Complete dashboard redesign with comfy-table formatting - Real-time order book depth display - Recent trades panel with BUY/SELL activity - Enhanced watch mode with graceful exit handling - Local timezone support for timestamps --- --token-file | 0 CHANGELOG.md | 25 +++ Cargo.toml | 2 +- SKILL.md | 344 ++++++++++++++++++++++++++++++++++ TTY | 0 _meta.json | 6 + error | 0 package.json | 16 ++ references/api-docs.md | 139 ++++++++++++++ references/examples.md | 269 ++++++++++++++++++++++++++ references/troubleshooting.md | 300 +++++++++++++++++++++++++++++ skill.json | 52 +++++ 12 files changed, 1152 insertions(+), 1 deletion(-) create mode 100644 --token-file create mode 100644 SKILL.md create mode 100644 TTY create mode 100644 _meta.json create mode 100644 error create mode 100644 package.json create mode 100644 references/api-docs.md create mode 100644 references/examples.md create mode 100644 references/troubleshooting.md create mode 100644 skill.json diff --git a/--token-file b/--token-file new file mode 100644 index 0000000..e69de29 diff --git a/CHANGELOG.md b/CHANGELOG.md index 84730e2..2a71cdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.7.0-rc.1] - 2026-03-04 + +### Added +- **Dashboard MVP** (#157) + - Complete dashboard redesign with comfy-table formatting + - Real-time order book depth display + - Recent trades panel showing BUY/SELL activity + - Enhanced account balance formatting with local timezone + - Watch mode with graceful exit handling (Ctrl+C) + - Instant refresh: fetch data before clearing screen + - Dashboard title includes version number + +### Changed +- **Dashboard Output Structure** + - Reorganized display sections for improved clarity + - Enhanced order display formatting + - Better refresh label formatting + - Cleaner table alignment + +### Fixed +- **Dashboard Data Flow** + - Improved dashboard and portfolio command handling + - Enhanced trade handling and output formatting + - Removed duplicate tests module in output.rs + ## [0.6.3-rc.3] - 2026-03-03 ### Fixed diff --git a/Cargo.toml b/Cargo.toml index 9526f4b..ff6981e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "standx-cli" -version = "0.6.3-rc.3" +version = "0.7.0-rc.1" edition = "2021" authors = ["Kimi Claw"] description = "OpenClaw-first AI Agent trading toolkit - natural language to execution for any AI Agent" diff --git a/SKILL.md b/SKILL.md new file mode 100644 index 0000000..6070dc0 --- /dev/null +++ b/SKILL.md @@ -0,0 +1,344 @@ +--- +name: standx-cli +description: "Crypto trading CLI for StandX exchange v0.3.5. Use when users need to: (1) Query crypto market data (prices, order books, klines, funding rates), (2) Manage trading orders (create, cancel, view), (3) Check account balances, positions, and trade history, (4) Stream real-time market data via WebSocket, (5) Manage leverage and margin settings. Supports BTC, ETH, SOL, XRP and other trading pairs." +metadata: + { + "openclaw": + { + "emoji": "📈", + "requires": { "bins": ["standx"] }, + "primaryCredential": + { + "kind": "env", + "env": "STANDX_JWT", + "description": "StandX JWT token from https://standx.com/user/session (valid 7 days)", + }, + "optionalEnvVars": + [ + { + "name": "STANDX_PRIVATE_KEY", + "description": "Ed25519 private key (Base58) for trading operations", + "sensitive": true, + }, + ], + "install": + [ + { + "id": "brew", + "kind": "brew", + "formula": "wjllance/standx-cli/standx-cli", + "bins": ["standx"], + "label": "Install StandX CLI via Homebrew", + }, + { + "id": "github-linux", + "kind": "script", + "script": "curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-x86_64-unknown-linux-gnu.tar.gz && tar -xzf /tmp/standx.tar.gz -C /tmp && sudo mv /tmp/standx /usr/local/bin/ && sudo chmod +x /usr/local/bin/standx", + "bins": ["standx"], + "label": "Install StandX CLI on Linux", + }, + { + "id": "github-macos", + "kind": "script", + "script": "curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-aarch64-apple-darwin.tar.gz && tar -xzf /tmp/standx.tar.gz -C /tmp && sudo mv /tmp/standx /usr/local/bin/ && sudo chmod +x /usr/local/bin/standx", + "bins": ["standx"], + "label": "Install StandX CLI on macOS", + }, + { + "id": "manual", + "kind": "script", + "script": "git clone https://github.com/wjllance/standx-cli-skill.git ~/.openclaw/skills/standx-cli && echo 'Skill installed. Please install standx binary separately via Homebrew or direct download.'", + "bins": ["standx"], + "label": "Manual install (skill only, binary separate)", + }, + ], + }, + } +--- + +# StandX CLI Skill + +StandX CLI is a crypto trading command-line tool for the StandX exchange. + +## Installation + +### Option 1: ClawHub (Recommended - Auto-install) + +```bash +clawhub install standx-cli +``` + +### Option 2: Homebrew + +```bash +brew tap wjllance/standx-cli +brew install standx-cli +``` + +### Option 3: Direct Download + +```bash +# Linux x86_64 +curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-x86_64-unknown-linux-gnu.tar.gz +tar -xzf /tmp/standx.tar.gz -C /tmp +sudo mv /tmp/standx /usr/local/bin/ +sudo chmod +x /usr/local/bin/standx + +# macOS Apple Silicon +curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-aarch64-apple-darwin.tar.gz +tar -xzf /tmp/standx.tar.gz -C /tmp +sudo mv /tmp/standx /usr/local/bin/ +sudo chmod +x /usr/local/bin/standx +``` + +### Option 4: Manual Install (Skill Only) + +If you prefer to install the skill manually and manage the binary separately: + +```bash +# Install skill +git clone https://github.com/wjllance/standx-cli-skill.git ~/.openclaw/skills/standx-cli + +# Then install binary separately via Homebrew or direct download (see Option 2 or 3) +``` + +## Quick Start + +Check installation: + +```bash +standx --version +``` + +View BTC price: + +```bash +standx market ticker BTC-USD +``` + +## Authentication + +Most commands require authentication. StandX CLI supports multiple secure authentication methods. + +### Environment Variables (Recommended) + +The most secure way to authenticate. Credentials are not stored in shell history or command logs. + +```bash +# Add to ~/.bashrc or ~/.zshrc +export STANDX_JWT="your_jwt_token" +export STANDX_PRIVATE_KEY="your_ed25519_private_key" + +# Reload shell configuration +source ~/.bashrc +``` + +**Security Best Practices:** + +- Never hardcode credentials in commands (appears in shell history) +- Never commit credentials to version control +- Set file permissions to 600 for any files containing credentials +- Rotate tokens regularly (they expire after 7 days) + +### Get Credentials + +Visit https://standx.com/user/session to generate: + +- **JWT Token** (required) - Valid for 7 days, used for reading account data +- **Ed25519 Private Key** (optional but recommended) - Required for trading operations + +### Verify Authentication + +```bash +standx auth status +``` + +### Alternative Authentication Methods + +#### Interactive Login + +For first-time setup or testing: + +```bash +standx auth login --interactive +``` + +#### File-based Login + +For automation scripts where environment variables are not available: + +```bash +# Store credentials in files with restricted permissions +echo "your_jwt_token" > ~/.standx_token +echo "your_private_key" > ~/.standx_key +chmod 600 ~/.standx_token ~/.standx_key + +# Login using files +standx auth login --token-file ~/.standx_token --key-file ~/.standx_key +``` + +**⚠️ Avoid this in production:** + +```bash +# DANGER: Credentials will be visible in shell history +standx auth login --token "your_token" --private-key "your_key" +``` + +### Logout + +```bash +standx auth logout +``` + +## Market Data (No auth required) + +### List trading pairs + +```bash +standx market symbols +``` + +### Get ticker + +```bash +standx market ticker BTC-USD +standx market ticker ETH-USD +``` + +### Order book depth + +```bash +standx market depth BTC-USD --limit 10 +``` + +### K-line (candlestick) data + +```bash +# Last 24 hours, 1-hour candles +standx market kline BTC-USD -r 60 --from 1d + +# Last 7 days, daily candles +standx market kline BTC-USD -r 1D --from 7d + +# Specific date range +standx market kline BTC-USD -r 60 --from 2024-01-01 --to 2024-01-07 +``` + +### Funding rate + +```bash +standx market funding BTC-USD --days 7 +``` + +## Account & Trading (Auth required) + +### Account info + +```bash +standx account balances +standx account positions +standx account orders +standx account history --limit 20 +``` + +### Create order + +```bash +# Limit buy +standx order create BTC-USD buy limit --qty 0.01 --price 60000 + +# Market sell +standx order create BTC-USD sell market --qty 0.01 +``` + +### Cancel order + +```bash +standx order cancel BTC-USD --order-id 123456 +standx order cancel-all BTC-USD +``` + +### Trade history + +```bash +standx trade history BTC-USD --from 7d +``` + +## Leverage & Margin (Auth required) + +```bash +# Query leverage +standx leverage get BTC-USD + +# Set leverage +standx leverage set BTC-USD 10 + +# Query margin mode +standx margin mode BTC-USD + +# Set margin mode +standx margin mode BTC-USD --set isolated +``` + +## Real-time Streaming + +### Public streams (No auth) + +```bash +# Price stream +standx stream price BTC-USD + +# Order book stream +standx stream depth BTC-USD --levels 5 + +# Trade stream +standx stream trade BTC-USD +``` + +### User streams (Auth required) + +```bash +standx stream order # Order updates +standx stream position # Position updates +standx stream balance # Balance updates +standx stream fills # Fill updates +``` + +## Output Formats + +```bash +# JSON output +standx -o json market ticker BTC-USD + +# CSV export +standx -o csv market symbols > symbols.csv + +# Quiet mode (just values) +standx -o quiet config get base_url +``` + +## Special Modes + +### OpenClaw mode (AI-optimized JSON) + +```bash +standx --openclaw market ticker BTC-USD +``` + +### Dry run (preview without executing) + +```bash +standx --dry-run order create BTC-USD buy limit --qty 0.01 --price 60000 +``` + +## References + +- [API Documentation](references/api-docs.md) +- [Command Examples](references/examples.md) +- [Troubleshooting](references/troubleshooting.md) + +## Links + +- GitHub: https://github.com/wjllance/standx-cli +- Docs: https://github.com/wjllance/standx-cli/tree/main/docs +- Issues: https://github.com/wjllance/standx-cli/issues diff --git a/TTY b/TTY new file mode 100644 index 0000000..e69de29 diff --git a/_meta.json b/_meta.json new file mode 100644 index 0000000..e881046 --- /dev/null +++ b/_meta.json @@ -0,0 +1,6 @@ +{ + "ownerId": "kn73ys3xktsyr5my18yw666yd981xn2b", + "slug": "standx-cli", + "version": "0.3.5", + "publishedAt": 1772083805220 +} \ No newline at end of file diff --git a/error b/error new file mode 100644 index 0000000..e69de29 diff --git a/package.json b/package.json new file mode 100644 index 0000000..5f3c3fc --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "standx-cli", + "version": "0.3.5", + "description": "Crypto trading CLI for StandX exchange with OpenClaw integration", + "author": "wjllance", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/wjllance/standx-cli-skill.git" + }, + "openclaw": { + "minVersion": "0.5.0", + "categories": ["finance", "trading", "crypto"], + "keywords": ["standx", "crypto", "trading", "btc", "eth", "perpetual", "futures"] + } +} diff --git a/references/api-docs.md b/references/api-docs.md new file mode 100644 index 0000000..e369c04 --- /dev/null +++ b/references/api-docs.md @@ -0,0 +1,139 @@ +# StandX CLI API Documentation + +## Base URL + +``` +https://perps.standx.com +``` + +## Public Endpoints + +### GET /api/query_symbol_info +List all trading pairs. + +### GET /api/query_symbol_market +Get ticker for a symbol. + +**Parameters:** +- `symbol` (required): Trading pair, e.g., "BTC-USD" + +### GET /api/query_depth_book +Get order book depth. + +**Parameters:** +- `symbol` (required): Trading pair +- `limit` (optional): Depth levels, default 10 + +### GET /api/kline/history +Get K-line (candlestick) data. + +**Parameters:** +- `symbol` (required): Trading pair +- `resolution` (required): Time period (1, 5, 15, 30, 60, 240, 720, 1D, 1W, 1M) +- `from` (required): Start timestamp (Unix seconds) +- `to` (required): End timestamp (Unix seconds) + +**Response format:** +```json +{ + "s": "ok", + "t": [timestamp1, timestamp2, ...], + "o": [open1, open2, ...], + "h": [high1, high2, ...], + "l": [low1, low2, ...], + "c": [close1, close2, ...], + "v": [volume1, volume2, ...] +} +``` + +### GET /api/query_funding_rates +Get funding rate history. + +**Parameters:** +- `symbol` (required): Trading pair +- `start_time` (required): Start timestamp (Unix milliseconds) +- `end_time` (required): End timestamp (Unix milliseconds) + +## Authenticated Endpoints + +All authenticated endpoints require: +- `Authorization: Bearer ` header +- Ed25519 request signature for trading operations + +### GET /api/query_balance +Get account balances. + +### GET /api/query_positions +Get positions. + +**Parameters:** +- `symbol` (optional): Filter by trading pair + +### GET /api/query_open_orders +Get open orders. + +### GET /api/query_orders +Get order history. + +**Parameters:** +- `status` (optional): "filled" for completed orders +- `symbol` (optional): Filter by trading pair +- `limit` (optional): Number of results + +### POST /api/order/create +Create a new order. + +**Request body:** +```json +{ + "symbol": "BTC-USD", + "side": "buy", + "order_type": "limit", + "qty": "0.01", + "price": "60000", + "time_in_force": "gtc" +} +``` + +### POST /api/order/cancel +Cancel an order. + +### GET /api/query_trades +Get trade history. + +### GET /api/query_position_config +Get position configuration (leverage, margin mode). + +### POST /api/change_leverage +Change leverage for a symbol. + +### POST /api/change_margin_mode +Change margin mode (cross/isolated). + +## WebSocket + +**URL:** `wss://perps.standx.com/ws-stream/v1` + +### Public Channels +- `price` - Price ticker +- `depth_book` - Order book depth +- `public_trade` - Public trades + +### User Channels (requires auth) +- `order` - Order updates +- `position` - Position updates +- `balance` - Balance updates +- `fill` - Fill/trade updates + +### Authentication Message +```json +{ + "auth": { + "token": "Bearer ", + "streams": [ + {"channel": "order"}, + {"channel": "position"} + ] + } +} +``` diff --git a/references/examples.md b/references/examples.md new file mode 100644 index 0000000..1a789ba --- /dev/null +++ b/references/examples.md @@ -0,0 +1,269 @@ +# StandX CLI Command Examples + +## Market Data Examples + +### Get all trading pairs +```bash +standx market symbols +``` + +### Get BTC price in different formats +```bash +# Table (default) +standx market ticker BTC-USD + +# JSON +standx -o json market ticker BTC-USD + +# CSV +standx -o csv market ticker BTC-USD + +# Quiet (just the price) +standx -o quiet market ticker BTC-USD +``` + +### Get order book +```bash +# Default 10 levels +standx market depth BTC-USD + +# Custom 5 levels +standx market depth BTC-USD --limit 5 + +# Best bid/ask only +standx -o quiet market depth BTC-USD +``` + +### K-line data with time formats +```bash +# Relative time - last 24 hours, hourly +standx market kline BTC-USD -r 60 --from 1d + +# Relative time - last 7 days, daily +standx market kline BTC-USD -r 1D --from 7d + +# ISO date range +standx market kline BTC-USD -r 60 --from 2024-01-01 --to 2024-01-07 + +# Unix timestamps +standx market kline BTC-USD -r 60 --from 1704067200 --to 1706659200 + +# Limit results +standx market kline BTC-USD -r 60 --from 7d -l 10 +``` + +### Different resolutions +```bash +# 1 minute +standx market kline BTC-USD -r 1 --from 1h + +# 5 minutes +standx market kline BTC-USD -r 5 --from 6h + +# 15 minutes +standx market kline BTC-USD -r 15 --from 1d + +# 1 hour +standx market kline BTC-USD -r 60 --from 7d + +# 4 hours +standx market kline BTC-USD -r 240 --from 30d + +# 1 day +standx market kline BTC-USD -r 1D --from 90d + +# 1 week +standx market kline BTC-USD -r 1W --from 1y +``` + +## Trading Examples + +### Create orders +```bash +# Limit buy +standx order create BTC-USD buy limit --qty 0.01 --price 60000 + +# Limit sell +standx order create BTC-USD sell limit --qty 0.01 --price 70000 + +# Market buy +standx order create BTC-USD buy market --qty 0.01 + +# Market sell +standx order create BTC-USD sell market --qty 0.01 + +# With stop loss and take profit +standx order create BTC-USD buy limit \ + --qty 0.01 \ + --price 60000 \ + --sl-price 55000 \ + --tp-price 70000 + +# IOC (Immediate or Cancel) +standx order create BTC-USD buy limit --qty 0.01 --price 60000 --tif IOC + +# Reduce only +standx order create BTC-USD sell limit --qty 0.01 --price 65000 --reduce-only +``` + +### Cancel orders +```bash +# Cancel specific order +standx order cancel BTC-USD --order-id 123456 + +# Cancel all orders for symbol +standx order cancel-all BTC-USD +``` + +### View orders +```bash +# Open orders +standx account orders + +# Open orders for specific symbol +standx account orders --symbol BTC-USD + +# Order history +standx account history + +# Order history with limit +standx account history --limit 50 +``` + +### Trade history +```bash +# Last 24 hours +standx trade history BTC-USD --from 1d + +# Last 7 days +standx trade history BTC-USD --from 7d + +# Date range +standx trade history BTC-USD --from 2024-01-01 --to 2024-01-31 + +# Export to CSV +standx -o csv trade history BTC-USD --from 30d > trades.csv +``` + +## Account Examples + +### Check balances +```bash +standx account balances +``` + +### Check positions +```bash +# All positions +standx account positions + +# Specific symbol +standx account positions --symbol BTC-USD +``` + +## Leverage & Margin Examples + +### Query leverage +```bash +standx leverage get BTC-USD +``` + +### Set leverage +```bash +standx leverage set BTC-USD 10 +standx leverage set BTC-USD 20 +``` + +### Margin mode +```bash +# Query +standx margin mode BTC-USD + +# Set to isolated +standx margin mode BTC-USD --set isolated + +# Set to cross +standx margin mode BTC-USD --set cross +``` + +## Streaming Examples + +### Public streams +```bash +# Price stream +standx stream price BTC-USD + +# Order book stream +standx stream depth BTC-USD --levels 5 + +# Trade stream +standx stream trade BTC-USD +``` + +### User streams (requires auth) +```bash +# Order updates +standx stream order + +# Position updates +standx stream position + +# Balance updates +standx stream balance + +# Fill updates +standx stream fills +``` + +## Special Features + +### OpenClaw mode (AI-optimized) +```bash +standx --openclaw market ticker BTC-USD +standx --openclaw account balances +standx --openclaw trade history BTC-USD --from 7d +``` + +### Dry run (preview) +```bash +# Preview order creation +standx --dry-run order create BTC-USD buy limit --qty 0.01 --price 60000 + +# Preview leverage change +standx --dry-run leverage set BTC-USD 20 +``` + +### Combined options +```bash +# OpenClaw + Dry Run +standx --openclaw --dry-run order create BTC-USD buy limit --qty 0.01 --price 60000 + +# JSON output + limit +standx -o json market kline BTC-USD -r 60 --from 1d -l 5 +``` + +## Scripting Examples + +### Get current price in script +```bash +PRICE=$(standx -o quiet market ticker BTC-USD) +echo "Current BTC price: $PRICE" +``` + +### Check if authenticated +```bash +if standx auth status | grep -q "Authenticated"; then + echo "Logged in" +else + echo "Not logged in" +fi +``` + +### Monitor price changes +```bash +while true; do + PRICE=$(standx -o quiet market ticker BTC-USD) + echo "$(date): BTC = $PRICE" + sleep 60 +done +``` diff --git a/references/troubleshooting.md b/references/troubleshooting.md new file mode 100644 index 0000000..abbd51b --- /dev/null +++ b/references/troubleshooting.md @@ -0,0 +1,300 @@ +# StandX CLI Troubleshooting + +## Installation Issues + +### Command not found + +```bash +# Check if installed +which standx + +# If not found, try: +# 1. Homebrew +brew tap wjllance/standx-cli +brew install standx-cli + +# 2. Direct download (Linux) +curl -L -o standx.tar.gz https://github.com/wjllance/standx-cli/releases/latest/download/standx-linux-x86_64.tar.gz +tar -xzf standx.tar.gz +sudo mv standx /usr/local/bin/ + +# 3. Direct download (macOS) +curl -L -o standx.tar.gz https://github.com/wjllance/standx-cli/releases/latest/download/standx-macos-aarch64.tar.gz +tar -xzf standx.tar.gz +sudo mv standx /usr/local/bin/ +``` + +## Authentication Issues + +### "Not authenticated" error + +**Solution:** Configure environment variables or login + +```bash +# Recommended: Environment variables +export STANDX_JWT="your_jwt_token" +export STANDX_PRIVATE_KEY="your_private_key" + +# Verify +standx auth status +``` + +### Environment variables not working + +**Check if variables are set:** + +```bash +echo $STANDX_JWT +echo $STANDX_PRIVATE_KEY +``` + +**Common causes:** + +1. **Shell not reloaded after editing rc file** + ```bash + source ~/.bashrc # or ~/.zshrc + ``` + +2. **Wrong variable name** + - Correct: `STANDX_JWT` + - Wrong: `STANDX_TOKEN`, `JWT_TOKEN` + +3. **Running in subshell or script** + - Variables must be exported: `export VAR=value` + - Check with `env | grep STANDX` + +4. **Running via sudo** + - Environment variables are stripped by sudo + - Use `sudo -E` or configure in root's environment + +### "Token expired" error + +**Solution:** Get new token from https://standx.com/user/session and update environment variable + +```bash +# Update in shell config +export STANDX_JWT="new_token" + +# Reload +source ~/.bashrc + +# Verify +standx auth status +``` + +### "Private key required" error + +**Solution:** Trading operations require Ed25519 private key + +```bash +# Add private key to environment +export STANDX_PRIVATE_KEY="your_private_key" + +# Or login interactively +standx auth login --interactive +``` + +### Credentials visible in shell history + +**Problem:** You used `standx auth login --token "xxx" --private-key "yyy"` + +**Solution:** + +1. **Clear history immediately:** + ```bash + history -d $(history 1) + # or clear all + history -c + ``` + +2. **Switch to environment variables:** + ```bash + # Add to ~/.bashrc or ~/.zshrc + export STANDX_JWT="your_token" + export STANDX_PRIVATE_KEY="your_key" + ``` + +3. **Use file-based login for scripts:** + ```bash + standx auth login --token-file ~/.standx_token --key-file ~/.standx_key + ``` + +### Permission denied on credential files + +**Solution:** Set proper permissions + +```bash +chmod 600 ~/.standx_token ~/.standx_key +chmod 700 ~/.config/standx +``` + +## API Issues + +### "HTTP request failed" error + +**Possible causes:** + +1. Network connectivity +2. API endpoint unavailable +3. Rate limiting + +**Solutions:** + +```bash +# Check network +ping perps.standx.com + +# Check API status +curl https://perps.standx.com/api/query_symbol_info + +# Wait and retry +sleep 5 && standx market ticker BTC-USD +``` + +### "Symbol not found" error + +**Solution:** Check available symbols + +```bash +standx market symbols +``` + +### K-line "no_data" response + +**Cause:** No data available for the requested time range + +**Solution:** Try different time range + +```bash +# Use relative time +standx market kline BTC-USD -r 60 --from 1d + +# Or use limit instead of from/to +standx market kline BTC-USD -r 60 -l 10 +``` + +## WebSocket Issues + +### "invalid token" for user streams + +**Status:** Known issue [#3](https://github.com/wjllance/standx-cli/issues/3) + +**Workaround:** Use public streams or check token validity + +```bash +# Public streams work without auth +standx stream price BTC-USD +standx stream depth BTC-USD +standx stream trade BTC-USD +``` + +### Connection drops + +**Solution:** CLI auto-reconnects, no action needed. For debugging: + +```bash +standx -v stream price BTC-USD +``` + +## Output Issues + +### JSON parsing errors + +**Solution:** Check if output is valid JSON + +```bash +standx -o json market ticker BTC-USD | jq . +``` + +### CSV format issues + +**Solution:** Ensure proper encoding + +```bash +export LANG=en_US.UTF-8 +standx -o csv market symbols +``` + +## Performance Issues + +### Slow response + +**Possible causes:** + +1. Network latency +2. API rate limiting +3. Large data queries + +**Solutions:** + +```bash +# Use limit to reduce data +standx market kline BTC-USD -r 60 --from 1d -l 10 + +# Use quiet mode for faster output +standx -o quiet market ticker BTC-USD +``` + +## Security Best Practices + +### Credential Storage + +| Method | Security | Use Case | +|--------|----------|----------| +| Environment variables | ⭐⭐⭐ High | Development, interactive use | +| File with 600 permissions | ⭐⭐⭐ High | Automation scripts | +| Command line args | ⭐ Low (leaks to history) | Avoid in production | + +### Recommended Setup + +```bash +# 1. Create secure directory +mkdir -p ~/.config/standx +chmod 700 ~/.config/standx + +# 2. Add to shell config (~/.bashrc or ~/.zshrc) +export STANDX_JWT="your_jwt_token" +export STANDX_PRIVATE_KEY="your_private_key" + +# 3. Reload +source ~/.bashrc + +# 4. Verify +standx auth status +``` + +### Rotating Credentials + +JWT tokens expire after 7 days. Set a reminder to rotate: + +```bash +# Check expiration +standx auth status + +# When expired, get new token and update environment +export STANDX_JWT="new_token" +``` + +## Getting Help + +### Check version + +```bash +standx --version +``` + +### View help + +```bash +standx --help +standx market --help +standx order create --help +``` + +### GitHub Issues + +https://github.com/wjllance/standx-cli/issues + +### Documentation + +https://github.com/wjllance/standx-cli/tree/main/docs diff --git a/skill.json b/skill.json new file mode 100644 index 0000000..40c9668 --- /dev/null +++ b/skill.json @@ -0,0 +1,52 @@ +{ + "name": "standx-cli", + "version": "0.5.0", + "openclaw": { + "emoji": "📈", + "requires": { + "bins": ["standx"] + }, + "primaryCredential": { + "kind": "env", + "env": "STANDX_JWT", + "description": "StandX JWT token from https://standx.com/user/session (valid 7 days)" + }, + "optionalEnvVars": [ + { + "name": "STANDX_PRIVATE_KEY", + "description": "Ed25519 private key (Base58) for trading operations", + "sensitive": true + } + ], + "install": [ + { + "id": "brew", + "kind": "brew", + "formula": "wjllance/standx-cli/standx-cli", + "bins": ["standx"], + "label": "Install StandX CLI via Homebrew" + }, + { + "id": "github-linux", + "kind": "script", + "script": "curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-x86_64-unknown-linux-gnu.tar.gz && tar -xzf /tmp/standx.tar.gz -C /tmp && sudo mv /tmp/standx /usr/local/bin/ && sudo chmod +x /usr/local/bin/standx", + "bins": ["standx"], + "label": "Install StandX CLI on Linux" + }, + { + "id": "github-macos", + "kind": "script", + "script": "curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-aarch64-apple-darwin.tar.gz && tar -xzf /tmp/standx.tar.gz -C /tmp && sudo mv /tmp/standx /usr/local/bin/ && sudo chmod +x /usr/local/bin/standx", + "bins": ["standx"], + "label": "Install StandX CLI on macOS" + }, + { + "id": "manual", + "kind": "script", + "script": "git clone https://github.com/wjllance/standx-cli-skill.git ~/.openclaw/skills/standx-cli && echo 'Skill installed. Please install standx binary separately via Homebrew or direct download.'", + "bins": ["standx"], + "label": "Manual install (skill only, binary separate)" + } + ] + } +} From b255c2af2b01e6930f8c73e5182875317934e944 Mon Sep 17 00:00:00 2001 From: Kimi Claw Date: Thu, 5 Mar 2026 08:53:46 +0800 Subject: [PATCH 2/2] chore: prepare v0.7.0-rc.1 release - Update version to 0.7.0-rc.1 (Cargo.toml, version.json) - Add CHANGELOG entries for Dashboard MVP (#157) - Update Skill metadata (openclaw/SKILL.md, clawhub-publish/SKILL.md) - Create RELEASE_NOTES_v0.7.0-rc.1.md - Remove old clawhub metadata files (_meta.json, package.json) Highlights: - Complete dashboard redesign with comfy-table formatting - Real-time order book depth display - Recent trades panel with BUY/SELL activity - Enhanced watch mode with graceful exit handling - Local timezone support for timestamps - Command short aliases support --- --token-file | 0 RELEASE_NOTES_v0.7.0-rc.1.md | 79 +++++++ SKILL.md | 344 ------------------------------ TTY | 0 _meta.json | 6 - clawhub-publish/SKILL.md | 56 ++++- error | 0 openclaw/SKILL.md | 56 ++++- package.json | 16 -- references/api-docs.md | 139 ------------ references/examples.md | 269 ----------------------- references/troubleshooting.md | 300 -------------------------- skill.json | 52 ----- tests/integration/cli_commands.rs | 2 +- version.json | 2 +- 15 files changed, 191 insertions(+), 1130 deletions(-) delete mode 100644 --token-file create mode 100644 RELEASE_NOTES_v0.7.0-rc.1.md delete mode 100644 SKILL.md delete mode 100644 TTY delete mode 100644 _meta.json delete mode 100644 error delete mode 100644 package.json delete mode 100644 references/api-docs.md delete mode 100644 references/examples.md delete mode 100644 references/troubleshooting.md delete mode 100644 skill.json diff --git a/--token-file b/--token-file deleted file mode 100644 index e69de29..0000000 diff --git a/RELEASE_NOTES_v0.7.0-rc.1.md b/RELEASE_NOTES_v0.7.0-rc.1.md new file mode 100644 index 0000000..62477e3 --- /dev/null +++ b/RELEASE_NOTES_v0.7.0-rc.1.md @@ -0,0 +1,79 @@ +# Release Notes v0.7.0-rc.1 + +## 🚀 Dashboard MVP + +This release introduces the **Dashboard MVP** - a complete redesign of the real-time trading dashboard with enhanced visualization and user experience. + +--- + +## ✨ What's New + +### Dashboard MVP (#157) + +The dashboard has been completely rebuilt with the following features: + +- **Comfy-table Formatting**: Beautiful, aligned tables for better readability +- **Real-time Order Book Depth**: Visualize market depth directly in the dashboard +- **Recent Trades Panel**: See live BUY/SELL activity with color coding +- **Local Timezone Support**: All timestamps displayed in your local timezone +- **Graceful Exit**: Press Ctrl+C to exit watch mode cleanly +- **Instant Refresh**: Data is fetched before clearing screen to reduce flicker +- **Version in Title**: Dashboard title now shows the current version + +### Command Short Aliases (#137) + +Faster typing with short command aliases: + +| Full Command | Short Alias | +|--------------|-------------| +| `standx market ticker` | `standx m t` | +| `standx market depth` | `standx m d` | +| `standx portfolio snapshot` | `standx p s` | +| `standx dashboard --watch` | `standx d -w` | + +--- + +## 🐛 Bug Fixes + +- Fixed dashboard and portfolio command handling +- Enhanced trade handling and output formatting +- Removed duplicate tests module + +--- + +## 📋 Installation + +### Homebrew + +```bash +brew tap wjllance/standx-cli +brew install standx-cli +``` + +### Binary Download + +Download pre-built binaries from [GitHub Releases](https://github.com/wjllance/standx-cli/releases/tag/v0.7.0-rc.1). + +--- + +## 🔄 Migration Guide + +No breaking changes. All existing commands continue to work as before. + +--- + +## 📚 Documentation + +- [Full Documentation](https://github.com/wjllance/standx-cli/tree/main/docs) +- [Changelog](https://github.com/wjllance/standx-cli/blob/main/CHANGELOG.md) + +--- + +## 🙏 Contributors + +Thanks to all contributors who made this release possible! + +--- + +*Released: 2026-03-04* +*Version: v0.7.0-rc.1* diff --git a/SKILL.md b/SKILL.md deleted file mode 100644 index 6070dc0..0000000 --- a/SKILL.md +++ /dev/null @@ -1,344 +0,0 @@ ---- -name: standx-cli -description: "Crypto trading CLI for StandX exchange v0.3.5. Use when users need to: (1) Query crypto market data (prices, order books, klines, funding rates), (2) Manage trading orders (create, cancel, view), (3) Check account balances, positions, and trade history, (4) Stream real-time market data via WebSocket, (5) Manage leverage and margin settings. Supports BTC, ETH, SOL, XRP and other trading pairs." -metadata: - { - "openclaw": - { - "emoji": "📈", - "requires": { "bins": ["standx"] }, - "primaryCredential": - { - "kind": "env", - "env": "STANDX_JWT", - "description": "StandX JWT token from https://standx.com/user/session (valid 7 days)", - }, - "optionalEnvVars": - [ - { - "name": "STANDX_PRIVATE_KEY", - "description": "Ed25519 private key (Base58) for trading operations", - "sensitive": true, - }, - ], - "install": - [ - { - "id": "brew", - "kind": "brew", - "formula": "wjllance/standx-cli/standx-cli", - "bins": ["standx"], - "label": "Install StandX CLI via Homebrew", - }, - { - "id": "github-linux", - "kind": "script", - "script": "curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-x86_64-unknown-linux-gnu.tar.gz && tar -xzf /tmp/standx.tar.gz -C /tmp && sudo mv /tmp/standx /usr/local/bin/ && sudo chmod +x /usr/local/bin/standx", - "bins": ["standx"], - "label": "Install StandX CLI on Linux", - }, - { - "id": "github-macos", - "kind": "script", - "script": "curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-aarch64-apple-darwin.tar.gz && tar -xzf /tmp/standx.tar.gz -C /tmp && sudo mv /tmp/standx /usr/local/bin/ && sudo chmod +x /usr/local/bin/standx", - "bins": ["standx"], - "label": "Install StandX CLI on macOS", - }, - { - "id": "manual", - "kind": "script", - "script": "git clone https://github.com/wjllance/standx-cli-skill.git ~/.openclaw/skills/standx-cli && echo 'Skill installed. Please install standx binary separately via Homebrew or direct download.'", - "bins": ["standx"], - "label": "Manual install (skill only, binary separate)", - }, - ], - }, - } ---- - -# StandX CLI Skill - -StandX CLI is a crypto trading command-line tool for the StandX exchange. - -## Installation - -### Option 1: ClawHub (Recommended - Auto-install) - -```bash -clawhub install standx-cli -``` - -### Option 2: Homebrew - -```bash -brew tap wjllance/standx-cli -brew install standx-cli -``` - -### Option 3: Direct Download - -```bash -# Linux x86_64 -curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-x86_64-unknown-linux-gnu.tar.gz -tar -xzf /tmp/standx.tar.gz -C /tmp -sudo mv /tmp/standx /usr/local/bin/ -sudo chmod +x /usr/local/bin/standx - -# macOS Apple Silicon -curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-aarch64-apple-darwin.tar.gz -tar -xzf /tmp/standx.tar.gz -C /tmp -sudo mv /tmp/standx /usr/local/bin/ -sudo chmod +x /usr/local/bin/standx -``` - -### Option 4: Manual Install (Skill Only) - -If you prefer to install the skill manually and manage the binary separately: - -```bash -# Install skill -git clone https://github.com/wjllance/standx-cli-skill.git ~/.openclaw/skills/standx-cli - -# Then install binary separately via Homebrew or direct download (see Option 2 or 3) -``` - -## Quick Start - -Check installation: - -```bash -standx --version -``` - -View BTC price: - -```bash -standx market ticker BTC-USD -``` - -## Authentication - -Most commands require authentication. StandX CLI supports multiple secure authentication methods. - -### Environment Variables (Recommended) - -The most secure way to authenticate. Credentials are not stored in shell history or command logs. - -```bash -# Add to ~/.bashrc or ~/.zshrc -export STANDX_JWT="your_jwt_token" -export STANDX_PRIVATE_KEY="your_ed25519_private_key" - -# Reload shell configuration -source ~/.bashrc -``` - -**Security Best Practices:** - -- Never hardcode credentials in commands (appears in shell history) -- Never commit credentials to version control -- Set file permissions to 600 for any files containing credentials -- Rotate tokens regularly (they expire after 7 days) - -### Get Credentials - -Visit https://standx.com/user/session to generate: - -- **JWT Token** (required) - Valid for 7 days, used for reading account data -- **Ed25519 Private Key** (optional but recommended) - Required for trading operations - -### Verify Authentication - -```bash -standx auth status -``` - -### Alternative Authentication Methods - -#### Interactive Login - -For first-time setup or testing: - -```bash -standx auth login --interactive -``` - -#### File-based Login - -For automation scripts where environment variables are not available: - -```bash -# Store credentials in files with restricted permissions -echo "your_jwt_token" > ~/.standx_token -echo "your_private_key" > ~/.standx_key -chmod 600 ~/.standx_token ~/.standx_key - -# Login using files -standx auth login --token-file ~/.standx_token --key-file ~/.standx_key -``` - -**⚠️ Avoid this in production:** - -```bash -# DANGER: Credentials will be visible in shell history -standx auth login --token "your_token" --private-key "your_key" -``` - -### Logout - -```bash -standx auth logout -``` - -## Market Data (No auth required) - -### List trading pairs - -```bash -standx market symbols -``` - -### Get ticker - -```bash -standx market ticker BTC-USD -standx market ticker ETH-USD -``` - -### Order book depth - -```bash -standx market depth BTC-USD --limit 10 -``` - -### K-line (candlestick) data - -```bash -# Last 24 hours, 1-hour candles -standx market kline BTC-USD -r 60 --from 1d - -# Last 7 days, daily candles -standx market kline BTC-USD -r 1D --from 7d - -# Specific date range -standx market kline BTC-USD -r 60 --from 2024-01-01 --to 2024-01-07 -``` - -### Funding rate - -```bash -standx market funding BTC-USD --days 7 -``` - -## Account & Trading (Auth required) - -### Account info - -```bash -standx account balances -standx account positions -standx account orders -standx account history --limit 20 -``` - -### Create order - -```bash -# Limit buy -standx order create BTC-USD buy limit --qty 0.01 --price 60000 - -# Market sell -standx order create BTC-USD sell market --qty 0.01 -``` - -### Cancel order - -```bash -standx order cancel BTC-USD --order-id 123456 -standx order cancel-all BTC-USD -``` - -### Trade history - -```bash -standx trade history BTC-USD --from 7d -``` - -## Leverage & Margin (Auth required) - -```bash -# Query leverage -standx leverage get BTC-USD - -# Set leverage -standx leverage set BTC-USD 10 - -# Query margin mode -standx margin mode BTC-USD - -# Set margin mode -standx margin mode BTC-USD --set isolated -``` - -## Real-time Streaming - -### Public streams (No auth) - -```bash -# Price stream -standx stream price BTC-USD - -# Order book stream -standx stream depth BTC-USD --levels 5 - -# Trade stream -standx stream trade BTC-USD -``` - -### User streams (Auth required) - -```bash -standx stream order # Order updates -standx stream position # Position updates -standx stream balance # Balance updates -standx stream fills # Fill updates -``` - -## Output Formats - -```bash -# JSON output -standx -o json market ticker BTC-USD - -# CSV export -standx -o csv market symbols > symbols.csv - -# Quiet mode (just values) -standx -o quiet config get base_url -``` - -## Special Modes - -### OpenClaw mode (AI-optimized JSON) - -```bash -standx --openclaw market ticker BTC-USD -``` - -### Dry run (preview without executing) - -```bash -standx --dry-run order create BTC-USD buy limit --qty 0.01 --price 60000 -``` - -## References - -- [API Documentation](references/api-docs.md) -- [Command Examples](references/examples.md) -- [Troubleshooting](references/troubleshooting.md) - -## Links - -- GitHub: https://github.com/wjllance/standx-cli -- Docs: https://github.com/wjllance/standx-cli/tree/main/docs -- Issues: https://github.com/wjllance/standx-cli/issues diff --git a/TTY b/TTY deleted file mode 100644 index e69de29..0000000 diff --git a/_meta.json b/_meta.json deleted file mode 100644 index e881046..0000000 --- a/_meta.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "ownerId": "kn73ys3xktsyr5my18yw666yd981xn2b", - "slug": "standx-cli", - "version": "0.3.5", - "publishedAt": 1772083805220 -} \ No newline at end of file diff --git a/clawhub-publish/SKILL.md b/clawhub-publish/SKILL.md index d85b328..7788562 100644 --- a/clawhub-publish/SKILL.md +++ b/clawhub-publish/SKILL.md @@ -1,6 +1,6 @@ --- name: standx-cli -description: "Crypto trading CLI for StandX exchange v0.4.2. Use when users need to: (1) Query crypto market data (prices, order books, klines, funding rates), (2) Manage trading orders (create, cancel, view), (3) Check account balances, positions, and trade history, (4) Stream real-time market data via WebSocket, (5) Manage leverage and margin settings. Supports BTC, ETH, SOL, XRP and other trading pairs." +description: "Crypto trading CLI for StandX exchange v0.7.0-rc.1. Use when users need to: (1) Query crypto market data (prices, order books, klines, funding rates), (2) Manage trading orders (create, cancel, view), (3) Check account balances, positions, and trade history, (4) Stream real-time market data via WebSocket, (5) Manage leverage and margin settings, (6) Monitor real-time dashboard, (7) View portfolio summary. Supports BTC, ETH, SOL, XRP and other trading pairs." metadata: { "openclaw": @@ -76,8 +76,25 @@ View BTC price: ```bash standx market ticker BTC-USD +# Or use short alias +standx m t BTC-USD ``` +### Command Short Aliases + +StandX CLI supports short aliases for faster typing: + +| Full Command | Short Alias | +|--------------|-------------| +| `standx market ticker` | `standx m t` | +| `standx market depth` | `standx m d` | +| `standx market kline` | `standx m k` | +| `standx account balances` | `standx a b` | +| `standx account positions` | `standx a p` | +| `standx account orders` | `standx a o` | +| `standx portfolio snapshot` | `standx p s` | +| `standx dashboard --watch` | `standx d -w` | + ## Authentication Most commands require authentication. StandX CLI supports multiple secure authentication methods. @@ -226,6 +243,43 @@ standx order cancel-all BTC-USD standx trade history BTC-USD --from 7d ``` +## Dashboard & Portfolio (Auth required) + +### Real-time Dashboard + +Interactive trading dashboard with auto-refresh: + +```bash +# Launch dashboard with auto-refresh (watch mode) +standx dashboard --watch + +# Dashboard for specific symbols +standx dashboard --symbols BTC-USD,ETH-USD + +# Dashboard with custom refresh interval (seconds) +standx dashboard --watch --interval 5 +``` + +**Dashboard Features:** +- Real-time account balance display +- Active positions with PnL +- Open orders summary +- Order book depth visualization +- Recent trades panel (BUY/SELL) +- Auto-refresh with graceful exit (Ctrl+C) + +### Portfolio Snapshot + +View portfolio summary and performance: + +```bash +# Portfolio snapshot +standx portfolio snapshot + +# Short alias +standx p s +``` + ## Leverage & Margin (Auth required) ```bash diff --git a/error b/error deleted file mode 100644 index e69de29..0000000 diff --git a/openclaw/SKILL.md b/openclaw/SKILL.md index 7fbed90..7788562 100644 --- a/openclaw/SKILL.md +++ b/openclaw/SKILL.md @@ -1,6 +1,6 @@ --- name: standx-cli -description: "Crypto trading CLI for StandX exchange v0.6.3-rc.1. Use when users need to: (1) Query crypto market data (prices, order books, klines, funding rates), (2) Manage trading orders (create, cancel, view), (3) Check account balances, positions, and trade history, (4) Stream real-time market data via WebSocket, (5) Manage leverage and margin settings, (6) Monitor real-time dashboard, (7) View portfolio summary. Supports BTC, ETH, SOL, XRP and other trading pairs." +description: "Crypto trading CLI for StandX exchange v0.7.0-rc.1. Use when users need to: (1) Query crypto market data (prices, order books, klines, funding rates), (2) Manage trading orders (create, cancel, view), (3) Check account balances, positions, and trade history, (4) Stream real-time market data via WebSocket, (5) Manage leverage and margin settings, (6) Monitor real-time dashboard, (7) View portfolio summary. Supports BTC, ETH, SOL, XRP and other trading pairs." metadata: { "openclaw": @@ -76,8 +76,25 @@ View BTC price: ```bash standx market ticker BTC-USD +# Or use short alias +standx m t BTC-USD ``` +### Command Short Aliases + +StandX CLI supports short aliases for faster typing: + +| Full Command | Short Alias | +|--------------|-------------| +| `standx market ticker` | `standx m t` | +| `standx market depth` | `standx m d` | +| `standx market kline` | `standx m k` | +| `standx account balances` | `standx a b` | +| `standx account positions` | `standx a p` | +| `standx account orders` | `standx a o` | +| `standx portfolio snapshot` | `standx p s` | +| `standx dashboard --watch` | `standx d -w` | + ## Authentication Most commands require authentication. StandX CLI supports multiple secure authentication methods. @@ -226,6 +243,43 @@ standx order cancel-all BTC-USD standx trade history BTC-USD --from 7d ``` +## Dashboard & Portfolio (Auth required) + +### Real-time Dashboard + +Interactive trading dashboard with auto-refresh: + +```bash +# Launch dashboard with auto-refresh (watch mode) +standx dashboard --watch + +# Dashboard for specific symbols +standx dashboard --symbols BTC-USD,ETH-USD + +# Dashboard with custom refresh interval (seconds) +standx dashboard --watch --interval 5 +``` + +**Dashboard Features:** +- Real-time account balance display +- Active positions with PnL +- Open orders summary +- Order book depth visualization +- Recent trades panel (BUY/SELL) +- Auto-refresh with graceful exit (Ctrl+C) + +### Portfolio Snapshot + +View portfolio summary and performance: + +```bash +# Portfolio snapshot +standx portfolio snapshot + +# Short alias +standx p s +``` + ## Leverage & Margin (Auth required) ```bash diff --git a/package.json b/package.json deleted file mode 100644 index 5f3c3fc..0000000 --- a/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "standx-cli", - "version": "0.3.5", - "description": "Crypto trading CLI for StandX exchange with OpenClaw integration", - "author": "wjllance", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/wjllance/standx-cli-skill.git" - }, - "openclaw": { - "minVersion": "0.5.0", - "categories": ["finance", "trading", "crypto"], - "keywords": ["standx", "crypto", "trading", "btc", "eth", "perpetual", "futures"] - } -} diff --git a/references/api-docs.md b/references/api-docs.md deleted file mode 100644 index e369c04..0000000 --- a/references/api-docs.md +++ /dev/null @@ -1,139 +0,0 @@ -# StandX CLI API Documentation - -## Base URL - -``` -https://perps.standx.com -``` - -## Public Endpoints - -### GET /api/query_symbol_info -List all trading pairs. - -### GET /api/query_symbol_market -Get ticker for a symbol. - -**Parameters:** -- `symbol` (required): Trading pair, e.g., "BTC-USD" - -### GET /api/query_depth_book -Get order book depth. - -**Parameters:** -- `symbol` (required): Trading pair -- `limit` (optional): Depth levels, default 10 - -### GET /api/kline/history -Get K-line (candlestick) data. - -**Parameters:** -- `symbol` (required): Trading pair -- `resolution` (required): Time period (1, 5, 15, 30, 60, 240, 720, 1D, 1W, 1M) -- `from` (required): Start timestamp (Unix seconds) -- `to` (required): End timestamp (Unix seconds) - -**Response format:** -```json -{ - "s": "ok", - "t": [timestamp1, timestamp2, ...], - "o": [open1, open2, ...], - "h": [high1, high2, ...], - "l": [low1, low2, ...], - "c": [close1, close2, ...], - "v": [volume1, volume2, ...] -} -``` - -### GET /api/query_funding_rates -Get funding rate history. - -**Parameters:** -- `symbol` (required): Trading pair -- `start_time` (required): Start timestamp (Unix milliseconds) -- `end_time` (required): End timestamp (Unix milliseconds) - -## Authenticated Endpoints - -All authenticated endpoints require: -- `Authorization: Bearer ` header -- Ed25519 request signature for trading operations - -### GET /api/query_balance -Get account balances. - -### GET /api/query_positions -Get positions. - -**Parameters:** -- `symbol` (optional): Filter by trading pair - -### GET /api/query_open_orders -Get open orders. - -### GET /api/query_orders -Get order history. - -**Parameters:** -- `status` (optional): "filled" for completed orders -- `symbol` (optional): Filter by trading pair -- `limit` (optional): Number of results - -### POST /api/order/create -Create a new order. - -**Request body:** -```json -{ - "symbol": "BTC-USD", - "side": "buy", - "order_type": "limit", - "qty": "0.01", - "price": "60000", - "time_in_force": "gtc" -} -``` - -### POST /api/order/cancel -Cancel an order. - -### GET /api/query_trades -Get trade history. - -### GET /api/query_position_config -Get position configuration (leverage, margin mode). - -### POST /api/change_leverage -Change leverage for a symbol. - -### POST /api/change_margin_mode -Change margin mode (cross/isolated). - -## WebSocket - -**URL:** `wss://perps.standx.com/ws-stream/v1` - -### Public Channels -- `price` - Price ticker -- `depth_book` - Order book depth -- `public_trade` - Public trades - -### User Channels (requires auth) -- `order` - Order updates -- `position` - Position updates -- `balance` - Balance updates -- `fill` - Fill/trade updates - -### Authentication Message -```json -{ - "auth": { - "token": "Bearer ", - "streams": [ - {"channel": "order"}, - {"channel": "position"} - ] - } -} -``` diff --git a/references/examples.md b/references/examples.md deleted file mode 100644 index 1a789ba..0000000 --- a/references/examples.md +++ /dev/null @@ -1,269 +0,0 @@ -# StandX CLI Command Examples - -## Market Data Examples - -### Get all trading pairs -```bash -standx market symbols -``` - -### Get BTC price in different formats -```bash -# Table (default) -standx market ticker BTC-USD - -# JSON -standx -o json market ticker BTC-USD - -# CSV -standx -o csv market ticker BTC-USD - -# Quiet (just the price) -standx -o quiet market ticker BTC-USD -``` - -### Get order book -```bash -# Default 10 levels -standx market depth BTC-USD - -# Custom 5 levels -standx market depth BTC-USD --limit 5 - -# Best bid/ask only -standx -o quiet market depth BTC-USD -``` - -### K-line data with time formats -```bash -# Relative time - last 24 hours, hourly -standx market kline BTC-USD -r 60 --from 1d - -# Relative time - last 7 days, daily -standx market kline BTC-USD -r 1D --from 7d - -# ISO date range -standx market kline BTC-USD -r 60 --from 2024-01-01 --to 2024-01-07 - -# Unix timestamps -standx market kline BTC-USD -r 60 --from 1704067200 --to 1706659200 - -# Limit results -standx market kline BTC-USD -r 60 --from 7d -l 10 -``` - -### Different resolutions -```bash -# 1 minute -standx market kline BTC-USD -r 1 --from 1h - -# 5 minutes -standx market kline BTC-USD -r 5 --from 6h - -# 15 minutes -standx market kline BTC-USD -r 15 --from 1d - -# 1 hour -standx market kline BTC-USD -r 60 --from 7d - -# 4 hours -standx market kline BTC-USD -r 240 --from 30d - -# 1 day -standx market kline BTC-USD -r 1D --from 90d - -# 1 week -standx market kline BTC-USD -r 1W --from 1y -``` - -## Trading Examples - -### Create orders -```bash -# Limit buy -standx order create BTC-USD buy limit --qty 0.01 --price 60000 - -# Limit sell -standx order create BTC-USD sell limit --qty 0.01 --price 70000 - -# Market buy -standx order create BTC-USD buy market --qty 0.01 - -# Market sell -standx order create BTC-USD sell market --qty 0.01 - -# With stop loss and take profit -standx order create BTC-USD buy limit \ - --qty 0.01 \ - --price 60000 \ - --sl-price 55000 \ - --tp-price 70000 - -# IOC (Immediate or Cancel) -standx order create BTC-USD buy limit --qty 0.01 --price 60000 --tif IOC - -# Reduce only -standx order create BTC-USD sell limit --qty 0.01 --price 65000 --reduce-only -``` - -### Cancel orders -```bash -# Cancel specific order -standx order cancel BTC-USD --order-id 123456 - -# Cancel all orders for symbol -standx order cancel-all BTC-USD -``` - -### View orders -```bash -# Open orders -standx account orders - -# Open orders for specific symbol -standx account orders --symbol BTC-USD - -# Order history -standx account history - -# Order history with limit -standx account history --limit 50 -``` - -### Trade history -```bash -# Last 24 hours -standx trade history BTC-USD --from 1d - -# Last 7 days -standx trade history BTC-USD --from 7d - -# Date range -standx trade history BTC-USD --from 2024-01-01 --to 2024-01-31 - -# Export to CSV -standx -o csv trade history BTC-USD --from 30d > trades.csv -``` - -## Account Examples - -### Check balances -```bash -standx account balances -``` - -### Check positions -```bash -# All positions -standx account positions - -# Specific symbol -standx account positions --symbol BTC-USD -``` - -## Leverage & Margin Examples - -### Query leverage -```bash -standx leverage get BTC-USD -``` - -### Set leverage -```bash -standx leverage set BTC-USD 10 -standx leverage set BTC-USD 20 -``` - -### Margin mode -```bash -# Query -standx margin mode BTC-USD - -# Set to isolated -standx margin mode BTC-USD --set isolated - -# Set to cross -standx margin mode BTC-USD --set cross -``` - -## Streaming Examples - -### Public streams -```bash -# Price stream -standx stream price BTC-USD - -# Order book stream -standx stream depth BTC-USD --levels 5 - -# Trade stream -standx stream trade BTC-USD -``` - -### User streams (requires auth) -```bash -# Order updates -standx stream order - -# Position updates -standx stream position - -# Balance updates -standx stream balance - -# Fill updates -standx stream fills -``` - -## Special Features - -### OpenClaw mode (AI-optimized) -```bash -standx --openclaw market ticker BTC-USD -standx --openclaw account balances -standx --openclaw trade history BTC-USD --from 7d -``` - -### Dry run (preview) -```bash -# Preview order creation -standx --dry-run order create BTC-USD buy limit --qty 0.01 --price 60000 - -# Preview leverage change -standx --dry-run leverage set BTC-USD 20 -``` - -### Combined options -```bash -# OpenClaw + Dry Run -standx --openclaw --dry-run order create BTC-USD buy limit --qty 0.01 --price 60000 - -# JSON output + limit -standx -o json market kline BTC-USD -r 60 --from 1d -l 5 -``` - -## Scripting Examples - -### Get current price in script -```bash -PRICE=$(standx -o quiet market ticker BTC-USD) -echo "Current BTC price: $PRICE" -``` - -### Check if authenticated -```bash -if standx auth status | grep -q "Authenticated"; then - echo "Logged in" -else - echo "Not logged in" -fi -``` - -### Monitor price changes -```bash -while true; do - PRICE=$(standx -o quiet market ticker BTC-USD) - echo "$(date): BTC = $PRICE" - sleep 60 -done -``` diff --git a/references/troubleshooting.md b/references/troubleshooting.md deleted file mode 100644 index abbd51b..0000000 --- a/references/troubleshooting.md +++ /dev/null @@ -1,300 +0,0 @@ -# StandX CLI Troubleshooting - -## Installation Issues - -### Command not found - -```bash -# Check if installed -which standx - -# If not found, try: -# 1. Homebrew -brew tap wjllance/standx-cli -brew install standx-cli - -# 2. Direct download (Linux) -curl -L -o standx.tar.gz https://github.com/wjllance/standx-cli/releases/latest/download/standx-linux-x86_64.tar.gz -tar -xzf standx.tar.gz -sudo mv standx /usr/local/bin/ - -# 3. Direct download (macOS) -curl -L -o standx.tar.gz https://github.com/wjllance/standx-cli/releases/latest/download/standx-macos-aarch64.tar.gz -tar -xzf standx.tar.gz -sudo mv standx /usr/local/bin/ -``` - -## Authentication Issues - -### "Not authenticated" error - -**Solution:** Configure environment variables or login - -```bash -# Recommended: Environment variables -export STANDX_JWT="your_jwt_token" -export STANDX_PRIVATE_KEY="your_private_key" - -# Verify -standx auth status -``` - -### Environment variables not working - -**Check if variables are set:** - -```bash -echo $STANDX_JWT -echo $STANDX_PRIVATE_KEY -``` - -**Common causes:** - -1. **Shell not reloaded after editing rc file** - ```bash - source ~/.bashrc # or ~/.zshrc - ``` - -2. **Wrong variable name** - - Correct: `STANDX_JWT` - - Wrong: `STANDX_TOKEN`, `JWT_TOKEN` - -3. **Running in subshell or script** - - Variables must be exported: `export VAR=value` - - Check with `env | grep STANDX` - -4. **Running via sudo** - - Environment variables are stripped by sudo - - Use `sudo -E` or configure in root's environment - -### "Token expired" error - -**Solution:** Get new token from https://standx.com/user/session and update environment variable - -```bash -# Update in shell config -export STANDX_JWT="new_token" - -# Reload -source ~/.bashrc - -# Verify -standx auth status -``` - -### "Private key required" error - -**Solution:** Trading operations require Ed25519 private key - -```bash -# Add private key to environment -export STANDX_PRIVATE_KEY="your_private_key" - -# Or login interactively -standx auth login --interactive -``` - -### Credentials visible in shell history - -**Problem:** You used `standx auth login --token "xxx" --private-key "yyy"` - -**Solution:** - -1. **Clear history immediately:** - ```bash - history -d $(history 1) - # or clear all - history -c - ``` - -2. **Switch to environment variables:** - ```bash - # Add to ~/.bashrc or ~/.zshrc - export STANDX_JWT="your_token" - export STANDX_PRIVATE_KEY="your_key" - ``` - -3. **Use file-based login for scripts:** - ```bash - standx auth login --token-file ~/.standx_token --key-file ~/.standx_key - ``` - -### Permission denied on credential files - -**Solution:** Set proper permissions - -```bash -chmod 600 ~/.standx_token ~/.standx_key -chmod 700 ~/.config/standx -``` - -## API Issues - -### "HTTP request failed" error - -**Possible causes:** - -1. Network connectivity -2. API endpoint unavailable -3. Rate limiting - -**Solutions:** - -```bash -# Check network -ping perps.standx.com - -# Check API status -curl https://perps.standx.com/api/query_symbol_info - -# Wait and retry -sleep 5 && standx market ticker BTC-USD -``` - -### "Symbol not found" error - -**Solution:** Check available symbols - -```bash -standx market symbols -``` - -### K-line "no_data" response - -**Cause:** No data available for the requested time range - -**Solution:** Try different time range - -```bash -# Use relative time -standx market kline BTC-USD -r 60 --from 1d - -# Or use limit instead of from/to -standx market kline BTC-USD -r 60 -l 10 -``` - -## WebSocket Issues - -### "invalid token" for user streams - -**Status:** Known issue [#3](https://github.com/wjllance/standx-cli/issues/3) - -**Workaround:** Use public streams or check token validity - -```bash -# Public streams work without auth -standx stream price BTC-USD -standx stream depth BTC-USD -standx stream trade BTC-USD -``` - -### Connection drops - -**Solution:** CLI auto-reconnects, no action needed. For debugging: - -```bash -standx -v stream price BTC-USD -``` - -## Output Issues - -### JSON parsing errors - -**Solution:** Check if output is valid JSON - -```bash -standx -o json market ticker BTC-USD | jq . -``` - -### CSV format issues - -**Solution:** Ensure proper encoding - -```bash -export LANG=en_US.UTF-8 -standx -o csv market symbols -``` - -## Performance Issues - -### Slow response - -**Possible causes:** - -1. Network latency -2. API rate limiting -3. Large data queries - -**Solutions:** - -```bash -# Use limit to reduce data -standx market kline BTC-USD -r 60 --from 1d -l 10 - -# Use quiet mode for faster output -standx -o quiet market ticker BTC-USD -``` - -## Security Best Practices - -### Credential Storage - -| Method | Security | Use Case | -|--------|----------|----------| -| Environment variables | ⭐⭐⭐ High | Development, interactive use | -| File with 600 permissions | ⭐⭐⭐ High | Automation scripts | -| Command line args | ⭐ Low (leaks to history) | Avoid in production | - -### Recommended Setup - -```bash -# 1. Create secure directory -mkdir -p ~/.config/standx -chmod 700 ~/.config/standx - -# 2. Add to shell config (~/.bashrc or ~/.zshrc) -export STANDX_JWT="your_jwt_token" -export STANDX_PRIVATE_KEY="your_private_key" - -# 3. Reload -source ~/.bashrc - -# 4. Verify -standx auth status -``` - -### Rotating Credentials - -JWT tokens expire after 7 days. Set a reminder to rotate: - -```bash -# Check expiration -standx auth status - -# When expired, get new token and update environment -export STANDX_JWT="new_token" -``` - -## Getting Help - -### Check version - -```bash -standx --version -``` - -### View help - -```bash -standx --help -standx market --help -standx order create --help -``` - -### GitHub Issues - -https://github.com/wjllance/standx-cli/issues - -### Documentation - -https://github.com/wjllance/standx-cli/tree/main/docs diff --git a/skill.json b/skill.json deleted file mode 100644 index 40c9668..0000000 --- a/skill.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "standx-cli", - "version": "0.5.0", - "openclaw": { - "emoji": "📈", - "requires": { - "bins": ["standx"] - }, - "primaryCredential": { - "kind": "env", - "env": "STANDX_JWT", - "description": "StandX JWT token from https://standx.com/user/session (valid 7 days)" - }, - "optionalEnvVars": [ - { - "name": "STANDX_PRIVATE_KEY", - "description": "Ed25519 private key (Base58) for trading operations", - "sensitive": true - } - ], - "install": [ - { - "id": "brew", - "kind": "brew", - "formula": "wjllance/standx-cli/standx-cli", - "bins": ["standx"], - "label": "Install StandX CLI via Homebrew" - }, - { - "id": "github-linux", - "kind": "script", - "script": "curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-x86_64-unknown-linux-gnu.tar.gz && tar -xzf /tmp/standx.tar.gz -C /tmp && sudo mv /tmp/standx /usr/local/bin/ && sudo chmod +x /usr/local/bin/standx", - "bins": ["standx"], - "label": "Install StandX CLI on Linux" - }, - { - "id": "github-macos", - "kind": "script", - "script": "curl -L -o /tmp/standx.tar.gz https://github.com/wjllance/standx-cli/releases/download/v0.3.5/standx-v0.3.5-aarch64-apple-darwin.tar.gz && tar -xzf /tmp/standx.tar.gz -C /tmp && sudo mv /tmp/standx /usr/local/bin/ && sudo chmod +x /usr/local/bin/standx", - "bins": ["standx"], - "label": "Install StandX CLI on macOS" - }, - { - "id": "manual", - "kind": "script", - "script": "git clone https://github.com/wjllance/standx-cli-skill.git ~/.openclaw/skills/standx-cli && echo 'Skill installed. Please install standx binary separately via Homebrew or direct download.'", - "bins": ["standx"], - "label": "Manual install (skill only, binary separate)" - } - ] - } -} diff --git a/tests/integration/cli_commands.rs b/tests/integration/cli_commands.rs index 3f3a007..3bb5a4d 100644 --- a/tests/integration/cli_commands.rs +++ b/tests/integration/cli_commands.rs @@ -11,7 +11,7 @@ fn test_cli_version() { cmd.assert() .success() .stdout(predicate::str::contains("standx")) - .stdout(predicate::str::contains("0.6")); + .stdout(predicate::str::contains("0.7")); } #[test] diff --git a/version.json b/version.json index 1542eda..6811372 100644 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{"version": "0.6.3-rc.1"} +{"version": "0.7.0-rc.1"}