Novels of Scotland, software, and the space between. Author of the Wardstane Chronicles, the DI Cormac Buchan Investigations, and the Pondlife novels.
KrakenReact
GitHub · C#

KrakenReact

A React UX for Kraken trading.

View on GitHub

KrakenReact

A real-time cryptocurrency trading dashboard built with ASP.NET Core and React, connected to the Kraken exchange via REST API and WebSocket feeds.

Disclaimer

USE AT YOUR OWN RISK. KrakenReact is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, accuracy, and non-infringement.

By downloading, installing, configuring, running, modifying, or otherwise using this software, you acknowledge and agree that:

If you do not agree to these terms, do not use this software.

Features

Trading & Orders

Portfolio & Analytics

Automation

Notifications

Data & History

ML Predictions

System & Settings

Architecture

KrakenReact.Server/          ASP.NET Core backend (.NET 10)
  Controllers/               REST API endpoints
  Services/                  Background services, Kraken API, WebSocket handlers
  Hubs/                      SignalR hub for real-time push
  Data/                      EF Core DbContext and data access
  Models/                    Entity models
  DTOs/                      Data transfer objects

krakenreact.client/          React frontend (Vite)
  src/components/            Dashboard, Watchlist, TickerCard, OrderDialog, etc.
  src/pages/                 Tab pages (Balances, Orders, Trades, Settings, etc.)
  src/api/                   Axios client and SignalR connection

Key Technologies

Layer Technology
Backend ASP.NET Core 10, Entity Framework Core, Serilog
Frontend React 19, Vite, ag-grid Community, lightweight-charts
Real-time SignalR, Kraken WebSocket V1/V2
Database SQL Server
Jobs Hangfire (recurring + fire-and-forget background jobs)
Exchange Kraken.Net (CryptoExchange.Net)

Prerequisites

Getting Started

1. Clone and install dependencies

git clone <repo-url>
cd KrakenReact/KrakenReact

# Frontend dependencies
cd krakenreact.client
npm install
cd ..

2. Configure the database connection

Create KrakenReact.Server/appsettings.Local.json (this file is gitignored):

{
  "ConnectionStrings": {
    "EFDB": "Server=YOUR_SERVER;Database=Kraken;User Id=YOUR_USER;Password=YOUR_PASSWORD;TrustServerCertificate=True;Max Pool Size=100;"
  }
}

The application will automatically create and migrate all required tables on first run — no manual dotnet ef commands needed.

3. Configure Kraken API keys

API keys can be set in one of two ways:

4. Run the application

cd KrakenReact.Server
dotnet run

This starts both the ASP.NET backend (https://localhost:7247) and the Vite dev server (http://localhost:5173) automatically. Open http://localhost:5173 in your browser.

Background Services

Service / Job Schedule Purpose
BackgroundTaskService Continuous Startup data loading, periodic order/trade/balance refresh, kline priority loading, price alerts
KrakenWebSocketV1Service Continuous Public ticker feed — live prices for all ZUSD pairs
KrakenWebSocketV2Service Continuous Private feed — execution reports and balance changes
DailyPriceRefreshJob Configurable\* Fetches fresh OHLCV klines from Kraken for all tracked pairs (default 04:00)
PredictionJob Configurable\* Runs ML predictions for configured symbols (default 05:00)
StalePredictionRefreshJob Every N minutes\* Refreshes any prediction older than one candle interval (default every 15 min)
PortfolioSnapshotJob Daily 23:55 Records total portfolio value to database for the history chart
StopLossTakeProfitJob Every 5 min Checks all non-fiat balances against stop-loss, take-profit, and trailing stop thresholds
DrawdownAlertJob Daily 08:00 Computes 90-day drawdown and sends Pushover alert if threshold exceeded
AutoCancelJob Daily 09:00 Cancels open orders older than the configured number of days (buy and/or sell, configurable)
DcaJob Per-rule cron Dollar-cost averaging — places a limit buy for each active DCA rule on its schedule
RebalanceJob Per-schedule cron Rebalance automation — sends alert or places orders when portfolio drift exceeds minimum

\* Configurable from Settings → Schedule in the UI.

Configuration

All configuration is managed from the Settings tab:

General

Schedule

API Keys

Trading Lists

Asset Normalisations

Pinned ticker pairs are also persisted to the database.


Price Alerts

Alerts are managed from the Price Alerts tab:


Rebalance Schedules

The Rebalance tab includes an automated schedule manager:


ML Predictions

The Predictions tab runs a machine-learning pipeline against Kraken OHLCV kline data and presents the results as per-symbol cards. This section explains every metric displayed and what it means in practice.

How the model works

For each configured symbol the job:

  1. Fetches the stored kline history (1-minute through 1-day candles, configurable).
  2. Computes 23 technical features: RSI, MACD (signal and histogram), ATR (raw and as % of price), Bollinger Band width and %B, volume percentile, On-Balance Volume, ADX(14), Rate of Change(10), VWAP ratio, time-of-week seasonality indicator, and BTC market context (zeroed for XBT/USD itself to avoid circular reference).
  3. Creates binary labels — did the close price rise over the next 1, 3, or 6 candles?
  4. Trains two models on a strict 70/30 chronological split (no data leakage): a FastTree gradient-boosted decision tree and a logistic regression.
  5. Additionally runs walk-forward cross-validation: the data is split into rolling windows, each model is trained on an earlier window and tested on the following window, and the results are averaged. This gives a more realistic picture of out-of-sample performance.
  6. The final prediction for each horizon is taken from whichever model scored highest on the test set.

Per-card metrics explained

Direction and Confidence

Display Meaning
↑ UP / ↓ DOWN The model's predicted direction for the next candle at the configured interval.
Confidence % The model's probability score for that direction (0–100%). 50% = no edge, >55% starts to be meaningful, >65% is strong. This is the raw classifier output — it should not be interpreted as a reliable probability in isolation, especially for noisy short-term intervals.
Probability bar Visual representation of the confidence score; green for UP, red for DOWN.

Consensus

The model predicts three horizons simultaneously: 1 candle (1c), 3 candles (3c), and 6 candles (6c). The consensus badge summarises how many of the three agree:

Treat strong consensus signals more seriously than single-horizon predictions.

Actual Hit-Rate

e.g. 57.3% actual hit-rate (44 checked)

This is the retrospective accuracy of the model's past predictions for this symbol, computed by comparing old stored predictions to what the price actually did afterwards. It is the most honest measure of real-world model performance because it uses live predictions rather than back-tested data.

The number in parentheses is how many past predictions have been evaluated. Small sample sizes make the hit-rate unreliable.

Market Regime

e.g. trending · ADX 28 · BB 4.2%

The regime badge describes the current market character based on two indicators:

Regime labels:

Kelly Criterion

e.g. Kelly 4.2% · suggest $380

The Kelly criterion is a formula from information theory that suggests the optimal fraction of your bankroll to risk on a bet given a known edge and win rate. It is computed from the model's historical win rate and average win/loss ratio.

Half-Kelly (displayed) is standard practice — most practitioners use half the full Kelly fraction to account for estimation error and reduce variance.

Important caveats: Kelly assumes the model's edge estimate is accurate, that the win/loss ratio is stable, and that position size is applied consistently across many trades. Crypto markets are far noisier than the assumptions require. Treat Kelly sizing as an upper bound, not a prescription.

Confidence Histogram

Clicking Confidence histogram shows a bar chart of hit-rate by confidence decile across all past predictions for this symbol. Each bar represents a 10-percentage-point confidence bucket (0–10%, 10–20%, …, 90–100%) and shows the fraction of predictions in that bucket that were correct.

What to look for:

Per-Horizon Detail boxes (1c / 3c / 6c)

Each horizon box shows:

Metric Meaning
Direction + confidence Predicted direction and probability for that specific horizon.
FT acc FastTree model test-set accuracy on the 30% hold-out. Higher is better; > 55% is useful in crypto.
AUC Area Under the ROC Curve for FastTree. 0.5 = random, 1.0 = perfect. A value > 0.55 suggests the model has genuine discriminative power.
WF acc FastTree walk-forward accuracy — average accuracy across out-of-sample folds. This is more conservative than test-set accuracy and a better proxy for live performance.
WF AUC Walk-forward AUC for FastTree. Same interpretation as AUC but averaged across folds.
LR % Logistic regression test-set accuracy.
WF LR Logistic regression walk-forward accuracy.

Colour coding on the LR row: green ≥ 58%, amber ≥ 52%, red < 52%.

Benchmarks

Metric Meaning
1c / 3c / 6c Buy & Hold What fraction of periods the price went up over each horizon, based on historical data. If the market rises 52% of the time, a model needs > 52% accuracy to be useful at all. A model that beats its benchmark is providing genuine value beyond simply expecting the market to go up.
1c SMA crossover Accuracy of a simple moving-average crossover strategy over the same period and horizon. This is a naive technical benchmark — if the ML model cannot beat it, it offers little advantage.

Summary Statistics

Metric Meaning
WF folds Number of walk-forward validation windows used. More folds = more robust estimate of out-of-sample performance.
Candles Training samples / test samples / total candles in the dataset. Larger datasets generally produce more reliable models; very small datasets (< 200 candles) produce unreliable results.

Confidence Trend Sparkline

The small chart at the bottom of each card shows the model's confidence score across the last 20 runs for that symbol. Each dot is coloured green (UP prediction) or red (DOWN prediction). The dashed line shows the overall trend in confidence.


Interpreting predictions responsibly

Accuracy above ~55% in a noisy crypto market is genuinely useful — but nothing here is financial advice. The benchmark columns exist specifically to show what chance alone looks like for each asset. A model that beats Buy & Hold accuracy and its SMA crossover benchmark has demonstrated some edge; one that does not has not.

Key limitations to keep in mind:


Docker Support

You can build and run KrakenReact using Docker for simplified deployment and consistent environments.

Quick Start

  1. Build images:

``bash docker build -t krakenreact-server -f KrakenReact.Server/Dockerfile . docker build -t krakenreact-client -f krakenreact.client/Dockerfile . ``

  1. Run containers:

``bash docker run -d --name krakenreact-server -p 7247:7247 krakenreact-server docker run -d --name krakenreact-client -p 5173:5173 krakenreact-client ` Or use Docker Compose if available: `bash docker-compose up --build ``

  1. Configuration:

The .dockerignore file ensures fast, clean builds by excluding node_modules, bin/obj, test projects, etc.


License

Private -- not for redistribution.


Reminder: use of this software is entirely at your own risk. The author(s) accept no liability whatsoever for any losses, errors, incorrect data, missed or erroneous orders, or any other damages arising from its use. See the Disclaimer above.

View KrakenReact on GitHub