Skip to content

okekedev/diamonds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Diamonds

Kraken-only crypto trading workspace. Real-time microstructure ingestion + ML-driven discretionary signals on USD pairs (~610 active coins). US/TX jurisdiction (USD-quoted only, no XMR, no on-chain staking).

Architecture

process role
dashboard Static HTTP server (/signals.html, /positions.html, POST /buy). Runs the positions monitor that polls Kraken balance every 60s and renders HOLD/SELL verdicts on held coins.
ingester WS subscriber for ~630 USD pairs. Aggregates trade + book channels into 5-min buckets across 4 tables (stats_price_5m, stats_volume_5m, stats_trades_5m, stats_quotes_5m). Runs derivations.py after each flush, then trains/scores the BUY and SELL signal models. Gated by INGESTER_ENABLED.

Signal models

Two XGBoost classifiers trained on all populated cross-coin-comparable derived columns from the 4 microstructure tables (raw price levels are dropped — they encode per-coin identity and overfit OOS).

model target horizon
BUY max(high[t+1..t+12]) / close[t] - 1 >= +10% next 1 hour
SELL min(low[t+1..t+6]) / close[t] - 1 <= -3% next 30 minutes

Retrained every hour, scored every 5-min cycle. Top-5 BUY picks render to signals.html; held-coin SELL scores power positions.html verdicts.

Order execution

Buy button on signals.html → POST /buy → spawns the patience-walk executor:

T=0s     post-only limit @ ref * 0.997   (−0.30%)
every 30s amend toward ref * 1.006        (+0.60%) in 7 steps over 3 min
hold at top for 2 min
cancel if not filled

Deployment

Single Azure Container App, min=1/max=1 replica in centralus. Image built from Dockerfile, published to GHCR by .github/workflows/deploy.yml. /app/data backed by an Azure File share so DuckDB, models, and HTML survive revisions.

Local dev

python3 scripts/ws_ingester.py        # WS ingester + derivations + scoring
python3 scripts/dashboard_server.py   # HTTP server + positions monitor

See CLAUDE.md for jurisdiction rules, schema, and conventions.

About

Crypto trading strategy paper trader (Kraken, public API, XGBoost-gated ladder market-making)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors