Trading upbit skill
Verified@kuns9
npx machina-cli add skill @kuns9/trading-upbit-skill --openclawtrading-upbit-skill
Upbit automated trading skill for OpenClaw and local execution.
What to consider before installing (Security)
This skill implements an automated Upbit trading bot and requires Upbit API keys. Before installing or handing over production keys:
-
Inspect critical files:
scripts/execution/upbitClient.js(Upbit HTTP client)scripts/config/index.js(config + secrets loading)skill.js(CLI entrypoint)
-
Run in dry-run mode first:
- Set
execution.dryRun=true - Run
node skill.js smoke_test,node skill.js monitor_once,node skill.js worker_once
- Set
-
Use the platform secret store:
- Provide keys via environment variables (OpenClaw Skills Config / secret store):
UPBIT_OPEN_API_ACCESS_KEYUPBIT_OPEN_API_SECRET_KEY
- Avoid storing secrets in
config.json.
- Provide keys via environment variables (OpenClaw Skills Config / secret store):
-
Limit key permissions during testing:
- Use minimal funds / a test account where possible.
- Monitor your Upbit account activity closely.
-
Quick self-check:
- Run
node skill.js security_checkto scan the repository for hard-coded external URLs (allowlist:api.upbit.com).
- Run
Security notes:
- This skill does not include telemetry and does not upload data by design.
- The Upbit API base URL is allowlisted to
https://api.upbit.com/v1and redirects are disabled.
What it does
- Monitors markets (watchlist + optional TopVolume)
- Generates BUY/SELL events in
resources/events.json - Processes events in a worker (places orders or dry-run), and persists positions in
resources/positions.json - Designed for cron:
monitor_onceandworker_onceare run-once commands
Commands
monitor_once
Run one monitoring cycle, enqueue events.
node skill.js monitor_once
worker_once
Process pending events (BUY/SELL), update positions.
node skill.js worker_once
smoke_test
Validate config and public endpoints (no trading).
node skill.js smoke_test
Budget Policy (v13)
Order sizing can be set to a percentage of available KRW, split equally across multiple buys in the same worker run.
{
"trading": {
"budgetPolicy": {
"mode": "balance_pct_split",
"pct": 0.3,
"reserveKRW": 0,
"minOrderKRW": 5000,
"roundToKRW": 1000
}
}
}
Behavior:
- totalBudget = floor((availableKRW - reserveKRW) * pct)
- if there are N BUY_SIGNALs pending, perOrderKRW = floor(totalBudget / N) rounded down to
roundToKRW
Cron (recommended)
Monitor (every 5 minutes):
cd <skillRoot> && node skill.js monitor_once
Worker (every 1 minute):
cd <skillRoot> && node skill.js worker_once
Files
Required:
config.json(do not commit)
Auto-created:
resources/events.jsonresources/positions.jsonresources/topVolumeCache.jsonresources/nearCounter.jsonresources/heartbeat.json
Testing utilities:
scripts/tests/*(see README_TESTING.md)
Overview
Trading-upbit-skill automates an aggressive breakout Upbit strategy. It monitors markets (watchlist plus optional TopVolume) and records BUY/SELL signals to resources/events.json, then a worker processes these events to place orders or dry-run and stores positions in resources/positions.json. It is cron-friendly, using monitor_once and worker_once, with a percent-based budget split to manage risk.
How This Skill Works
It continuously monitors markets and, when signals appear, enqueues events for the worker. The worker consumes pending BUY/SELL orders, executes them on Upbit (or dry-run), and updates resources/positions.json. Budget policy computes totalBudget as floor((availableKRW - reserveKRW) * pct) and derives perOrderKRW by dividing by the number of pending BUY signals, rounded to the configured increment.
When to Use It
- Cron-based automated trading on Upbit with monitor_once and worker_once
- Budgeting using a percentage of available KRW split across multiple buys
- TopVolume-enabled scanning to focus on high-volume symbols
- Dry-run testing mode before enabling real orders
- Signal-driven portfolio updates with persistent positions
Quick Start
- Step 1: Configure Upbit API keys in a secret store or environment (UPBIT_OPEN_API_ACCESS_KEY and UPBIT_OPEN_API_SECRET_KEY).
- Step 2: Run a dry-run smoke test to validate config: node skill.js smoke_test.
- Step 3: Schedule cron-friendly runs: monitor_once and worker_once (e.g., via cron: monitor_once every 5m, worker_once every minute).
Best Practices
- Always start with dry-run (execution.dryRun=true) to validate behavior.
- Store API keys in a secret store or environment (UPBIT_OPEN_API_ACCESS_KEY/SECRET_KEY) rather than config.json.
- Review critical files (scripts/execution/upbitClient.js, scripts/config/index.js, skill.js) before production.
- Regularly monitor resources/events.json and resources/positions.json for anomalies.
- Limit API key permissions and test with minimal funds; enable Upbit allowlist to https://api.upbit.com/v1 and disable redirects.
Example Use Cases
- A trader runs monitor_once every 5 minutes and worker_once every minute to catch rapid breakouts.
- A shop uses budgetPolicy balance_pct_split at 0.3 with minOrderKRW 5000 to diversify buys.
- TopVolume helps filter to actively traded symbols instead of illiquid ones.
- Dry-run mode simulates performance for a month before turning live.
- A small fund spreads risk by sizing each BUY using perOrderKRW computed from totalBudget.