StandX CLI Skill
StandX CLI is a crypto trading command-line tool for the StandX exchange.
Installation
Option 1: ClawHub (Recommended - Auto-install)
CODEBLOCK0
Option 2: Homebrew
CODEBLOCK1
Option 3: Direct Download
CODEBLOCK2
Option 4: Manual Install (Skill Only)
If you prefer to install the skill manually and manage the binary separately:
CODEBLOCK3
Quick Start
Check installation:
CODEBLOCK4
View BTC price:
CODEBLOCK5
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.
CODEBLOCK6
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
CODEBLOCK7
Alternative Authentication Methods
Interactive Login
For first-time setup or testing:
CODEBLOCK8
File-based Login
For automation scripts where environment variables are not available:
CODEBLOCK9
⚠️ Avoid this in production:
CODEBLOCK10
Logout
CODEBLOCK11
Market Data (No auth required)
List trading pairs
CODEBLOCK12
Get ticker
CODEBLOCK13
Order book depth
CODEBLOCK14
K-line (candlestick) data
CODEBLOCK15
Funding rate
CODEBLOCK16
Account & Trading (Auth required)
Account info
CODEBLOCK17
Create order
CODEBLOCK18
Cancel order
CODEBLOCK19
Trade history
CODEBLOCK20
Leverage & Margin (Auth required)
CODEBLOCK21
Real-time Streaming
Public streams (No auth)
CODEBLOCK22
User streams (Auth required)
CODEBLOCK23
Output Formats
CODEBLOCK24
Special Modes
OpenClaw mode (AI-optimized JSON)
CODEBLOCK25
Dry run (preview without executing)
CODEBLOCK26
References
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
StandX CLI 技能
StandX CLI 是用于StandX交易所的加密货币交易命令行工具。
安装
方式一:ClawHub(推荐 - 自动安装)
bash
clawhub install standx-cli
方式二:Homebrew
bash
brew tap wjllance/standx-cli
brew install standx-cli
方式三:直接下载
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
方式四:手动安装(仅技能)
如果您希望手动安装技能并单独管理二进制文件:
bash
安装技能
git clone https://github.com/wjllance/standx-cli-skill.git ~/.openclaw/skills/standx-cli
然后通过Homebrew或直接下载单独安装二进制文件(参见方式二或三)
快速开始
检查安装:
bash
standx --version
查看BTC价格:
bash
standx market ticker BTC-USD
身份验证
大多数命令需要身份验证。StandX CLI支持多种安全的身份验证方法。
环境变量(推荐)
最安全的身份验证方式。凭据不会存储在shell历史记录或命令日志中。
bash
添加到 ~/.bashrc 或 ~/.zshrc
export STANDX
JWT=yourjwt_token
export STANDX
PRIVATEKEY=your
ed25519private_key
重新加载shell配置
source ~/.bashrc
安全最佳实践:
- - 切勿在命令中硬编码凭据(会出现在shell历史记录中)
- 切勿将凭据提交到版本控制
- 对包含凭据的文件设置600权限
- 定期轮换令牌(7天后过期)
获取凭据
访问 https://standx.com/user/session 生成:
- - JWT令牌(必需) - 有效期为7天,用于读取账户数据
- Ed25519私钥(可选但推荐) - 交易操作必需
验证身份验证
bash
standx auth status
替代身份验证方法
交互式登录
适用于首次设置或测试:
bash
standx auth login --interactive
基于文件的登录
适用于环境变量不可用的自动化脚本:
bash
将凭据存储在具有受限权限的文件中
echo your
jwttoken > ~/.standx_token
echo your
privatekey > ~/.standx_key
chmod 600 ~/.standx
token ~/.standxkey
使用文件登录
standx auth login --token-file ~/.standx
token --key-file ~/.standxkey
⚠️ 避免在生产环境中使用:
bash
危险:凭据将在shell历史记录中可见
standx auth login --token your
token --private-key yourkey
退出登录
bash
standx auth logout
市场数据(无需身份验证)
列出交易对
bash
standx market symbols
获取行情
bash
standx market ticker BTC-USD
standx market ticker ETH-USD
订单簿深度
bash
standx market depth BTC-USD --limit 10
K线(蜡烛图)数据
bash
最近24小时,1小时K线
standx market kline BTC-USD -r 60 --from 1d
最近7天,日K线
standx market kline BTC-USD -r 1D --from 7d
特定日期范围
standx market kline BTC-USD -r 60 --from 2024-01-01 --to 2024-01-07
资金费率
bash
standx market funding BTC-USD --days 7
账户与交易(需要身份验证)
账户信息
bash
standx account balances
standx account positions
standx account orders
standx account history --limit 20
创建订单
bash
限价买入
standx order create BTC-USD buy limit --qty 0.01 --price 60000
市价卖出
standx order create BTC-USD sell market --qty 0.01
取消订单
bash
standx order cancel BTC-USD --order-id 123456
standx order cancel-all BTC-USD
交易历史
bash
standx trade history BTC-USD --from 7d
杠杆与保证金(需要身份验证)
bash
查询杠杆
standx leverage get BTC-USD
设置杠杆
standx leverage set BTC-USD 10
查询保证金模式
standx margin mode BTC-USD
设置保证金模式
standx margin mode BTC-USD --set isolated
实时流
公共流(无需身份验证)
bash
价格流
standx stream price BTC-USD
订单簿流
standx stream depth BTC-USD --levels 5
交易流
standx stream trade BTC-USD
用户流(需要身份验证)
bash
standx stream order # 订单更新
standx stream position # 持仓更新
standx stream balance # 余额更新
standx stream fills # 成交更新
输出格式
bash
JSON输出
standx -o json market ticker BTC-USD
CSV导出
standx -o csv market symbols > symbols.csv
静默模式(仅输出值)
standx -o quiet config get base_url
特殊模式
OpenClaw模式(AI优化的JSON)
bash
standx --openclaw market ticker BTC-USD
试运行(预览而不执行)
bash
standx --dry-run order create BTC-USD buy limit --qty 0.01 --price 60000
参考
链接
- - GitHub:https://github.com/wjllance/standx-cli
- 文档:https://github.com/wjllance/standx-cli/tree/main/docs
- 问题反馈:https://github.com/wjllance/standx-cli/issues