Short Position Roll Report - Markdown Template
Format the JSON data into a markdown report saved to sandbox/. Use the mode field to determine which format to use.
Filename formats:
- Roll mode:
ib_short_report_{SYMBOL}_{YYYY-MM-DD}_{HHmm}.md - Spread mode:
ib_spread_{SYMBOL}_{YYYY-MM-DD}_{HHmm}.md - New short mode:
ib_new_short_{SYMBOL}_{YYYY-MM-DD}_{HHmm}.md
Common Fields
All modes include:
generated- Timestamp stringsymbol- Ticker symbolunderlying_price- Current stock priceearnings_date- Next earnings date or nullcandidates_by_expiryorroll_candidates- Dict of expiry -> candidate list
Mode: "roll" (Rolling existing short)
Current Short Position Table
| Field | Value |
|---|---|
| Symbol | symbol |
| Position | -{abs(quantity)} Call/Put |
| Strike | $current_position.strike |
| Expiration | Format current_position.expiry (YYYYMMDD) as "Mon DD, YYYY" + days until |
| Underlying Price | $underlying_price |
| OTM % | Calculate: (strike - underlying) / underlying * 100 for calls, inverse for puts |
| Buy to Close | $buy_to_close |
| Total Cost to Close | $buy_to_close * abs(quantity) * 100 |
| Earnings Date | Show if present |
Roll Candidates by Expiration
For each expiry in roll_candidates:
Header: "Mon DD, YYYY (N days)"
| Strike | OTM% | Sell @ | Net | Total (N contracts) | Rating |
|---|
- OTM%:
(strike - underlying) / underlying * 100for calls - Net:
sell_price - buy_to_close. Show as+$X.XX creditor-$X.XX debit - Total:
net * abs(quantity) * 100 - Rating: credit + OTM≥5% = "Excellent"(net>2)/"Good"; credit only = "OK"; small debit = "Fair"; large debit = "Poor"
Recommendations
Rank credit rolls by score: otm_pct * 0.5 + otm_improvement * 2 + min(net, 10) * 0.3 + min(days/60, 3) * 0.2
Show top 5 with: expiry, strike, net credit, OTM%, days to expiration.
Recommended Roll: Best scored candidate with BUY TO CLOSE / SELL TO OPEN order syntax.
Mode: "spread" (Vertical spread against long option)
Current Long Option Table
| Field | Value |
|---|---|
| Symbol | symbol |
| Position | +{quantity} Call/Put |
| Strike | $long_option.strike |
| Expiration | Format expiry + days |
| Avg Cost | $long_option.avg_cost |
| Underlying Price | $underlying_price |
| Earnings Date | Show if present |
Short Candidates by Expiration
For each expiry in candidates_by_expiry:
| Strike | OTM% | Bid | Width | Max Profit | Max Loss | Score |
|---|
- Width:
abs(candidate.strike - long_option.strike) - Max Profit:
bid * 100 - Max Loss:
max(avg_cost - bid, 0) * 100
Recommendations
Top 5 by score. Show premium, total for N contracts, OTM%, spread width, days.
Recommended Position: SELL TO OPEN order syntax. Describe the spread type (call/put debit/credit spread).
Mode: "new_short" (Covered call/protective put)
Current Long Stock Table
| Field | Value |
|---|---|
| Symbol | symbol |
| Shares | long_position.shares |
| Avg Cost | $long_position.avg_cost |
| Current Price | $underlying_price |
| P&L | Calculate from avg_cost and current price |
| Contracts Available | shares // 100 |
| Earnings Date | Show if present |
Covered Call/Protective Put Candidates by Expiration
For each expiry in candidates_by_expiry:
| Strike | OTM% | Bid | Premium/Contract | Ann. Return | Score |
|---|
- Premium/Contract:
bid * 100 - Annual Return:
annual_returnfrom candidate data
Recommendations
Top 5 by score. Show premium per share, total, OTM%, annualized return, days.
Recommended Position: SELL TO OPEN order with best candidate.
Formatting Rules
- Currency:
$X.XXfor prices,$X,XXXfor totals - Percentages: 1 decimal, show sign for changes
- Expiry dates: "Mon DD, YYYY" format
- Bold key values in recommendations
- Include horizontal rules between sections
- Footer:
*Report generated by Trading Skills on YYYY-MM-DD HH:MM*