API

Vault

The vault's value, history, balances, positions, orders, fills, funding and suggested transfers.

All vault endpoints need the database. Without it they answer 503 DATABASE_NOT_CONFIGURED.

GET /vault

The overview the app's home page shows. Cache: 2 s.

ts
interface VaultOverview {
  mode: "paper" | "live" | null;
  asOf: string | null;
  navUsd: number | null;
  navChange24hUsd: number | null;
  peakNavUsd: number | null;
  drawdownBps: number | null;
  pnlUsd: number;               // Σ strategy P&L
  pnl24hUsd: number;
  revenueUsd: number;           // Σ accrued creator fees, USD
  revenue24hUsd: number;
  reinvestedUsd: number;        // revenueUsd × 0.5 + pnlUsd
  startingNavUsd: number | null;
  hypeUsd: number | null;
  hypeExposure: number | null;
  hedgeRatio: number | null;
  venues: { elysiumUsd: number; hypercoreUsd: number };
  killSwitch: boolean;
  strategies: StrategyView[];
}

Values come from the latest snapshot. The 24 h change compares it with the newest snapshot older than 24 h (or the first one). peakNavUsd is the all-time highest snapshot. startingNavUsd and hedgeRatio come from the engine's heartbeat.

GET /vault/history

?range=1h|24h|7d|30d|all (anything else means 24h). One point per bucket, the last snapshot in each. Cache: 15 s.

RangeWindowBucket
1h1 hour1 minute
24h24 hours5 minutes
7d7 days1 hour
30d30 days4 hours
alleverything1 day
ts
interface HistoryPoint { t: number; navUsd: number; pnlUsd: number; revenueUsd: number; hypeUsd: number; drawdownBps: number }

GET /vault/balances

Every asset held, ordered by venue then USD value. Cache: 2 s.

ts
interface BalanceView { venue: "elysium" | "hypercore"; asset: string; amount: number; usd: number; updatedAt: string }

GET /vault/positions

Open and past positions, one per market. notionalUsd = |size| × markPx. Cache: 2 s.

ts
interface PositionView {
  market: string; venue: string; strategy: string;
  size: number; entryPx: number; markPx: number; notionalUsd: number;
  unrealizedUsd: number; realizedUsd: number; fundingUsd: number; updatedAt: string;
}

GET /vault/orders

Resting orders (open only, at most 200). Optional ?market=. Cache: 1 s.

ts
interface OrderView { id: string; venue: string; market: string; strategy: string; side: "buy" | "sell";
                      price: number; size: number; filled: number; level: number; createdAt: string }

GET /vault/fills

Every fill, newest first, paged. Filters: market, strategy, since. Cache: 2 s.

ts
interface FillView {
  id: number; time: string; venue: string; market: string; strategy: string; side: "buy" | "sell";
  price: number; size: number; notionalUsd: number; feeUsd: number;
  liquidity: "maker" | "taker" | "pool"; realizedUsd: number; txHash: string | null; paper: boolean;
}

GET /vault/funding

Perp funding payments (positive received, negative paid). Only ?limit=. Cache: 10 s.

ts
interface FundingView { id: number; time: string; market: string; size: number; rate: number; paymentUsd: number }

GET /vault/transfers

The latest 50 transfers the engine has suggested to the Safe (moving capital between Elysium and HyperCore). Cache: 10 s.

ts
interface TransferView { id: number; time: string; fromVenue: string; toVenue: string; asset: string;
                         amount: number; status: string; reason: string; txHash: string | null }

The engine only writes suggested. The statuses pending, done and dismissed exist in the schema but nothing sets them yet.