STRASMORE/EXPLORE 2,173 QUERIES 22Y EQUITIES · 12Y OPTIONS

2,173 answered market questions

every one with its exact SQL, its result and the date it was computed · free, no signup

What Is a Special Memorandum Account (SMA)?
One margin account through four events: equity, requirement, and SMAtable · 2026-08-19 · 5×8
One margin account through four events: equity, requirement, and SMA

One margin account through four events: equity, requirement, and SMA

most recentas of table 5×8read in context →
One margin account through four events: equity, requirement, and SMA — 5 rows by 8 columns, computed from US exchange, SIP and OPRA data.
eventmarket_valuedebit_balanceequityreg_t_requirementmargin_excesssmabuying_power
Start40000200002000020000000
Deposit 5k cash400001500025000200005000500010000
Stock gains 8k480001500033000240009000900018000
Stock gives 8k back400001500025000200005000900018000
Buy 12k on margin52000270002500026000-100030006000
the exact SQL behind every number
WITH ledger AS (
    SELECT 1 AS step, 'Start' AS event, 40000 AS market_value, 20000 AS debit_balance, 0 AS sma_entry
    UNION ALL
    SELECT 2, 'Deposit 5k cash', 40000, 15000, 5000
    UNION ALL
    SELECT 3, 'Stock gains 8k', 48000, 15000, 4000
    UNION ALL
    SELECT 4, 'Stock gives 8k back', 40000, 15000, 0
    UNION ALL
    SELECT 5, 'Buy 12k on margin', 52000, 27000, -6000
)
SELECT
    event,
    market_value,
    debit_balance,
    market_value - debit_balance                        AS equity,
    0.50 * market_value                                 AS reg_t_requirement,
    market_value - debit_balance - 0.50 * market_value  AS margin_excess,
    SUM(sma_entry) OVER (ORDER BY step)                 AS sma,
    2 * SUM(sma_entry) OVER (ORDER BY step)             AS buying_power
FROM ledger
ORDER BY step
$