OptionStrategy

Models & Types · AiDotNet.Finance.Options

A named option strategy: a set of OptionLegs (plus an optional StockLeg), with the broker approval level it requires, whether its risk is defined, and its expiry payoff profile (max loss, max gain, breakevens) computed by sampling the payoff over a spot grid — robust for ANY leg combination, not just the textbook ones. Net Greeks come from BlackScholes.

The Class classifier is the gate that lets the platform enforce a broker’s approval tier. Short calls not covered by stock (100 shares per contract) or by long calls make the strategy NakedEquity (or NakedIndex on an index). Short puts not covered by long puts are treated as cash-secured, CoveredOrSecured, never as naked. A vertical (short hedged by a long) is DefinedRiskSpread, long-only is LongPremium, and covered-by-stock is CoveredOrSecured. A BrokerOptionsProfile maps each class to the broker’s approval level; a class its map omits requires the highest level, so an incomplete map refuses rather than permits.

Constructors

Constructor Summary
OptionStrategy(string name, IReadOnlyList<OptionLeg> legs, StockLeg stock, bool isIndexUnderlying) Creates a strategy from its legs.

Properties

Property Summary
IReadOnlyList<OptionLeg> Legs { get; } The option legs of the strategy.
OptionStrategyClass Class { get; } The broker-independent risk archetype (mapped to a broker level via BrokerOptionsProfile).
StockLeg Stock { get; } The stock leg of a covered strategy, or null when there is none.
bool IsDefinedRisk { get; } True when the worst-case loss is bounded (no naked/uncovered short exposure).
bool IsIndexUnderlying { get; } True when the underlying is a (cash-settled) index — naked index options are the highest broker tier, distinct from naked equity options.
string Name { get; } Display name of the strategy (for example “Iron condor”).

Methods

Method Summary
OptionStrategy BearPutSpread(double longStrike, double shortStrike, double expiryYears, int contracts) Level 3: bear put (debit) spread — long higher-strike put, short lower-strike put.
OptionStrategy BullCallSpread(double longStrike, double shortStrike, double expiryYears, int contracts) Level 3: bull call (debit) spread — long lower-strike call, short higher-strike call.
OptionStrategy CashSecuredPut(double putStrike, double expiryYears, int contracts) Level 1: short put fully cash-secured (willing to buy the stock at the strike).
OptionStrategy CoveredCall(double callStrike, double expiryYears, int contracts) Level 1: long 100 shares + short 1 call (income on owned stock).
OptionStrategy IronCondor(double longPut, double shortPut, double shortCall, double longCall, double expiryYears, int contracts) Level 3: iron condor — short put spread + short call spread (defined-risk, short volatility).
OptionStrategy LongCall(double strike, double expiryYears, int contracts) Level 2: long call (defined risk = premium).
OptionStrategy LongPut(double strike, double expiryYears, int contracts) Level 2: long put.
OptionStrategy LongStraddle(double strike, double expiryYears, int contracts) Level 2: long straddle (long call + long put at the same strike) — long volatility.
OptionStrategy NakedCall(double strike, double expiryYears, int contracts, bool isIndex) Naked short call (uncovered, large risk) — modeled so the gate can REJECT it (NakedEquity, or NakedIndex when isIndex).
OptionStrategy ProtectivePut(double putStrike, double expiryYears, int contracts) Level 1: long 100 shares + long 1 put (downside protection).
ValueTuple<double, double, IReadOnlyList<double>> PayoffProfile(double netPremium, int gridPoints, double gridMaxMultiple) Expiry payoff profile sampled over a spot grid spanning [0, gridMax×maxStrike].
double PayoffAtExpiry(double spot) Per-share intrinsic payoff of all legs (+ stock) at a given expiry spot, excluding premium.