Install
$ agentstack add skill-himanshuj16-algo-trading-skills-american-vs-european-style-option-exercise-handling ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
When to Use
Use this skill when a book holds long American-style options and something has to be decided about them today: exercise now, or sell? Early exercise destroys the option's remaining time value, so it is the wrong answer almost always — but "almost always" is not "always", and the exceptions (an ITM call on the last cum-dividend session, a deep ITM put whose extrinsic value has collapsed under carry, any option whose bid has fallen below parity) are the ones that cost real money when missed.
The rule the engine applies is one comparison:
> Exercising realises exactly the intrinsic value — stock worth spot against payment of strike, and nothing more. Selling realises the bid. Exercise if and only if intrinsic value exceeds the bid.
That comparison needs no interest rate, no volatility and no time to expiry, because all three are already priced into the quote the holder can sell into. The same argument from the other side: a holder who genuinely wants the shares can sell the call and buy the stock for spot − bid, which beats the strike paid on exercise exactly when bid > intrinsic.
American vs European distinction: European-style options can only be exercised at expiration — there is no early-exercise decision to make. This skill is strictly for American-style options.
When NOT to Use
- European-style options. SPX, NDX and XEO cannot be exercised before expiration. Verify the exercise style before running anything here. Exercise style and settlement method are independent: OEX (S&P 100) is American-style and cash-settled, while XEO on the same index is European-style — see
physical-vs-cash-settlement-handling. - Short positions. This is the holder's screen. For the writer's assignment-risk view — which deliberately uses a conservative, over-flagging version of the ex-dividend test — use
early-exercise-assignment-risk-management. - As an options pricing model. The engine consumes a quote; it does not produce one.
dividend_capture_testneeds a put price and a rate supplied from outside. - As an exercise scheduler. It knows nothing about your carrying firm's cut-off time, the holiday calendar or the session clock. It tells you what to do, never by when.
- On expiration day itself. Expiring ITM contracts are handled by OCC's exercise-by-exception procedure and by pin risk, a different problem — see
options-pin-risk-management-at-expiry. - Exotic/structured options. Binary, barrier and Asian options have non-standard exercise features that need bespoke models.
Prerequisites
- Python 3.10+ (standard library only; no third-party dependencies).
- The option's bid, not the mid and not the last trade. The alternative to exercising is selling, and a sale realises the bid. At the true early-exercise boundary an American option's fair value sits exactly at parity, so a mid-based comparison systematically misses live exercise decisions, and a last-trade-based one invents them out of stale prints.
- Current underlying price, cum-dividend while the underlying has not yet gone ex.
- Declared dividend per share and a flag for the last cum-dividend session. Under T+1 settlement (US, since 28 May 2024) the ex-date is the record date, so an exercise submitted on the session before the ex-date settles onto the record-date books; an exercise on the ex-date itself is too late.
- Optional, for the exact ex-dividend cross-check: the same-strike same-expiry put price, a risk-free rate, and time to expiry in years.
- Your carrying firm's early-exercise cut-off time for the session. It is a firm-level parameter, not a rule-fixed one.
Workflow
- State construction: build an
OptionStatefrom the option type, spot, strike and bid, plus the dividend fields where one is pending. The frozen dataclass validates at construction — an unrecognised option type is rejected rather than defaulted, and prices must be real, finite and non-negative (Trueis rejected too, so a stray boolean cannot silently become1.00). - Decide on the quote:
EarlyExerciseEvaluator.evaluate(state)returns(should_exercise, reason). Zero intrinsic value short-circuits toFalse. Otherwise the verdict isintrinsic > bid. - Read
Falsecorrectly. It means do not exercise; it does not mean do nothing. When the quote sits exactly at parity there is no time value left to protect, and holding through an ex-date surrenders the dividend in exchange for the smaller ex-dividend time value — the reason string says so explicitly in that case. Route on the reason, not on the boolean alone. - Cross-check only if the quote is suspect: if the market is stale, crossed, one-sided or absent, call
dividend_capture_test(state, same_strike_put_price, risk_free_rate, years_to_expiry). It applies the exact conditionD > p_ex + K(1 − e^{−rτ})(Merton 1973). It rejects puts and states with no pending dividend rather than returning a meaningless verdict. - Treat disagreement as a data-quality finding. Given a fair, executable quote the two routes are algebraically the same test. If they disagree, the call quote is stale or crossed — investigate the quote. That is not a licence to exercise on the model against a live market you could have sold into.
- Check the exercise is operationally possible before submitting. A call exercise needs the cash or margin to pay
strike × 100per contract. A put exercise on stock you do not own creates a short position that needs a locate and carries borrow cost and recall risk. Neither is modelled here; both can make a marginal exercise the wrong trade. - Act before the cut-off. An exercise notice must reach the carrying firm before that firm's cut-off for the session. Firms set their own, and they are typically earlier than any exchange or clearing deadline.
> Full procedure: see references/workflows.md. > Standards and sources: see references/standards.md. > Printable sign-off checklist: see assets/checklist.md.
Common Pitfalls
- Comparing the dividend against the option's quoted time value. This is the classic desk rule, and for a holder it is wrong. The bid is cum-dividend and already prices the coming drop: by put-call parity the cum-dividend time value is
TV_cum = TV_ex − PV(D), so testingD > TV_cumcounts the dividend twice and fires across the whole band0 ≤ TV_cum = intrinsic_value. - True exercise preserved: the same contract quoted at 9.95 (below parity) must return
True, and the reason must name the pending ex-dividend date and the cut-off. - Independent oracle: for spot 110, strike 100, a 2.00 dividend, τ = 90/365, σ = 25%, r = 4%, the Black-Scholes continuation value on the ex-dividend underlying (108) exceeds the 10.00 realised by exercising, so holding is optimal — and the engine, fed that fair value as the bid, must decline to exercise. Shorten τ to 30/365 and the continuation falls below 10.00, the American value pins at parity, and the engine must exercise on a below-parity bid.
- Exact condition:
dividend_capture_testwithK=100,p_ex=0.60,r=5%,τ=15/365must givetime_value_ex_dividend == 0.8052684andis_exercise_optimal=Falseagainst a 0.75 dividend. - Misuse rejection:
dividend_capture_testmust raiseValueErrorfor a put and for a state with no pending dividend;OptionStatemust raiseValueErrorfor a negative, NaN, infinite, boolean or non-numeric price and for an unrecognised option type.
Related Skills
early-exercise-assignment-risk-managementoptions-pin-risk-management-at-expiryphysical-vs-cash-settlement-handlingcorporate-action-event-calendar-integration
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: HimanshuJ16
- Source: HimanshuJ16/Algo-Trading-Skills
- License: Apache-2.0
- Homepage: https://skills.himanshujangir.com
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.