Documentation

Specification

The architecture behind autonomous trading.

System

Architecture

A hybrid edge-cloud design. Critical control runs locally. Intelligence lives where it makes sense.

Local

Edge Daemon

Rust binary on Raspberry Pi. All real-time control with zero cloud dependency.

  • Device adaptors (Modbus, CAN, REST)
  • Safety gate and constraint clamping
  • Hash-chained audit log
  • Optimizer runtime

Cloud · Optional

Master Service

Factor ingestion, synthesis engine, forecasting. Fully self-hostable.

  • Multi-factor synthesis (MFF)
  • 48-hour price forecasts
  • Fleet aggregation (VPP)
  • Web dashboard
Execution

Control Loop

100ms cycle time. Sensor read, safety check, forecast, optimize, verify, dispatch, log.

main.rs
loop {
    let snapshot = device.read_sensors()?;
    let state = safety.validate(&snapshot)?;
    let forecast = forecaster.predict(&state, 48h)?;
    let plan = optimizer.solve(&state, &forecast)?;
    let setpoint = safety_gate.verify(&plan.next)?;
    device.dispatch(&setpoint)?;
    audit.append(&state, &setpoint);
    sleep(Duration::from_millis(100));
}
Decision Engine

Optimization

Stochastic dynamic programming with battery degradation awareness.

AlgorithmDynamic Programming
State bins501 SOC levels
Horizon48 hours rolling
ScenariosP10/P50/P90

Degradation Model

  • SOC: 5x stress at boundaries
  • C-rate: 1 + 2*(P/Pmax)^3
  • Thermal: Arrhenius (10x at 50C)
  • Cycle: Rainflow counting
Signal Processing

Multi-Factor Synthesis

Eleven expert models. Bayesian model averaging with heavy-tailed uncertainty.

MarketExpert
VolatilityExpert
WeatherExpert
GridHealthExpert
CarbonExpert
StabilityExpert
PeakShavingExpert
V2GExpert
ArbitrageExpert
FeedbackExpert
ReinforcementExpert

Bayesian Model Averaging with Student-t kernel (v=3)

Pipeline

Data Flow

From raw market data to verified setpoint. Every step audited.

01
Ingest·Price feeds, weather, grid signals flow into factor store
02
Synthesize·Expert models vote on market regime and opportunity
03
Forecast·48-hour probabilistic price and solar prediction
04
Optimize·DP solver finds value-maximizing schedule
05
Verify·Safety gate proves setpoint satisfies all constraints
06
Execute·Edge daemon dispatches command to hardware

Read the Code

Every algorithm described here is implemented and documented.

MIT licensed. No secrets. No proprietary magic.