Local-first OKX BTC-USDT micro-grid control panel and monitoring service. One ASP.NET Core process hosts the browser UI, localhost API, OKX monitor, and durable local settings. Vercel and Supabase are optional and are not required for this mode.
Current safety state: OKX market data, balances, and account fee tiers are read live. Order placement is deliberately locked off while execution and reconciliation are completed.
Requirements: .NET 10 SDK and an OKX API key with read permission. Do not grant withdrawal permission.
Copy .env.example to .env and provide OKX_API_KEY, OKX_API_SECRET, and OKX_PASSPHRASE.
The .env file is gitignored. Set OKX_DEMO_MODE=true for a demo-trading key or false for a
live-trading key. OKX_REGION defaults to GLOBAL; AU and US are also supported.
Windows PowerShell:
.\scripts\run-local.ps1macOS:
chmod +x scripts/run-local.sh
./scripts/run-local.shOpen http://localhost:5080. Stop it with Ctrl+C. The service binds only
to 127.0.0.1 by default, so other computers cannot reach it. Keep the computer awake and the
terminal process running; on macOS, caffeinate -i ./scripts/run-local.sh can prevent idle sleep.
Grid settings are written atomically to data/settings.json. API secrets stay only in .env and
are never returned by the localhost API or displayed in the UI.
dotnet build MicroGrid.sln -c Release
dotnet test MicroGrid.sln -c Releasedocker build -t micro-grid-bot .
docker run --rm --env-file .env -p 127.0.0.1:5080:8080 -v "$PWD/data:/app/data" micro-grid-botsrc/MicroGrid.Domain: allocation, fee-aware grid math, and inventory ledgersrc/MicroGrid.Application: exchange-neutral gateway contractssrc/MicroGrid.Bot: localhost UI/API and OKX monitoring hostsrc/MicroGrid.Web: optional Vercel/Supabase control-plane prototypeinfra/supabase: optional cloud control-plane schema
The accepted product scope is in docs/scope/okx-spot-btc-micro-grid.md; architecture details are
in docs/architecture/overview.md.
Registered as micro-grid-bot on port 5080, health probe /health. Currently disabled
until a real .env exists (never commit it).
cp .env.example .env # fill OKX_API_KEY / OKX_API_SECRET / OKX_PASSPHRASE
localhostmgr enable micro-grid-bot
localhostmgr start micro-grid-bot
localhostmgr status micro-grid-bot
curl -s http://127.0.0.1:5080/healthDashboard: http://127.0.0.1:5080/ Supervisor portal: http://localhost:19999/