Overview
TheOptionLeg model represents a single position (leg) within an options strategy. Each leg can be a call option, put option, or stock position, and can be either bought or sold.
Legs are combined in the StrategyState model to create complex multi-leg strategies like spreads, condors, straddles, and more.
Model Structure
Type of the position. Must be one of:
"call", "put", or "stock"- call - Call option (right to buy at strike)
- put - Put option (right to sell at strike)
- stock - Underlying stock position
^(call|put|stock)$Whether you are buying or selling this position. Must be one of:
"buy" or "sell"- buy - Long position (you pay premium for options)
- sell - Short position (you receive premium for options)
^(buy|sell)$Strike price of the option (or entry price for stock). Must be greater than 0.For options, this is the exercise price. For stock, this represents the purchase/sale price.Example:
150.00 for a $150 strike callExpiration date of the option in ISO 8601 format (YYYY-MM-DD).For stock positions, this can be set to a far future date since stock doesn’t expire.Example:
"2026-04-17" for April 17, 2026 expirationNumber of contracts (for options) or shares (for stock). Must be greater than 0.Important: For options, 1 contract = 100 shares of the underlying asset.Examples:
1- One option contract (controls 100 shares)5- Five option contracts (controls 500 shares)100- For stock, 100 shares
Premium paid (for buy) or received (for sell) per contract/share. Must be non-negative.For options, this is the option price. For stocks, it can represent dividends or be left at 0.Examples:
3.50- 350 total for 1 contract)0.0- No premium data or stock position
Trading volume of the option contract. Used for liquidity analysis.Higher volume generally indicates better liquidity and tighter bid-ask spreads.
Open interest for the option contract. Indicates the number of outstanding contracts.Higher open interest suggests more active trading and better price discovery.
Example Positions
Long Call Option
- Buying 1 call option contract
- Strike price of $155
- Expires April 17, 2026
- Paid 350 total)
- High liquidity (good volume and open interest)
Short Put Option
- Selling 2 put option contracts
- Strike price of $145
- Expires April 17, 2026
- Received 840 total for 2 contracts)
- Moderate liquidity
Stock Position
- Buying 100 shares of stock
- At $150.50 per share
- Far future expiration (stock doesn’t expire)
- No premium (stock purchase, not option)
Common Strategy Examples
Bull Call Spread
Protective Put
Iron Condor (4 legs)
Field Validation
✅ Must be exactly:
"call", "put", or "stock"❌ Case-sensitive - "Call" or "CALL" will be rejected✅ Must be exactly:
"buy" or "sell"❌ Case-sensitive - "Buy" or "SELL" will be rejected✅ Must be greater than 0❌ Negative or zero values will be rejected
✅ Must be in ISO 8601 format:
YYYY-MM-DD❌ Invalid date formats will be rejectedValid: "2026-04-17"Invalid: "04/17/2026", "2026-4-17"✅ Must be greater than 0❌ Negative or zero quantities will be rejected
✅ Must be non-negative (>= 0)❌ Negative premiums will be rejected
Understanding Contract Multiplier
When calculating position value:- Options: Value = qty × premium × 100
- Stock: Value = qty × strike
Example Calculations:
Long Call:- qty = 1, premium = 3.50
- Cost = 1 × 3.50 × 100 = $350
- qty = 2, premium = 4.20
- Credit = 2 × 4.20 × 100 = $840
- qty = 100, strike = 150.50
- Cost = 100 × 150.50 = $15,050
Related Models
- StrategyState - Complete strategy configuration
- Greeks - Risk metrics calculated from option legs