agentsclimarketplace

Options trading

Skill marketcalls/openalgo-claude-plugin/plugins/openalgo-python/skills/options-trading

Options trading with OpenAlgo - single leg orders, multi-leg strategies (Iron Condor, Straddle, Strangle, Spreads), options chain analysis, and Greeks calculationFrom its SKILL.md

Install
npx -y skills add marketcalls/openalgo-claude-plugin --skill options-trading

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

3 things to look at

  • reads credentialsReads from 1 credential source: `api_key`.
  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
  • runs commandsInstructs the agent to run 3 commands, including `python scripts/options_order.py --underlying NIFTY --expiry 30JAN25 --offset ATM --option-type CE --action BUY --quantity 75` and 2 more.

SKILL.md

11.8 KB, ~3.7k tokens by cl100k_base, as published. Nobody here has run it

OpenAlgo Options Trading

Execute options trading strategies using OpenAlgo's unified Python SDK. Supports index options (NIFTY, BANKNIFTY, FINNIFTY), stock options, and complex multi-leg strategies.

Environment Setup

from openalgo import api

client = api(
    api_key='your_api_key_here',
    host='http://127.0.0.1:5000'
)

Quick Start Scripts

Single Leg Options Order

python scripts/options_order.py --underlying NIFTY --expiry 30JAN25 --offset ATM --option-type CE --action BUY --quantity 75

Iron Condor Strategy

python scripts/iron_condor.py --underlying NIFTY --expiry 30JAN25 --quantity 75

Straddle Strategy

python scripts/straddle.py --underlying BANKNIFTY --expiry 30JAN25 --action BUY --quantity 30

Options Symbol Format

OpenAlgo uses standardized symbol formats:

TypeFormatExample
Index Options[INDEX][DDMMMYY][STRIKE][CE/PE]NIFTY30JAN2526000CE
Stock Options[SYMBOL][DDMMMYY][STRIKE][CE/PE]RELIANCE30JAN251400CE
Index Futures[INDEX][DDMMMYY]FUTNIFTY30JAN25FUT

Offset System

OpenAlgo uses an intuitive offset system to select strikes relative to ATM:

OffsetMeaningExample (NIFTY ATM=26000)
ATMAt The Money26000
ITM11 strike In The MoneyCE: 25950, PE: 26050
ITM22 strikes In The MoneyCE: 25900, PE: 26100
OTM11 strike Out of The MoneyCE: 26050, PE: 25950
OTM22 strikes Out of The MoneyCE: 26100, PE: 25900
OTM55 strikes Out of The MoneyCE: 26250, PE: 25750

Core API Methods

1. Single Leg Options Order

Place ATM, ITM, or OTM options orders:

# ATM Call Option
response = client.optionsorder(
    strategy="OptionsBot",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    offset="ATM",
    option_type="CE",
    action="BUY",
    quantity=75,
    pricetype="MARKET",
    product="NRML",
    splitsize=0  # 0 = no splitting
)

Response:

{
  "exchange": "NFO",
  "offset": "ATM",
  "option_type": "CE",
  "orderid": "25013000000001",
  "status": "success",
  "symbol": "NIFTY30JAN2526000CE",
  "underlying": "NIFTY30JAN25FUT",
  "underlying_ltp": 26015.50
}

ITM Put Option:

response = client.optionsorder(
    strategy="OptionsBot",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    offset="ITM3",  # 3 strikes ITM
    option_type="PE",
    action="BUY",
    quantity=75,
    pricetype="MARKET",
    product="NRML"
)

OTM Call Option:

response = client.optionsorder(
    strategy="OptionsBot",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    offset="OTM5",  # 5 strikes OTM
    option_type="CE",
    action="SELL",
    quantity=75,
    pricetype="MARKET",
    product="NRML"
)

2. Multi-Leg Options Order

Execute complex strategies with multiple legs in a single call:

Iron Condor (4 legs)

response = client.optionsmultiorder(
    strategy="Iron Condor",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    legs=[
        {"offset": "OTM6", "option_type": "CE", "action": "BUY", "quantity": 75},
        {"offset": "OTM6", "option_type": "PE", "action": "BUY", "quantity": 75},
        {"offset": "OTM4", "option_type": "CE", "action": "SELL", "quantity": 75},
        {"offset": "OTM4", "option_type": "PE", "action": "SELL", "quantity": 75}
    ]
)

Response:

{
  "status": "success",
  "underlying": "NIFTY",
  "underlying_ltp": 26050.45,
  "results": [
    {"leg": 1, "action": "BUY", "offset": "OTM6", "option_type": "CE", "symbol": "NIFTY30JAN2526350CE", "orderid": "123", "status": "success"},
    {"leg": 2, "action": "BUY", "offset": "OTM6", "option_type": "PE", "symbol": "NIFTY30JAN2525750PE", "orderid": "124", "status": "success"},
    {"leg": 3, "action": "SELL", "offset": "OTM4", "option_type": "CE", "symbol": "NIFTY30JAN2526250CE", "orderid": "125", "status": "success"},
    {"leg": 4, "action": "SELL", "offset": "OTM4", "option_type": "PE", "symbol": "NIFTY30JAN2525850PE", "orderid": "126", "status": "success"}
  ]
}

Bull Call Spread (2 legs)

response = client.optionsmultiorder(
    strategy="Bull Call Spread",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    legs=[
        {"offset": "ATM", "option_type": "CE", "action": "BUY", "quantity": 75},
        {"offset": "OTM2", "option_type": "CE", "action": "SELL", "quantity": 75}
    ]
)

Bear Put Spread (2 legs)

response = client.optionsmultiorder(
    strategy="Bear Put Spread",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    legs=[
        {"offset": "ATM", "option_type": "PE", "action": "BUY", "quantity": 75},
        {"offset": "OTM2", "option_type": "PE", "action": "SELL", "quantity": 75}
    ]
)

Straddle (2 legs)

response = client.optionsmultiorder(
    strategy="Long Straddle",
    underlying="BANKNIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    legs=[
        {"offset": "ATM", "option_type": "CE", "action": "BUY", "quantity": 30},
        {"offset": "ATM", "option_type": "PE", "action": "BUY", "quantity": 30}
    ]
)

Strangle (2 legs)

response = client.optionsmultiorder(
    strategy="Short Strangle",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    legs=[
        {"offset": "OTM3", "option_type": "CE", "action": "SELL", "quantity": 75},
        {"offset": "OTM3", "option_type": "PE", "action": "SELL", "quantity": 75}
    ]
)

Diagonal Spread (Different Expiries)

response = client.optionsmultiorder(
    strategy="Diagonal Spread",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    legs=[
        {"offset": "ITM2", "option_type": "CE", "action": "BUY", "quantity": 75, "expiry_date": "27FEB25"},
        {"offset": "OTM2", "option_type": "CE", "action": "SELL", "quantity": 75, "expiry_date": "30JAN25"}
    ]
)

Calendar Spread (Same Strike, Different Expiries)

response = client.optionsmultiorder(
    strategy="Calendar Spread",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    legs=[
        {"offset": "ATM", "option_type": "CE", "action": "BUY", "quantity": 75, "expiry_date": "27FEB25"},
        {"offset": "ATM", "option_type": "CE", "action": "SELL", "quantity": 75, "expiry_date": "30JAN25"}
    ]
)

Options Analysis

Get Option Symbol

Find the exact symbol for a given strike:

response = client.optionsymbol(
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    offset="ATM",
    option_type="CE"
)
# Response: {'symbol': 'NIFTY30JAN2526000CE', 'exchange': 'NFO', 'lotsize': 75, ...}

Get Option Chain

Retrieve the full option chain for analysis:

chain = client.optionchain(
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    strike_count=10  # ±10 strikes from ATM
)

Response includes for each strike:

{
  "strike": 26000.0,
  "ce": {
    "symbol": "NIFTY30JAN2526000CE",
    "label": "ATM",
    "ltp": 250.50,
    "bid": 250.00,
    "ask": 251.00,
    "volume": 1500000,
    "oi": 5000000,
    "lotsize": 75
  },
  "pe": {
    "symbol": "NIFTY30JAN2526000PE",
    "label": "ATM",
    "ltp": 245.00,
    "bid": 244.50,
    "ask": 245.50,
    "volume": 1200000,
    "oi": 4500000,
    "lotsize": 75
  }
}

Calculate Option Greeks

Get Delta, Gamma, Theta, Vega, Rho for any option:

greeks = client.optiongreeks(
    symbol="NIFTY30JAN2526000CE",
    exchange="NFO",
    interest_rate=0.00,
    underlying_symbol="NIFTY",
    underlying_exchange="NSE_INDEX"
)

Response:

{
  "status": "success",
  "symbol": "NIFTY30JAN2526000CE",
  "option_type": "CE",
  "strike": 26000.0,
  "spot_price": 25966.05,
  "option_price": 250,
  "days_to_expiry": 28.5,
  "implied_volatility": 15.6,
  "greeks": {
    "delta": 0.4967,
    "gamma": 0.000352,
    "theta": -7.919,
    "vega": 28.9489,
    "rho": 9.733994
  }
}

Calculate Synthetic Future Price

synthetic = client.syntheticfuture(
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25"
)
# Response: {'synthetic_future_price': 26050.05, 'atm_strike': 26000.0, ...}

Get Expiry Dates

expiries = client.expiry(
    symbol="NIFTY",
    exchange="NFO",
    instrumenttype="options"
)
# Returns list of expiry dates: ['30-JAN-25', '06-FEB-25', '13-FEB-25', ...]

Common Index Details

IndexExchangeLot SizeStrike Gap
NIFTYNSE_INDEX7550
BANKNIFTYNSE_INDEX30100
FINNIFTYNSE_INDEX6550
MIDCPNIFTYNSE_INDEX5025
SENSEXBSE_INDEX20100
BANKEXBSE_INDEX30100

Strategy Patterns

Weekly Options Selling (Theta Decay)

# Short Strangle - Sell OTM options to collect premium
response = client.optionsmultiorder(
    strategy="Weekly Strangle",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",  # Weekly expiry
    legs=[
        {"offset": "OTM5", "option_type": "CE", "action": "SELL", "quantity": 75},
        {"offset": "OTM5", "option_type": "PE", "action": "SELL", "quantity": 75}
    ]
)

Directional Play with Protection

# Bull Call Spread - Limited risk bullish bet
response = client.optionsmultiorder(
    strategy="Bullish Spread",
    underlying="BANKNIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    legs=[
        {"offset": "ATM", "option_type": "CE", "action": "BUY", "quantity": 30},
        {"offset": "OTM3", "option_type": "CE", "action": "SELL", "quantity": 30}
    ]
)

Event Day Volatility Play

# Long Straddle before results/events
response = client.optionsmultiorder(
    strategy="Event Straddle",
    underlying="RELIANCE",
    exchange="NSE",
    expiry_date="30JAN25",
    legs=[
        {"offset": "ATM", "option_type": "CE", "action": "BUY", "quantity": 250},
        {"offset": "ATM", "option_type": "PE", "action": "BUY", "quantity": 250}
    ]
)

Butterfly Spread (Low Capital)

response = client.optionsmultiorder(
    strategy="Long Butterfly",
    underlying="NIFTY",
    exchange="NSE_INDEX",
    expiry_date="30JAN25",
    legs=[
        {"offset": "ITM2", "option_type": "CE", "action": "BUY", "quantity": 75},
        {"offset": "ATM", "option_type": "CE", "action": "SELL", "quantity": 150},
        {"offset": "OTM2", "option_type": "CE", "action": "BUY", "quantity": 75}
    ]
)

Margin Calculation

Calculate required margin before placing orders:

margin = client.margin(positions=[
    {
        "symbol": "NIFTY30JAN2526000CE",
        "exchange": "NFO",
        "action": "SELL",
        "product": "NRML",
        "pricetype": "MARKET",
        "quantity": "75"
    },
    {
        "symbol": "NIFTY30JAN2525000CE",
        "exchange": "NFO",
        "action": "BUY",
        "product": "NRML",
        "pricetype": "MARKET",
        "quantity": "75"
    }
])

print(f"Total Margin Required: {margin['data']['total_margin_required']}")
print(f"SPAN Margin: {margin['data']['span_margin']}")
print(f"Exposure Margin: {margin['data']['exposure_margin']}")

Notes

  • Always check available margin before placing option sell orders
  • Use splitsize parameter for large orders to avoid freeze quantity limits
  • Weekly options expire on Thursday, monthly on last Thursday
  • NIFTY lot size is 75, BANKNIFTY is 30
  • Use Analyzer mode for paper trading: client.analyzertoggle(mode=True)

What ships with it: 5 files

23.9 KB alongside SKILL.md, 4 of them executable

scripts/

Gives 0 of the 12 instructions most finance skills give in ~3.7k tokens

Counted across 469 of the 469 authors here whose files we hold, read 2026-08-07

  • Extract date vendor amount and descriptionin 15 of 469, across 3 files
  • Scan folder for invoice filesin 14 of 469, across 2 files
  • Rename files to standard formatin 14 of 469, across 2 files
  • Show organization plan before movingin 14 of 469, across 2 files
  • Generate summary CSVin 14 of 469, across 2 files
  • Organize files by categoryin 13 of 469, across 1 file
  • Preserve original filesin 13 of 469, across 1 file
  • Flag files missing critical infoin 13 of 469, across 1 file
  • Produce the requested output filein 9 of 469, across 4 files
  • Build best, base, and worst case scenariosin 9 of 469, across 5 files
  • Implement backoff if rate limit errors occurin 8 of 469, across 3 files
  • Determine the weighted average cost of capitalin 8 of 469, across 4 files

Said here and by no other author read

  • Calculate margin before placing option sell orders
  • Use splitsize for large orders
  • Format index options symbols correctly
  • Use offset system to select strike prices
  • Activate analyzer mode for paper trading

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.