DOC_ID: 04-A
ML-04
Exhibit 04
DECLASSIFIED

MARGINLAB:
AN EXHIBIT ABOUT
A LEVER

“The friction is the point.”

Project Classification

Financial Simulation / Interactive Documentary

Tech Stack / Armament

  • SvelteKit (Core Engine)
  • D3.js (Visual Matrix)
  • Tailwind CSS (Structural UI)

Current Status

Archived -- Critical Stress

ORIGIN_PROMPT.txt

The
Mandate

“Build a dashboard that doesn't just show margin, but makes the user feel the physical weight of leverage. I want to see the exact moment mathematical theory becomes structural failure. No gamification. Just raw exposure. Show the math.”
SEC-03: MATHEMATICAL PROOFS CRITICAL FORMULAS
01
Core Foundation
Eq = V - L

Equity (Eq) equals total asset value (V) minus liabilities (L). The absolute bedrock of leverage mechanics.

02
Call Horizon
Call Price =
(L - C) / (S x (1 - MM))

The exact mathematical threshold where structural failure initiates. MM = Maintenance Margin.

03
Liquidation Trigger
Eq < MM

EXECUTE LIQUIDATION PROTOCOL

The Philosophy
of Friction

Axiom 1: The Architectural Lie

Modern brokerage interfaces are designed to eliminate friction. They abstract away the mechanics of leverage behind single-click buttons and smooth progress bars. This is an architectural lie. Leverage is inherently structural; it is the act of resting massive weight on a very narrow fulcrum.

Axiom 2: Visible Multiplication

Therefore, the multiplier must be visible. MARGINLAB forces the user to interact with the underlying math. When an equity curve dips below maintenance requirements, the interface doesn't just flash a warning; it structurally degrades.

Exhibit_A: Dashboard Spec v2.1.0
MARGINLAB dashboard preview
SEC-04: SYSTEM SCHEMATIC
NODE: ALPHA AccountEngine.ts
  • State Management (cash, holdings, margin)
  • Margin Calculations (Reg T, Portfolio)
  • Scenario Simulations (12 stress tests)
  • Trade Suggestions (Finder)
DASHBOARD
  • • Portfolio Viewer
  • • Margin Calculator
SIMULATION
  • • Trade Finder
  • • Stress Test Engine
Evolutionary Tape v0.1 → v1.0
FEB 12 Svelte Prototype
MAR 05 Logic Integration
APR 22 Simulation Engine Active
OPERATOR LOGS // TERMINAL
> INITIALIZING MARGIN SIMULATION SEQUENCE...
> LOAD: PortfolioData [OK]
> CALC: InitialMarginReq = 50%
> CALC: MaintMarginReq = 25%
> INJECTING STRESS TEST: 'CREDIT SHOCK'
> EVENT: Asset_V drops 15%
> WARN: Eq nearing MM boundary
> ALERT: Buffer shrinking -> 4.2%
> EVENT: Asset_V drops additional 8%
> CRITICAL ERROR: Eq < MM
> INITIATING LIQUIDATION PROTOCOL
> CALL PRICE BREACHED AT 11:04:32 AM
> AWAITING OPERATOR INPUT_
> AWAITING OPERATOR INPUT_ |
Material Ledger
CHOSEN Svelte

Reactivity model perfectly mirrors continuous financial data streams.

REJECTED Leaderboard

Gamification distracts from the severity of structural failure.

INVERTED Broker API

No real money. The stakes are pedagogical, not financial.

NOTES
Declassified Field Notes
DISCOVERY

Early user testing revealed that simple red text was insufficient to convey 'Margin Call'. Users treated it like a minor error, akin to a typo in a form.

FRICTION

We needed to introduce friction. A failing margin state shouldn't just look bad; it should feel fundamentally broken. We started disabling non-essential UI elements to force focus on the crisis.

DECISION

The final implementation utilizes harsh, jagged charting lines and high-contrast red fills that bleed out of their containers when margin limits are breached. The layout breaks its own rules.

code
src/engine/marginUtils.ts
ts
1export function calculateMarginRequirement(2  positionValue: number,3  leverageRatio: number4): number {5  // The brutally simple math that ruins weekends.6  if (leverageRatio <= 0) return positionValue;78  const initialMargin = positionValue / leverageRatio;9  const maintenanceMargin = initialMargin * 0.75; // Hardcoded pain point10  return {11    initial: initialMargin,12    maintenance: maintenanceMargin,13    isCritical: function(currentEquity: number) {14      return currentEquity < maintenanceMargin;15    }16  };17}
X

The Refusal
List

Defining the product by explicitly stating what it refuses to be. Subtraction as a primary design principle.

NULL
  • x
    No Gamified Progress Bars
  • x
    No "Soft" Warnings
  • x
    No Hidden Fees in Math
  • x
    No Compromise on Friction