Skip to content

About

Grid trading bot for the OKX exchange, built with .NET and CryptoExchange.Net.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Micro Grid Bot

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.

Run locally

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.ps1

macOS:

chmod +x scripts/run-local.sh
./scripts/run-local.sh

Open 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.

Build and test

dotnet build MicroGrid.sln -c Release
dotnet test MicroGrid.sln -c Release

Container

docker 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-bot

Architecture

  • src/MicroGrid.Domain: allocation, fee-aware grid math, and inventory ledger
  • src/MicroGrid.Application: exchange-neutral gateway contracts
  • src/MicroGrid.Bot: localhost UI/API and OKX monitoring host
  • src/MicroGrid.Web: optional Vercel/Supabase control-plane prototype
  • infra/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.

Localhostmgr

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/health

Dashboard: http://127.0.0.1:5080/ Supervisor portal: http://localhost:19999/

About

Grid trading bot for the OKX exchange, built with .NET and CryptoExchange.Net.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages