PolyClaw Trading supports a portable deployment model for Linux and macOS VPS instances. TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/deniszidbaev-cmyk/polyclaw-trading/llms.txt
Use this file to discover all available pages before exploring further.
scripts/create_portable_bundle.ps1 script assembles a self-contained ZIP — source code, launcher scripts, the Swift native runner, and an optional runtime snapshot — that can be copied to any server and started immediately. Every execution is journaled locally in runtime/executions/, and the cron_run.sh script makes scheduled recurring runs straightforward.
Creating the Portable Bundle
The bundle script is a PowerShell script that runs on Windows (or on Linux/macOS withpwsh). It stages files into a timestamped directory under dist/ and compresses them into a ZIP:
By default the bundle excludes
.env.local, openclaw.json, and all runtime state. This makes it safe to store in version control or share without exposing secrets. Use -IncludeSecrets only for direct machine-to-machine transfers where the ZIP is treated as sensitive material.- Root launcher scripts (
*.sh,*.cmd,*.bat) Dockerfileanddocker-compose.ymlPackage.swiftandSources/(the native macOS runner)- All Python source under
src/,scripts/,bot/,openclaw_bot/,llm_clients/ prompts/(editable LLM role prompts)tests/(audit suite)- A runtime snapshot (empty
executions/andlogs/directories, plus any existing JSON state files excludingmarket_reports.lock)
Self-Verifying Plugin Build
Thescripts/build_plugin.py script produces an OpenClaw plugin bundle in dist/. The build is self-verifying: the staged tree must pass the audit test set before the ZIP is written. A SHA-256 checksum is included in the bundle manifest.
dist/polyclaw-trading-plugin-<version>.zip and includes an openclaw.plugin.json manifest with the plugin ID, version, and configSchema for the safety-critical environment variables.
VPS Requirements
Any Linux or macOS VPS will work. The requirements are minimal:- Python 3.12+ —
python3 --versionto verify uv—pip install uvor see the uv install docsgit—git --versionto verify- SSH key authentication — recommended over password auth
- Xcode command line tools (macOS) —
xcode-select --install
Deploying to a VPS
Configure the environment
Copy the example file and fill in your values. Keep file permissions to At minimum you need:
600 so only your user can read it:cron_run.sh
cron_run.sh is the recommended entry point for recurring scheduled runs on Linux and macOS. It refreshes bankroll state, runs the pipeline in the specified mode, and logs timestamps and exit codes to runtime/cron_status.log:
cron_run.sh resolves the workspace path from OPENCLAW_WORKSPACE first, then falls back to the script’s own directory. When running from cron or launchd, the working directory is not guaranteed to be the repository root — always set OPENCLAW_WORKSPACE explicitly in your cron entry:Example cron Entry
Google Cloud VPS Setup
The repository includes a Google Cloud-specific setup helper. On Windows it delegates to PowerShell; on the VPS it can be run directly:ghcr.io/kilo-org/google-setup:latest) and runs the Kilo setup container with your setup token. The token is read from KILO_SETUP_TOKEN if set, or prompted securely at the terminal.
Security Notes
- Set
.env.localpermissions to600:chmod 600 .env.local - Use SSH key authentication on your VPS; disable password authentication
- The real OpenClaw home config (
~/.openclaw/openclaw.json) is modified exclusively throughopenclaw_patch.py, which takes a timestamped backup before every patch - Never pass secrets as command-line arguments — they appear in
ps auxand shell history - Keep the
runtime/directory on a filesystem accessible only to your user account
Runtime Directory Layout
All pipeline output lands inruntime/. The layout is consistent across Docker, native macOS, Windows, and VPS deployments:
| Path | Contents |
|---|---|
runtime/decisions.json | Latest trade decisions from the deterministic engine |
runtime/bankroll_state.json | Current equity, reserve, and risk limit state |
runtime/trade_history.json | Full history of all trade decisions |
runtime/open_positions_snapshot.json | Current open positions |
runtime/manual_review.json | Fallback queue when no usable candle feed exists |
runtime/executions/YYYYMMDD.json | Daily execution ledger (dry-run and live) |
runtime/cron_status.log | Timestamps and exit codes from cron_run.sh |
runtime/macos-runner.log | Output from the Swift macOS runner |
runtime/kilo-worker-*/ | Isolated Kilo worker profile directories |
runtime/logs/ | Additional service logs |
Repository Layout Boundaries
The repository is an intentional polyglot workspace where each language has one bounded responsibility:| Layer | Responsibility |
|---|---|
| Python | Trading logic, risk management, orchestration, dashboard, operator CLIs |
| Swift | Sources/ and tests/PolyclawMacSelfTests/ only; launches Python through file/CLI contracts |
| Shell / CMD / Batch / PowerShell | Platform launchers only; no business rules |
| JavaScript / TypeScript | Confined to extensions/kimi-claw and extensions/kimi-search |
src/. New operator-only commands belong under scripts/. Business rules must not be implemented in launcher scripts.