{
 "version": "headroom_venue_formulas_reference_v1_3_2026-11-15",
 "n": 48,
 "constants_note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table",
 "vectors": [
  {
   "calculator": "liquidation",
   "case": "binance_formula_isolated_long_10x",
   "inputs": {
    "venue": "binance_usdm",
    "mode": "isolated",
    "side": "long",
    "qty": 0.5,
    "entry": 60000.0,
    "wallet_balance": 3000.0,
    "mmr": 0.006,
    "maint_amount": 0.0
   },
   "expected": {
    "liq_price": 54325.955734
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "binance_formula_isolated_short_10x",
   "inputs": {
    "venue": "binance_usdm",
    "mode": "isolated",
    "side": "short",
    "qty": 0.5,
    "entry": 60000.0,
    "wallet_balance": 3000.0,
    "mmr": 0.006,
    "maint_amount": 0.0
   },
   "expected": {
    "liq_price": 65606.361829
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "binance_formula_isolated_long_50x",
   "inputs": {
    "venue": "binance_usdm",
    "mode": "isolated",
    "side": "long",
    "qty": 0.5,
    "entry": 60000.0,
    "wallet_balance": 600.0,
    "mmr": 0.006,
    "maint_amount": 0.0
   },
   "expected": {
    "liq_price": 59154.929577
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "binance_formula_isolated_short_3x",
   "inputs": {
    "venue": "binance_usdm",
    "mode": "isolated",
    "side": "short",
    "qty": 0.5,
    "entry": 60000.0,
    "wallet_balance": 10000.0,
    "mmr": 0.006,
    "maint_amount": 0.0
   },
   "expected": {
    "liq_price": 79522.862823
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "binance_formula_isolated_long_added_margin",
   "inputs": {
    "venue": "binance_usdm",
    "mode": "isolated",
    "side": "long",
    "qty": 2.0,
    "entry": 60000.0,
    "wallet_balance": 15000.0,
    "mmr": 0.008,
    "maint_amount": 200.0
   },
   "expected": {
    "liq_price": 52822.580645
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "10x initial margin 12,000 plus 3,000 added; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "binance_formula_cross_other_positions",
   "inputs": {
    "venue": "binance_usdm",
    "mode": "cross",
    "side": "long",
    "qty": 0.5,
    "entry": 60000.0,
    "wallet_balance": 20000.0,
    "mmr": 0.008,
    "maint_amount": 200.0,
    "other_mm": 1500.0,
    "other_upnl": -2500.0
   },
   "expected": {
    "liq_price": 27822.580645
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "cross: other positions' maintenance margin and open P/L; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "binance_formula_tiered_long_0.5btc_20x",
   "inputs": {
    "venue": "binance_usdm",
    "mode": "isolated",
    "side": "long",
    "qty": 0.5,
    "entry": 60000.0,
    "wallet_balance": 1500.0,
    "brackets": [
     [
      100000,
      0.006,
      0.0
     ],
     [
      500000,
      0.008,
      200.0
     ],
     [
      5000000,
      0.015,
      3700.0
     ],
     [
      20000000,
      0.03,
      78700.0
     ]
    ]
   },
   "expected": {
    "liq_price": 57344.064386,
    "bracket_index": 0
   },
   "tolerance": {
    "liq_price": 0.01,
    "bracket_index": 0
   },
   "note": "tests the bracket choice at the liquidation price; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "binance_formula_tiered_long_1.7btc_20x",
   "inputs": {
    "venue": "binance_usdm",
    "mode": "isolated",
    "side": "long",
    "qty": 1.7,
    "entry": 60000.0,
    "wallet_balance": 5100.0,
    "brackets": [
     [
      100000,
      0.006,
      0.0
     ],
     [
      500000,
      0.008,
      200.0
     ],
     [
      5000000,
      0.015,
      3700.0
     ],
     [
      20000000,
      0.03,
      78700.0
     ]
    ]
   },
   "expected": {
    "liq_price": 57344.064386,
    "bracket_index": 0
   },
   "tolerance": {
    "liq_price": 0.01,
    "bracket_index": 0
   },
   "note": "tests the bracket choice at the liquidation price; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "binance_formula_tiered_long_3.0btc_20x",
   "inputs": {
    "venue": "binance_usdm",
    "mode": "isolated",
    "side": "long",
    "qty": 3.0,
    "entry": 60000.0,
    "wallet_balance": 9000.0,
    "brackets": [
     [
      100000,
      0.006,
      0.0
     ],
     [
      500000,
      0.008,
      200.0
     ],
     [
      5000000,
      0.015,
      3700.0
     ],
     [
      20000000,
      0.03,
      78700.0
     ]
    ]
   },
   "expected": {
    "liq_price": 57392.473118,
    "bracket_index": 1
   },
   "tolerance": {
    "liq_price": 0.01,
    "bracket_index": 0
   },
   "note": "tests the bracket choice at the liquidation price; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "binance_formula_tiered_long_20.0btc_20x",
   "inputs": {
    "venue": "binance_usdm",
    "mode": "isolated",
    "side": "long",
    "qty": 20.0,
    "entry": 60000.0,
    "wallet_balance": 60000.0,
    "brackets": [
     [
      100000,
      0.006,
      0.0
     ],
     [
      500000,
      0.008,
      200.0
     ],
     [
      5000000,
      0.015,
      3700.0
     ],
     [
      20000000,
      0.03,
      78700.0
     ]
    ]
   },
   "expected": {
    "liq_price": 57680.203046,
    "bracket_index": 2
   },
   "tolerance": {
    "liq_price": 0.01,
    "bracket_index": 0
   },
   "note": "tests the bracket choice at the liquidation price; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "bybit_formula_isolated_long_10x",
   "inputs": {
    "venue": "bybit_linear",
    "mode": "isolated",
    "side": "long",
    "qty": 0.5,
    "entry": 60000.0,
    "leverage": 10,
    "mmr": 0.006,
    "mm_deduction": 0.0,
    "extra_margin": 0.0,
    "taker": 0.0006
   },
   "expected": {
    "liq_price": 54325.955734
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "bybit_formula_isolated_short_10x",
   "inputs": {
    "venue": "bybit_linear",
    "mode": "isolated",
    "side": "short",
    "qty": 0.5,
    "entry": 60000.0,
    "leverage": 10,
    "mmr": 0.006,
    "mm_deduction": 0.0,
    "extra_margin": 0.0,
    "taker": 0.0006
   },
   "expected": {
    "liq_price": 65606.361829
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "bybit_formula_isolated_long_25x",
   "inputs": {
    "venue": "bybit_linear",
    "mode": "isolated",
    "side": "long",
    "qty": 0.5,
    "entry": 60000.0,
    "leverage": 25,
    "mmr": 0.006,
    "mm_deduction": 0.0,
    "extra_margin": 0.0,
    "taker": 0.0006
   },
   "expected": {
    "liq_price": 57947.686117
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "bybit_formula_isolated_short_5x",
   "inputs": {
    "venue": "bybit_linear",
    "mode": "isolated",
    "side": "short",
    "qty": 0.5,
    "entry": 60000.0,
    "leverage": 5,
    "mmr": 0.006,
    "mm_deduction": 0.0,
    "extra_margin": 0.0,
    "taker": 0.0006
   },
   "expected": {
    "liq_price": 71570.576541
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "bybit_formula_isolated_long_deduction_extra",
   "inputs": {
    "venue": "bybit_linear",
    "mode": "isolated",
    "side": "long",
    "qty": 2.0,
    "entry": 60000.0,
    "leverage": 10,
    "mmr": 0.0085,
    "mm_deduction": 450.0,
    "extra_margin": 1000.0,
    "taker": 0.0006
   },
   "expected": {
    "liq_price": 53731.416863
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "deduction and added margin; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "bybit_formula_isolated_short_extra_margin",
   "inputs": {
    "venue": "bybit_linear",
    "mode": "isolated",
    "side": "short",
    "qty": 1.0,
    "entry": 40000.0,
    "leverage": 20,
    "mmr": 0.006,
    "mm_deduction": 0.0,
    "extra_margin": 500.0,
    "taker": 0.0006
   },
   "expected": {
    "liq_price": 42246.222843
   },
   "tolerance": {
    "liq_price": 0.01
   },
   "note": "added margin enters as extra / (1 + taker) on a short; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "bybit_formula_tiered_long_20btc_20x",
   "inputs": {
    "venue": "bybit_linear",
    "mode": "isolated",
    "side": "long",
    "qty": 20.0,
    "entry": 60000.0,
    "leverage": 20,
    "tiers": [
     [
      1500000,
      0.006,
      0.0
     ],
     [
      2500000,
      0.0075,
      2250.0
     ],
     [
      4000000,
      0.009,
      6000.0
     ]
    ],
    "extra_margin": 0.0,
    "taker": 0.0006
   },
   "expected": {
    "liq_price": 57344.064386,
    "tier_index": 0
   },
   "tolerance": {
    "liq_price": 0.01,
    "tier_index": 0
   },
   "note": "the tier is chosen at the liquidation price; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "bybit_formula_tiered_long_25.5btc_20x",
   "inputs": {
    "venue": "bybit_linear",
    "mode": "isolated",
    "side": "long",
    "qty": 25.5,
    "entry": 60000.0,
    "leverage": 20,
    "tiers": [
     [
      1500000,
      0.006,
      0.0
     ],
     [
      2500000,
      0.0075,
      2250.0
     ],
     [
      4000000,
      0.009,
      6000.0
     ]
    ],
    "extra_margin": 0.0,
    "taker": 0.0006
   },
   "expected": {
    "liq_price": 57344.064386,
    "tier_index": 0
   },
   "tolerance": {
    "liq_price": 0.01,
    "tier_index": 0
   },
   "note": "the tier is chosen at the liquidation price; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "bybit_formula_tiered_long_35btc_20x",
   "inputs": {
    "venue": "bybit_linear",
    "mode": "isolated",
    "side": "long",
    "qty": 35.0,
    "entry": 60000.0,
    "leverage": 20,
    "tiers": [
     [
      1500000,
      0.006,
      0.0
     ],
     [
      2500000,
      0.0075,
      2250.0
     ],
     [
      4000000,
      0.009,
      6000.0
     ]
    ],
    "extra_margin": 0.0,
    "taker": 0.0006
   },
   "expected": {
    "liq_price": 57365.958978,
    "tier_index": 1
   },
   "tolerance": {
    "liq_price": 0.01,
    "tier_index": 0
   },
   "note": "the tier is chosen at the liquidation price; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "bybit_formula_tiered_long_50btc_20x",
   "inputs": {
    "venue": "bybit_linear",
    "mode": "isolated",
    "side": "long",
    "qty": 50.0,
    "entry": 60000.0,
    "leverage": 20,
    "tiers": [
     [
      1500000,
      0.006,
      0.0
     ],
     [
      2500000,
      0.0075,
      2250.0
     ],
     [
      4000000,
      0.009,
      6000.0
     ]
    ],
    "extra_margin": 0.0,
    "taker": 0.0006
   },
   "expected": {
    "liq_price": 57396.569122,
    "tier_index": 2
   },
   "tolerance": {
    "liq_price": 0.01,
    "tier_index": 0
   },
   "note": "the tier is chosen at the liquidation price; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "delta_formula_isolated_long_im0.0125_mm0.006",
   "inputs": {
    "venue": "delta_india_linear",
    "mode": "isolated",
    "side": "long",
    "contracts": 500,
    "contract_value": 0.001,
    "entry": 60000.0,
    "im_rate": 0.0125,
    "mm_rate": 0.006
   },
   "expected": {
    "liq_price": 59610.0,
    "bankruptcy_price": 59250.0
   },
   "tolerance": {
    "liq_price": 0.01,
    "bankruptcy_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "delta_formula_isolated_short_im0.0125_mm0.006",
   "inputs": {
    "venue": "delta_india_linear",
    "mode": "isolated",
    "side": "short",
    "contracts": 500,
    "contract_value": 0.001,
    "entry": 60000.0,
    "im_rate": 0.0125,
    "mm_rate": 0.006
   },
   "expected": {
    "liq_price": 60390.0,
    "bankruptcy_price": 60750.0
   },
   "tolerance": {
    "liq_price": 0.01,
    "bankruptcy_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "delta_formula_isolated_long_im0.08_mm0.006",
   "inputs": {
    "venue": "delta_india_linear",
    "mode": "isolated",
    "side": "long",
    "contracts": 500,
    "contract_value": 0.001,
    "entry": 60000.0,
    "im_rate": 0.08,
    "mm_rate": 0.006
   },
   "expected": {
    "liq_price": 55560.0,
    "bankruptcy_price": 55200.0
   },
   "tolerance": {
    "liq_price": 0.01,
    "bankruptcy_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "delta_formula_isolated_short_im0.025_mm0.003",
   "inputs": {
    "venue": "delta_india_linear",
    "mode": "isolated",
    "side": "short",
    "contracts": 500,
    "contract_value": 0.001,
    "entry": 60000.0,
    "im_rate": 0.025,
    "mm_rate": 0.003
   },
   "expected": {
    "liq_price": 61320.0,
    "bankruptcy_price": 61500.0
   },
   "tolerance": {
    "liq_price": 0.01,
    "bankruptcy_price": 0.01
   },
   "note": "ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "liquidation",
   "case": "delta_formula_rate_schedule_above_threshold",
   "inputs": {
    "rate_min": 0.006,
    "slope": 0.0005,
    "size": 8.0,
    "threshold": 4.0
   },
   "expected": {
    "rate": 0.008
   },
   "tolerance": {
    "rate": 1e-12
   },
   "note": "flat-then-linear schedule shape; ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "margin",
   "case": "margin_required_0.75btc_20x_fee",
   "inputs": {
    "qty": 0.75,
    "price": 60000.0,
    "leverage": 20,
    "contract_value": 1.0,
    "open_fee_rate": 0.0006
   },
   "expected": {
    "notional": 45000.0,
    "initial_margin": 2250.0,
    "open_fee": 27.0,
    "total": 2277.0
   },
   "tolerance": {
    "notional": 0.01,
    "initial_margin": 0.01,
    "open_fee": 0.01,
    "total": 0.01
   },
   "note": "fee rate ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "margin",
   "case": "margin_required_250_contracts_0.001_50x",
   "inputs": {
    "qty": 250,
    "price": 60000.0,
    "leverage": 50,
    "contract_value": 0.001
   },
   "expected": {
    "notional": 15000.0,
    "initial_margin": 300.0,
    "open_fee": 0.0,
    "total": 300.0
   },
   "tolerance": {
    "notional": 0.01,
    "initial_margin": 0.01,
    "open_fee": 0.01,
    "total": 0.01
   },
   "note": ""
  },
  {
   "calculator": "margin",
   "case": "bybit_formula_cost_with_fee_to_close_short_10x",
   "inputs": {
    "venue": "bybit_linear",
    "side": "short",
    "qty": 0.5,
    "price": 60000.0,
    "leverage": 10,
    "taker": 0.0006
   },
   "expected": {
    "initial_margin": 3000.0,
    "fee_to_close": 19.8,
    "bybit_initial_margin_shown": 3019.8
   },
   "tolerance": {
    "initial_margin": 0.01,
    "fee_to_close": 0.01,
    "bybit_initial_margin_shown": 0.01
   },
   "note": "initial margin shown including the reserved fee to close; taker ILLUSTRATIVE constants chosen by Headroom, not any venue's table"
  },
  {
   "calculator": "margin",
   "case": "max_qty_1000usdt_10x_step0.001",
   "inputs": {
    "available": 1000.0,
    "price": 60000.0,
    "leverage": 10,
    "open_fee_rate": 0.0006,
    "qty_step": 0.001
   },
   "expected": {
    "max_qty": 0.165
   },
   "tolerance": {
    "max_qty": 0.0
   },
   "note": "rounded down to the step"
  },
  {
   "calculator": "margin",
   "case": "effective_leverage",
   "inputs": {
    "notional_total": 45000.0,
    "equity": 5000.0
   },
   "expected": {
    "effective_leverage": 9.0
   },
   "tolerance": {
    "effective_leverage": 1e-09
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "ftmo_2step_days1_eq96500",
   "inputs": {
    "rule": "FTMO_2STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000
    ],
    "equity_now": 96500
   },
   "expected": {
    "daily_floor": 95000.0,
    "max_floor": 90000.0,
    "binding_floor": 95000.0,
    "room": 1500.0,
    "daily_breached": false,
    "max_breached": false
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "ftmo_2step_days2_eq96900",
   "inputs": {
    "rule": "FTMO_2STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000,
     102000
    ],
    "equity_now": 96900
   },
   "expected": {
    "daily_floor": 97000.0,
    "max_floor": 90000.0,
    "binding_floor": 97000.0,
    "room": -100.0,
    "daily_breached": true,
    "max_breached": false
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "ftmo_2step_days3_eq90500",
   "inputs": {
    "rule": "FTMO_2STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000,
     94000,
     91500
    ],
    "equity_now": 90500
   },
   "expected": {
    "daily_floor": 86500.0,
    "max_floor": 90000.0,
    "binding_floor": 90000.0,
    "room": 500.0,
    "daily_breached": false,
    "max_breached": false
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "ftmo_1step_days3_eq95000",
   "inputs": {
    "rule": "FTMO_1STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000,
     104000,
     103000
    ],
    "equity_now": 95000
   },
   "expected": {
    "daily_floor": 100000.0,
    "max_floor": 94000.0,
    "binding_floor": 100000.0,
    "room": -5000.0,
    "daily_breached": true,
    "max_breached": false
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "ftmo_1step_days3_eq93900",
   "inputs": {
    "rule": "FTMO_1STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000,
     104000,
     103000
    ],
    "equity_now": 93900
   },
   "expected": {
    "daily_floor": 100000.0,
    "max_floor": 94000.0,
    "binding_floor": 100000.0,
    "room": -6100.0,
    "daily_breached": true,
    "max_breached": true
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "fundednext_stellar_2step_days2_eq98900",
   "inputs": {
    "rule": "FUNDEDNEXT_STELLAR_2STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000,
     104000
    ],
    "equity_now": 98900
   },
   "expected": {
    "daily_floor": 99000.0,
    "max_floor": 90000.0,
    "binding_floor": 99000.0,
    "room": -100.0,
    "daily_breached": true,
    "max_breached": false
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "fundednext_stellar_1step_days2_eq93950",
   "inputs": {
    "rule": "FUNDEDNEXT_STELLAR_1STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000,
     96500
    ],
    "equity_now": 93950
   },
   "expected": {
    "daily_floor": 93500.0,
    "max_floor": 94000.0,
    "binding_floor": 94000.0,
    "room": -50.0,
    "daily_breached": false,
    "max_breached": true
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "fundednext_stellar_lite_days1_eq96500",
   "inputs": {
    "rule": "FUNDEDNEXT_STELLAR_LITE",
    "initial": 100000,
    "start_of_day_balances": [
     100000
    ],
    "equity_now": 96500
   },
   "expected": {
    "daily_floor": 96000.0,
    "max_floor": 92000.0,
    "binding_floor": 96000.0,
    "room": 500.0,
    "daily_breached": false,
    "max_breached": false
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "ftmo_2step_days2_eq96000",
   "inputs": {
    "rule": "FTMO_2STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000,
     101000
    ],
    "equity_now": 96000
   },
   "expected": {
    "daily_floor": 96000.0,
    "max_floor": 90000.0,
    "binding_floor": 96000.0,
    "room": 0.0,
    "daily_breached": false,
    "max_breached": false
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "ftmo_1step_days2_eq94000",
   "inputs": {
    "rule": "FTMO_1STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000,
     104000
    ],
    "equity_now": 94000
   },
   "expected": {
    "daily_floor": 101000.0,
    "max_floor": 94000.0,
    "binding_floor": 101000.0,
    "room": -7000.0,
    "daily_breached": true,
    "max_breached": false
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "fundednext_stellar_2step_days2_eq96000",
   "inputs": {
    "rule": "FUNDEDNEXT_STELLAR_2STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000,
     101000
    ],
    "equity_now": 96000
   },
   "expected": {
    "daily_floor": 96000.0,
    "max_floor": 90000.0,
    "binding_floor": 96000.0,
    "room": 0.0,
    "daily_breached": true,
    "max_breached": false
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "prop_drawdown",
   "case": "fundednext_stellar_1step_days2_eq94000",
   "inputs": {
    "rule": "FUNDEDNEXT_STELLAR_1STEP",
    "initial": 100000,
    "start_of_day_balances": [
     100000,
     94000
    ],
    "equity_now": 94000
   },
   "expected": {
    "daily_floor": 91000.0,
    "max_floor": 94000.0,
    "binding_floor": 94000.0,
    "room": 0.0,
    "daily_breached": false,
    "max_breached": false
   },
   "tolerance": {
    "daily_floor": 0.0,
    "max_floor": 0.0,
    "binding_floor": 0.0,
    "room": 0.0,
    "daily_breached": 0,
    "max_breached": 0
   },
   "note": ""
  },
  {
   "calculator": "position_size",
   "case": "btc_long_1pct_no_fees",
   "inputs": {
    "equity": 10000.0,
    "risk_pct": 0.01,
    "entry": 60000.0,
    "stop": 59400.0,
    "qty_step": 0.001
   },
   "expected": {
    "side": "long",
    "qty": 0.166,
    "notional": 9960.0,
    "risk_amount": 99.6,
    "risk_pct_actual": 0.00996
   },
   "tolerance": {
    "qty": 0.0,
    "notional": 0.01,
    "risk_amount": 0.01,
    "risk_pct_actual": 1e-06,
    "margin": 0.01,
    "effective_leverage_on_equity": 1e-06
   },
   "note": ""
  },
  {
   "calculator": "position_size",
   "case": "btc_short_1pct_fees_10x",
   "inputs": {
    "equity": 10000.0,
    "risk_pct": 0.01,
    "entry": 60000.0,
    "stop": 60900.0,
    "qty_step": 0.001,
    "fee_in": 0.0006,
    "fee_out": 0.0006,
    "leverage": 10
   },
   "expected": {
    "side": "short",
    "qty": 0.102,
    "notional": 6120.0,
    "risk_amount": 99.19908,
    "risk_pct_actual": 0.00991991,
    "margin": 612.0,
    "effective_leverage_on_equity": 0.612
   },
   "tolerance": {
    "qty": 0.0,
    "notional": 0.01,
    "risk_amount": 0.01,
    "risk_pct_actual": 1e-06,
    "margin": 0.01,
    "effective_leverage_on_equity": 1e-06
   },
   "note": ""
  },
  {
   "calculator": "position_size",
   "case": "contracts_long_0.5pct_fees_25x",
   "inputs": {
    "equity": 25000.0,
    "risk_pct": 0.005,
    "entry": 60000.0,
    "stop": 58500.0,
    "contract_value": 0.001,
    "qty_step": 1,
    "fee_in": 0.0006,
    "fee_out": 0.0006,
    "leverage": 25
   },
   "expected": {
    "side": "long",
    "qty": 79,
    "notional": 4740.0,
    "risk_amount": 124.1169,
    "risk_pct_actual": 0.00496468,
    "margin": 189.6,
    "effective_leverage_on_equity": 0.1896
   },
   "tolerance": {
    "qty": 0.0,
    "notional": 0.01,
    "risk_amount": 0.01,
    "risk_pct_actual": 1e-06,
    "margin": 0.01,
    "effective_leverage_on_equity": 1e-06
   },
   "note": ""
  },
  {
   "calculator": "position_size",
   "case": "eurusd_lots_long_20pips",
   "inputs": {
    "equity": 10000.0,
    "risk_pct": 0.01,
    "entry": 1.085,
    "stop": 1.083,
    "contract_value": 100000,
    "qty_step": 0.01
   },
   "expected": {
    "side": "long",
    "qty": 0.5,
    "notional": 54250.0,
    "risk_amount": 100.0,
    "risk_pct_actual": 0.01
   },
   "tolerance": {
    "qty": 0.0,
    "notional": 0.01,
    "risk_amount": 0.01,
    "risk_pct_actual": 1e-06,
    "margin": 0.01,
    "effective_leverage_on_equity": 1e-06
   },
   "note": ""
  },
  {
   "calculator": "position_size",
   "case": "xauusd_lots_long_10usd",
   "inputs": {
    "equity": 10000.0,
    "risk_pct": 0.01,
    "entry": 2000.0,
    "stop": 1990.0,
    "contract_value": 100,
    "qty_step": 0.01
   },
   "expected": {
    "side": "long",
    "qty": 0.1,
    "notional": 20000.0,
    "risk_amount": 100.0,
    "risk_pct_actual": 0.01
   },
   "tolerance": {
    "qty": 0.0,
    "notional": 0.01,
    "risk_amount": 0.01,
    "risk_pct_actual": 1e-06,
    "margin": 0.01,
    "effective_leverage_on_equity": 1e-06
   },
   "note": ""
  },
  {
   "calculator": "position_size",
   "case": "stop_beyond_liquidation_warning",
   "inputs": {
    "side": "long",
    "entry": 60000.0,
    "stop": 58000.0,
    "liq_from": "binance formula, isolated 50x, mmr 0.006 (illustrative)",
    "liq_price": 59154.929577
   },
   "expected": {
    "warn": true
   },
   "tolerance": {
    "warn": 0
   },
   "note": "at 50x the liquidation (~59,155) comes before a 58,000 stop: a calculator must warn"
  }
 ]
}