Skills

Nse Options

NSE options chain: OI buildup, PCR, max pain, IV (Nifty/BankNifty)

Install

npx skills add taracodlabs/aiden --skill nse-options -g -a claude-code -y
Repository
taracodlabs/aiden868
Category
Engineering
Updated
16d ago
License
Apache-2.0
Context cost
Lightabout 1,076 tokens
Runs scripts
No, instructions only

What it does

NSE options chain: OI buildup, PCR, max pain, IV (Nifty/BankNifty)

NSE Options

Analyze NSE options chain for Nifty and BankNifty, open interest buildup, put-call ratio, max pain level, and implied volatility, using NSE's public JSON API.

When to Use

  • User asks for Nifty or BankNifty options chain
  • User wants to know the PCR (put-call ratio) for an index
  • User asks for max pain or peak OI strikes
  • User wants to see OI change at specific strike prices
  • User asks about ITM/OTM options or IV skew

How to Use

Fetch options chain for Nifty

$headers = @{ "User-Agent" = "Mozilla/5.0"; "Referer" = "https://www.nseindia.com" }
Invoke-WebRequest -Uri "https://www.nseindia.com" -SessionVariable nse -Headers $headers | Out-Null
$chain = Invoke-RestMethod -Uri "https://www.nseindia.com/api/option-chain-indices?symbol=NIFTY" `
  -Headers $headers -WebSession $nse
$chain.records.data | Select-Object strikePrice,
  @{N='CE_OI';E={$_.CE.openInterest}}, @{N='CE_IV';E={$_.CE.impliedVolatility}},
  @{N='PE_OI';E={$_.PE.openInterest}}, @{N='PE_IV';E={$_.PE.impliedVolatility}} |
  Where-Object { $_.CE_OI -or $_.PE_OI } |
  Sort-Object strikePrice

Calculate PCR (Put-Call Ratio)

$headers = @{ "User-Agent" = "Mozilla/5.0"; "Referer" = "https://www.nseindia.com" }
Invoke-WebRequest -Uri "https://www.nseindia.com" -SessionVariable nse -Headers $headers | Out-Null
$chain = Invoke-RestMethod -Uri "https://www.nseindia.com/api/option-chain-indices?symbol=NIFTY" `
  -Headers $headers -WebSession $nse
$totalCE_OI = ($chain.records.data | ForEach-Object { $_.CE.openInterest } | Measure-Object -Sum).Sum
$totalPE_OI = ($chain.records.data | ForEach-Object { $_.PE.openInterest } | Measure-Object -Sum).Sum
$pcr = [math]::Round($totalPE_OI / $totalCE_OI, 2)
Write-Host "Nifty PCR: $pcr  (CE OI: $totalCE_OI | PE OI: $totalPE_OI)"
Read the whole SKILL.md on GitHub

More in Engineering