An unofficial Chrome extension that adds margin, options and cash tools to Fidelity's web pages. When you're entering a trade it shows whether the trade will result in a margin debit or credit and how much room you have before incurring margin interest; it also helps with option chains and rolls, and finds the best after-tax money-market fund for your cash. Not affiliated with or endorsed by Fidelity Investments — see the disclaimer below.
- Margin panel on the trade ticket — projected margin credit/debit, exact delta, cash withdrawable without margin interest, requirement, house surplus/call and premium, for equities and options (single and multi-leg), on every page that shows a ticket.
- Option chain hints — hover a bid/ask to see the margin outcome (green / amber / red) without opening a ticket; yield badges on sell cells.
- Roll assistant — finds premium-neutral and best-credit rolls for options you hold (chain page and Trader+ Web), also reachable from Fidelity's own Roll button on the positions page.
- Ticket dropdown annotations — volume, open interest and yield stats inside the strike and expiration dropdowns (including the Roll ticket).
- Money-market optimizer — best after-tax money-market fund for your balance, a fill-the-ticket helper, and a daily alert.
- After-tax yields — optional federal + state tax applied to option yields and money-market yields.
- Resilient to Fidelity outages — retries, last-good data and plain-language messages instead of raw errors.
Fidelity's trade ticket shows "available to trade" but doesn't clearly show:
- Whether a specific trade will push your account into margin debit (and trigger interest charges)
- How much cushion you have before crossing into margin debit territory
- The projected margin credit/debit balance after the trade
You have to manually navigate to the Margin Calculator page, re-enter the trade details, and interpret the results. This extension automates that.
- Detects trade context — monitors Fidelity trade ticket pages and the dedicated order page for trade input
- Extracts trade details — reads the symbol, action (buy/sell), quantity, price, and order type from the DOM
- Calls Margin Calculator API — uses the same endpoints (
/ftgw/digital/api-margin-calculator/api/current-status/v1and.../trade-calculator/v1) that Fidelity's own Margin Calculator page uses - Displays results inline — injects a panel next to the Max Gain / Max Loss / Break Even row showing:
- Projected
marginCreditDebitafter trade - Delta from current margin credit/debit (exact, vs. the account's current balance)
- Margin requirement, house surplus/call, and order premium (derived from data already fetched)
- Whether the trade causes margin debit (interest-bearing)
- Wiggle room: how much more you can trade before hitting margin debit
- Cash available to withdraw without using margin after trade settles
- Projected
The request reuses the browser's existing session cookies (same-origin), so no separate authentication is needed.
On the option chain page (/ftgw/digital/exp-options-research/option-chain), hover a bid or ask and the cell is outlined by what the trade would do — without opening an order ticket:
- Green — fine: no margin debit and at least your minimum withdrawable cash remains
- Amber — would leave less withdrawable cash than your Min withdrawable setting
- Red — would put you into margin debit (negative cash balance) or trigger a house call
The hovered cell is calculated exactly (one trade-calculator/v1 call). Colour is always the outcome (a border, never a fill); the border style is the confidence: solid = exact, dashed = estimated from the strikes already calculated, dotted = estimate close to your limit (hover it to verify). The tooltip shows the projected cash withdrawable, margin credit/debit, house surplus/call and premium. Premium and margin credit are exact for every strike (they follow directly from the quoted price); the house balance / withdrawable cash estimate interpolates the margin requirement between calculated strikes. Settings (popup): Option chain hints, Min withdrawable, Chain quantity.
Yield badges. Every sell cell shows its annualized yield if all extrinsic (time) value is captured — extrinsic ÷ capital × 365 ÷ days (capital = strike for puts, underlying price for calls) — green when it beats your Hurdle yield setting (e.g. margin rate = EFFR + spread; default 4.88%). The tooltip gives the period return, the annualized return and a profit probability (lognormal model on the breakeven with the option's implied volatility, falling back to 1 − |delta|).
Roll assistant. On the chain page and Trader+ Web, if you hold options on the symbol, a panel lets you pick one and finds rolls from live quotes: the neutral frontier per expiry (how far you can roll down-and-out — up-and-out for calls — while the roll still nets ≥ your target, default $0), plus the best credits out / up / down, each with return / annualized return / profit probability and an exact two-leg margin Check. Chain cells show the roll's net credit and yield while a source is selected.
Trade ticket. The strike and expiration dropdowns show each option's volume and open interest (with a proportional bar) and, for sell-to-open, the yield stats. Expiration volumes are loaded lazily — one chain request per option, fetched as it scrolls into view — so long expiry lists stay cheap. This also works in the Roll ticket (opened from Fidelity's Roll button on the positions page), whose call/put type is read from the "Put Expiration" label. When the ticket holds a roll, the margin panel names the premium-neutral strike for the chosen expiry.
Market-priced orders. The Roll button pre-fills a market closing order (price 0), which the margin calculator rejects (1030 HYPOTHETICAL TRADE PRICE IS 0). The extension prices each such leg first — a position you hold uses its current mark, and the roll's new leg uses the option chain's bid/ask midpoint — and if Fidelity still returns no balance it shows Fidelity's own message instead of a generic "no data" error.
Net-priced multi-leg orders. A multi-leg ticket with a Net Credit / Net Debit order type has one Net Amount for the whole order, not a price per leg. The extension prices each leg from the market and shifts the opening leg so the legs net to exactly your Net Amount, so the margin credit changes by the true net premium (a $1.35 net credit moves it by +$135) and the panel's Premium Received shows that net premium.
On the positions page the optimizer is reachable from several places (all open the same panel):
- a compact green OPT tag (styled after Fidelity's own "AR" auto-roll badge) next to each money-market position and the Cash (core) row;
- an Optimize cash button beside Trade / Change core position in a money-market position's expanded detail drawer;
- an always-visible Optimize cash button at the bottom-left of the page (the grid is virtualized and the core fund often has no row on screen).
It reads Fidelity's current money-market list (7-day yield, category, minimum investment/balance) from the public fund screener, computes after-tax yields for your tax situation, and suggests the best fund your balance actually qualifies for — funds whose minimums you can't meet are listed with the reason. A move is only suggested when it beats the current balance by at least the Min yield gap setting (default 0.10 points).
- Tax rates come from live sources (IRS brackets by filing status and income; the state's flat rate) cached for 30 days, with overrides in the popup. Defaults: single, $150k, NC. A failed lookup is retried after 6 hours rather than cached.
- Fidelity counts all Fidelity money-market funds in "Cash Available to Withdraw", so exchanging between them doesn't reduce it (collected funds only). The margin calculator rejects money-market funds as orders, so exchanges can't be what-if tested.
- Fill ticket opens Fidelity's mutual-fund ticket and enters the fields for one move — an Exchange for non-core funds, or a Buy of the target paid from core cash when the source is the core (sweep) fund, which Fidelity doesn't allow to be exchanged. It starts from a fresh ticket each time, handles one fill at a time, and never clicks Preview Order or submits; you review and submit.
- A once-a-day background check recomputes the best fund from your last-seen balances and sends a notification only when a new leader has held the minimum gap for 3 consecutive checks (once per leader). Days where Fidelity was down (stale data) don't count toward the streak.
- The same Option yields after tax setting shows option yields net of federal + state tax (short-option premium is short-term income, even on LEAPS) so they compare with a margin rate elsewhere.
Every Fidelity call (margin, positions, option chain/quotes/expirations, and the background fund-screener / IRS / Tax Foundation fetches) retries 5xx / 408 / 429 / network failures with exponential backoff, honouring Retry-After. When Fidelity keeps failing:
- chain data is served from a short-lived last-good cache (up to 30 min) and flagged as stale, with a cooldown so hovering doesn't hammer a failing endpoint;
- the fund list is persisted (2 days) and shown as stale;
- panels show a plain-language message (never the raw response body) with a Try again control, and the roll panel keeps its previous results.
Fidelity's "Temporarily Unavailable" HTML page (served with HTTP 200) is treated as a retryable error. A Debug link in the panel shows the extension's log, including Fidelity's error codes.
Open the extension popup. Defaults in parentheses.
| Setting | Effect |
|---|---|
| Enabled (on) / Warning threshold ($500) / Debounce | Margin panel on the trade ticket |
| Option chain hints (on) / Min withdrawable ($0) / Chain quantity (1) | Chain hover outlines and tooltips |
| Roll assistant (on) | Roll panel and roll hints |
| Hurdle yield (4.88 %/yr) | Yield badges turn green above this (e.g. your margin rate) |
| Option yields after tax (off) | Show option yields net of federal + state tax |
| Money-market optimizer (on) / Min yield gap (0.10) | OPT tags, buttons, daily alert |
| State / Filing status / Taxable income / Federal & state rate overrides | Tax situation (default NC, single, $150k) |
| Page | URL Pattern | Detection |
|---|---|---|
| Trade Ticket (popup) | digital.fidelity.com/ftgw/digital/trade-equity/* |
#trade-container-shell visible |
| Trade Ticket (popup) | digital.fidelity.com/ftgw/digital/options-research/* |
#trade-container-shell visible |
| Trade Ticket (popup) | digital.fidelity.com/ftgw/digital/portfolio/summary* |
#trade-container-shell visible |
| Options Trade (full page) | digital.fidelity.com/ftgw/digital/trade-options* |
body.option-trade-ticket |
| Margin Calculator | digital.fidelity.com/ftgw/digital/margin-calculator/* |
Dedicated page |
The floating trade ticket popup (#trade-container-shell) can appear on many Fidelity pages — portfolio summary, option chain, research, etc. The content script should match broadly on digital.fidelity.com/ftgw/digital/* rather than specific paths.
Endpoint:
POST https://digital.fidelity.com/ftgw/digital/api-margin-calculator/api/trade-calculator/v1
Key Request Fields:
accountNum— Fidelity account numbertradeOrders.orders[]— hypothetical trade(s) to simulateorderSymbol— e.g.-AVGO260522P370(option) orAAPL(equity)orderAction—BO(buy to open),SO(sell to open),BC(buy to close),SC(sell to close),B(buy),S(sell)orderQty— number of shares/contractsprice— limit priceorderType—O(option),E(equity)
priceList[]— current positions with prices for recalculation
Key Response Fields:
balance.marginCreditDebit— positive = credit (no margin loan), negative = debit (interest charged). Reflects net cash owed to/from you after trade execution in a margin account.balance.coreCash— cash in core position (e.g. FDRXX/SPAXX money market)balance.marginBuyingPower— remaining margin buying powerbalance.nonMarginBuyingPower— buying power without using marginbalance.avlToTradeWithoutMarginImpact— max dollar amount you can trade (or withdraw) without creating a margin debit. Per Fidelity's glossary, this is the cash-only buying power that avoids margin interest.balance.totalAccountValue— total account valuebalance.marginEquityPct— margin equity percentage
Cash available to withdraw without margin = projected avlToTradeWithoutMarginImpact. Per Fidelity's definition, this is the maximum dollar amount available without creating a margin debit. Note: marginCreditDebit is a separate concept — it shows whether you currently owe money (debit) or have a credit balance after trade execution, but it is NOT the same as how much you can safely withdraw.
The extension works on three page contexts. Options form field IDs are shared across all:
Floating popup (portfolio summary, option chain, research, etc.):
- Detected by
#trade-container-shell[style*="display: block"] - Active trade type:
#float_trade_O[style*="display: block"](O=Options,SE=Stocks/ETFs) - Container classes:
ott-float-container pad-view - The equity ticket (
#float_trade_SE) uses different selectors (eq-ticket__*) — see below
Dedicated trade page (/ftgw/digital/trade-options):
- Detected by
body.option-trade-ticket - No
#trade-container-shellor#float_trade_*wrappers - Container classes:
trade-destination phone-view
Options form field selectors (shared across all contexts):
| Field | Selector | Notes |
|---|---|---|
| Account | ott-account-dropdown .binding-val .accountNum |
e.g. (X12345678) — strip parens |
| Symbol | #symbol_search |
Input value, e.g. AVGO |
| Action | #action_dropdown-0 .binding-val |
Buy To Open, Sell To Open, Buy To Close, Sell To Close |
| Quantity | #quantity-0 |
Input value (number of contracts) |
| Call/Put | #call-put-0-call, #call-put-0-put |
Radio buttons — check aria-checked="true" |
| Expiration | #exp_dropdown-0 .binding-val |
e.g. May 22, 2026 |
| Strike | #strike_dropdown-0 .binding-val |
e.g. 370.00 |
| Limit Price | #dest-limitPrice |
Input value |
| Order Type | #ordertype-dropdown .binding-val |
Limit, Market, etc. |
| Trade Type | #tradeType_dropdown .binding-val |
Margin or Cash |
Injection target (next to Max Gain / Max Loss / Break Even):
ott-max-gain-loss .max-gain-loss-container(#mxregin) — row with Max Gain, Max Loss, Break Even columns- Inject additional columns or a new row after this container
- Parent element:
ott-order-details-row .optional-items
Other reference sections:
ott-balances-display .balances— Margin/Non-Margin Buying Power (top of ticket)ott-next-steps .estimated-info— Estimated Order Value and fees (bottom of ticket)
Equity ticket selectors (stocks/ETFs via #float_trade_SE):
- Symbol:
#eq-ticket-dest-symbol - Action/Quantity/Order Type:
eq-ticket__more-trade-selections__*classes - Account:
#eq-ticket-account-label - Uses
eq-ticket__*class prefixes instead ofott-*
Multi-leg trades (options): Leg rows use indexed IDs (#action_dropdown-0, #action_dropdown-1, etc.). The "Add Leg" button is #dest-add-leg.
Option symbol construction: The API expects symbols like -AVGO260522P370 built from:
-prefix (option indicator)- Symbol (
AVGO) - Date (
260522= 2026-05-22, format YYMMDD) - Type (
P= Put,C= Call) - Strike (
370)
fidelity-margin-calculator-auto/
├── manifest.json # MV3 manifest (CSP connect-src limited to 3 public hosts)
├── background.js # Service worker: fund screener / tax fetches with retry, daily alarm, notifications
├── rules.json # declarativeNetRequest: Referer header for the margin calculator API
├── content/
│ ├── detector.js # Detects the trade ticket and extracts trade details
│ ├── injector.js # Margin panel (incl. premium and roll notes)
│ ├── main.js # Orchestrates ticket → positions → trade-calculator → panel
│ ├── chain-core.js # Shared chain/Trader+ page plumbing
│ ├── chain.js # Option chain hover hints and yield badges
│ ├── roll.js # Roll assistant panel
│ ├── ticket-assist.js # Volume/OI/yield annotations in ticket dropdowns
│ ├── mmf.js # Money-market optimizer UI and ticket fill helper
│ └── styles.css
├── lib/
│ ├── constants.js # Settings defaults, API paths, error types
│ ├── positions.js # current-status → priceList + current balance
│ ├── margin-api.js # trade-calculator client (mark-price substitution, Fidelity messages)
│ ├── margin-calc.js # Interprets the response, computes impact
│ ├── chain-api.js # Option expirations / chain / quotes with retry + stale cache
│ ├── chain-estimate.js # Margin-requirement interpolation across strikes
│ ├── roll-model.js # Roll pricing, neutral frontier, return / probability stats
│ ├── mmf-model.js # After-tax money-market ranking and plan
│ ├── tax-rates.js, tax-context.js # Live IRS / state rates and the after-tax helper
│ ├── fetch-utils.js, retry.js, rate-limiter.js, api-error.js, debug.js
├── popup/ # Extension popup (settings, status)
├── .claude/ # Project hooks (account-number guard)
├── icons/ # icon.svg is the source; icon-{16,32,48,128}.png are generated by generate.py
├── curl-resp.sample, sample-curl-from-browser.txt.sample, *.html.sample # Reference captures
# Load unpacked extension in Chrome:
# 1. Navigate to chrome://extensions
# 2. Enable Developer mode
# 3. Click "Load unpacked" and select this directoryThere is no build step. After editing, click the reload button on the extension card, then refresh the Fidelity tab.
Never commit account numbers. This repository is public. A PreToolUse hook (.claude/hooks/block-account-numbers.py, configured in .claude/settings.json) blocks Claude Code edits, GitHub pushes and git commit / git push that add anything shaped like a Fidelity account number; use a placeholder such as ZXXXXXXXX. Check it with python3 .claude/hooks/block-account-numbers.py --self-test.
- Content scripts only run on
digital.fidelity.com; all account requests go to Fidelity's own API. - The background worker also contacts three public, read-only sources —
fundresearch.fidelity.com(money-market yields),www.irs.govandtaxfoundation.org(tax brackets) — and the manifest CSP allows only those hosts. No account numbers, balances or positions are ever sent to them. - No credentials stored — uses existing browser session cookies. Settings and cached rates live in
chrome.storage. - No external servers or analytics.
- The extension never places, previews or submits orders. The money-market Fill ticket only enters form fields.
This extension is not affiliated with, endorsed by, or associated with Fidelity Investments in any way. Use at your own risk. The author is not responsible for any account restrictions, losses, or other consequences that may result from using this extension.
Fidelity's Terms of Use prohibit "Third-Party Access Tools" providing "high-speed, automated, or repeated access." The author believes this extension falls outside the spirit and intended scope of that prohibition for the following reasons:
-
No credential sharing or external access. Fidelity's enforcement actions have consistently targeted third-party data aggregators and screen scraping services that require users to share login credentials and access accounts from external servers. This extension does neither — it runs entirely within the user's own authenticated browser session on
digital.fidelity.com. -
No data exfiltration. All API requests go to Fidelity's own servers, and all responses stay within the browser. No data is sent to external servers, analytics services, or third parties.
-
User-initiated, human-rate access. The extension only makes API calls when the user actively opens a trade ticket and enters parameters. With debouncing, caching and a client-side rate limiter, it generates traffic in the range of a user working in Fidelity's own Margin Calculator page. Per trade setup that is one positions/balance call (cached for 5 minutes) plus one margin calculation, and — only if the optional chain features are enabled — a few read-only quote/chain requests (cached ~45 seconds). Chain hovers, roll checks and dropdown annotations are each user-initiated and capped (for example expiration volumes load only for the options you scroll to); there is no background polling beyond a 2-second local symbol check.
-
Same information, different location. The extension surfaces margin impact data that is already available to the user on Fidelity's own Margin Calculator page. It does not expose new data or capabilities — it makes existing information more convenient to access in context.
-
Read-only operation. The extension never places trades, modifies account settings, or takes any action on behalf of the user. It only retrieves and displays margin calculation results; the optional money-market helper pre-fills Fidelity's ticket fields but never submits.
-
Precedent. Multiple Chrome extensions that interact with Fidelity pages exist on the Chrome Web Store (including extensions that automate trade execution across accounts), without reported enforcement action against users.
-
Legal landscape. The Supreme Court's Van Buren v. United States (2021) ruling narrowed the Computer Fraud and Abuse Act, holding that TOS violations alone do not constitute "unauthorized access." The DOJ's 2022 revised policy further clarified that prosecution should not be brought solely for TOS violations.
- Fidelity's TOS grants them the right to "terminate or suspend your access to the Fidelity Websites for any violation of the provisions of these Terms or for any reason whatsoever at its sole discretion and without prior notice."
- The margin calculator REST API is an internal, undocumented endpoint — Fidelity could change or restrict it at any time.
- This analysis is not legal advice. Consult a licensed attorney for a definitive assessment.