PremiumGuardHQ
Methodology v2026.05
Methodology

How the math gets to your screen.

This is the PremiumGuardHQ calculation reference. Every formula the platform runs on your broker data is documented here, with the source-of-truth in production code. No black box, no proprietary fudge factors. If a number is on your dashboard, it came from one of these formulas.

Last updated 2026-05 7 sections decimal.js precision
The Three Numbers

Premium P/L. Equity P/L. Net P/L.

These are the only three numbers a wheel trader needs to trust. Every cycle PremiumGuard detects produces exactly these three values, computed from your raw trade data.

01

Premium P/L

Formula totalPremiumReceived − totalPremiumCosts

Sum of credits from sold options, minus debits from bought options. Includes both opening and closing legs.

Why it matters The unearned-income meter. Tells you what the market paid you to take risk, before any assignment math.

cycle-detector.ts
02

Equity P/L

Formula equityProceeds − equityCost

Sale proceeds of shares sold minus the cost basis of shares acquired (via buy, put assignment, or call exercise).

Why it matters What the underlying did to your book. Captures whether assignments hurt you or whether shares appreciated through the cycle.

cycle-detector.ts
03

Net P/L

Formula premiumPl + equityPl

The cycle’s real outcome. Combines what you earned from options with what the underlying cost or gave you.

Why it matters The single number a wheel trader can trust. Brokers obscure this by adjusting cost basis for premiums received and wash sales. PremiumGuard never does.

cycle-detector.ts:44

Each value is computed in decimal.js arbitrary-precision arithmetic. No floating-point drift, no rounding errors at scale.

The cycle

The cycle is the unit of measurement.

PremiumGuard doesn’t track individual trades. It tracks cycles: every option sale, every assignment, every closing leg gets stitched into the wheel or standalone position it belongs to. P/L lives on the cycle, never on the trade.

Primary case wheel

Wheel

A multi-leg cycle that holds shares plus the option activity tied to them. Created when a put is assigned or shares are bought into an open option position. Closes when shares fall below 100 (the call-writing floor).

Common zero_duration

Zero-duration

A cycle that opens and closes without shares ever changing hands. The classic case: sell a put, it expires worthless, premium booked. No equity leg, no assignment.

Edge case standalone

Standalone

A bought-option position not tied to an existing wheel. Long calls and long puts held outright. Tracked separately so hedges and speculation never pollute wheel P/L.

Trade classification

14 trade events. Every broker row classified into one.

Each row from your broker feed is mapped to exactly one of these events before the cycle engine processes it. Everything else (transfers, fees, dividends, splits) is filtered out as non-trading account activity.

Equity
  • equity_buy
  • equity_sell
Sell to open
  • sell_call_to_open
  • sell_put_to_open
Buy to open
  • buy_call_to_open
  • buy_put_to_open
Closing
  • buy_to_close
  • sell_to_close
Settlement
  • call_assigned
  • put_assigned
  • call_expired
  • put_expired
  • call_exercised
  • put_exercised
Action priority

Same-day trades, ordered before processing.

When multiple trades share a date (the assignment-then-sell scenario, the buy-to-cover-then-sell-to-open roll), priority decides which the engine sees first. Assignments always process before sells so the wheel knows about the new shares before they’re traded.

  1. assignment First — new shares must register before sells
  2. exercise Option exercised into shares
  3. buy Equity purchase
  4. buy_to_open New long option position
  5. sell_to_open New short option position
  6. sell Equity sale
  7. buy_to_close Close a short option
  8. sell_to_close Close a long option
  9. expiration Last — settles after all trades
Capital at Risk

The most you could lose at any point in the cycle.

Not your current exposure. Not your average exposure. The peak dollar amount the platform observed at any moment between the cycle’s open and close. PremiumGuard walks each cycle’s trades chronologically and tracks the running notional, recording the maximum.

Algorithm

For each trade in the cycle, ordered by date + action priority, apply the delta. Track the running total. Clamp at zero (CAR is never negative). Record the peak.

Event Delta Note
sell_put_to_open + strike × qty × 100 Full notional obligation to buy if assigned.
sell_call_to_open + strike × uncovered × 100 Covered contracts add nothing. Only naked / uncovered exposure counts.
put_assigned − strike × qty × 100 Obligation fulfilled; shares received.
call_assigned − strike × qty × 100 Shares called away.
buy + total cash deployed Equity bought outright.
sell − proceeds Equity sold; clamps at zero, never negative.
Worked example

AAPL wheel · May 2026

Sell a $180 put. Get assigned. Cover with a $185 call. Get called away. The peak observed exposure becomes the cycle’s maxCapitalAtRisk.

  1. Day 1 2026-05-01
    sell_put_to_open 1× AAPL put, strike $180
    Δ + 180 × 1 × 100 = +$18,000
    Running CAR $18,000 Peak
  2. Day 14 2026-05-15
    put_assigned Put exercised, 100 shares received
    Δ − 180 × 1 × 100 = −$18,000
    Running CAR $0
  3. Day 14 2026-05-15
    sell_call_to_open 1× covered call, strike $185
    Δ + $0 (covered — no notional)
    Running CAR $0
  4. Day 30 2026-05-31
    call_assigned Shares called away at $185
    Δ − 185 × 1 × 100 (clamped at 0)
    Running CAR $0
Cycle maxCapitalAtRisk $18,000
Safe Withdrawal Engine

Three scenarios. One safe withdrawal.

The unique math at the heart of the platform. PremiumGuard takes your closed-cycle profits, nets previous withdrawals, and reconciles against an equity gap. The result is the largest dollar amount you can withdraw without eroding the base capital that’s producing your income.

Gross Available Closed-cycle profits − Previous withdrawals
Equity Gap Target equity − Account value
A Above target

Account value is at or above target. No shortfall to fill, so the full profit is yours.

Setup
Target equity
$50,000
Account value
$58,000
Closed profits
$15,000
Previous withdrawals
$0
What the engine sees
Equity gap
−$8,000 above target
Gross available
$15,000

No throttle. Take the full gross.

Safe to withdraw $15,000
C Below target

Below target, and profits do not cover the gap. Throttle the withdrawal.

Setup
Target equity
$50,000
Account value
$30,000
Closed profits
$15,000
Previous withdrawals
$0
What the engine sees
Equity gap
$20,000 below target
Gross available
$15,000
Withdraw percent
50%

Profits below gap. Throttle to 50%: $15,000 × 0.50.

Safe to withdraw $7,500
Cost basis

Three ways shares enter a cycle. One source of truth.

Brokerages reshape cost basis for wash sales and premiums received, which is why the number on your broker screen often disagrees with what your wheel actually did. PremiumGuard ignores those adjustments and applies one of three deterministic formulas, based on how the shares were acquired.

01 weightedAvgCostBasis

Weighted average — multiple buys

When you add to an existing share position, cost basis re-averages across all shares held. PremiumGuard computes the weighted mean using existing shares + new shares.

Formula (existingShares × existingAvg + newShares × newPrice) ÷ totalShares
Worked

100 sh @ $30 avg. Buy 200 more @ $25.

(100 × 30) + (200 × 25) = 3,000 + 5,000 = 8,000 8,000 ÷ 300 sh = $26.67 / share
Cost basis $26.67
02 assignmentCostBasis

Put assignment — shares received

When a cash-secured put is assigned, the strike price is your cost. The premium you collected stays in Premium P/L — it does not lower the cost basis.

Formula cost = strikePrice
Worked

Sold $50 put for $200 premium. Assigned.

cost basis = $50 / share Premium of $200 stays in totalPremiumReceived
Cost basis $50.00
03 exerciseCostBasis

Call exercise — exercising a long call

When you exercise a bought call into shares, your cost per share is the strike plus the premium you paid (amortized across the share count).

Formula cost = strike + (premiumPaidTotal ÷ shareCount)
Worked

Bought call $15 strike for $200 total premium. Exercised.

$15 + ($200 ÷ 100 sh) $15 + $2.00 = $17.00 / share
Cost basis $17.00
Precision & sources

Reproducible math. Auditable inputs.

Every number on your dashboard traces back to a formula on this page and a row in your broker history. If a calculation surprises you, the source is recoverable.

Precision
decimal.js arithmetic
No floating-point drift. No rounding errors at scale.
Determinism
Same trades, same numbers
Action-priority ordering means a re-sync produces identical cycles.
Source of truth
Your broker, read-only
OAuth feeds (Schwab) or Flex Web Service token (IBKR). No writes.
Edge cases
Explicit, not silent
Missing equity returns null. Negative withdrawal clamps to zero.
See the math on your own book
Connect a broker. PremiumGuard backfills your cycles and runs every formula on this page against your real trade history.
Start free trial

Methodology questions? Email support@premiumguardhq.com. Engineering answers, not marketing.