API

Strategies & ledger

Each strategy's money and state, the event ledger, and the latest arbitrage scan.

GET /strategies

All five strategies, always in the same order, even if the engine has never run. Cache: 2 s.

ts
interface StrategyView {
  id: "harvest" | "hypercore-mm" | "montra-mm" | "hedge" | "arb";
  name: string; venue: string; summary: string;
  status: "running" | "paused" | "halted" | "idle" | "blocked" | "offline";
  allocationBps: number; capitalUsd: number;
  pnlUsd: number; realizedUsd: number; unrealizedUsd: number;
  feesUsd: number; fundingUsd: number; volumeUsd: number; trades: number;
  params: Record<string, unknown>;
  note: string | null;
  lastActionAt: string | null;
}

Status is offline when the strategy has no row yet, or when the engine has stopped reporting while the row still says running.

GET /strategies/:id

One strategy with its last 30 events and last 30 fills. id must be one of the five ids, otherwise 404. Cache: 2 s.

ts
{
  strategy: StrategyView,
  events: Array<{ id, time, kind, severity, title, market, detail, txHash }>,
  fills: Array<{ id, time, market, side, price, size, notionalUsd, feeUsd, realizedUsd, liquidity }>
}

GET /ledger

Everything the engine did, newest first, paged. Filters: kind, strategy, market. Cache: 2 s.

ts
interface EventView {
  id: number; time: string; kind: string; severity: "info" | "warn" | "error";
  strategy: string | null; venue: string | null; market: string | null;
  title: string; detail: Record<string, unknown>; txHash: string | null;
}

Event kinds: engine, risk, revenue, harvest, swap, hedge, funding, arb, transfer, strategy. See Accounting.

bash
curl "https://<your-site>/api/v1/ledger?kind=risk&limit=20"

GET /arb

The latest arbitrage scan. Cache: 2 s. Returns {asOf: null, pairs: []} if the engine has never written one.

ts
interface ArbView {
  asOf: string | null;
  pairs: Array<{ pair: string; montraPx: number | null; hypercoreBid: number | null; hypercoreAsk: number | null;
                 edgeBps: number | null; executable: boolean; reason: string }>;
}