Home Forums General Questions How to find strike gap for a stock/index dynamically in options trading ? Reply To: How to find strike gap for a stock/index dynamically in options trading ?

Yes, so there’s no direct API that gives you “strike gap”.

The one way to do that calculate it from available strikes from the any source like script master file.

So, the simple idea is Strike gap = difference between consecutive strikes

Can understand with simple steps:

Fetch option chain / instruments
Take available strikes
Sort them
Find difference
Can also refer below code:

def get_strike_gap(strikes):
    strikes = sorted(set(strikes))
    if len(strikes) < 2:
        return None
    gaps = [strikes[i+1] - strikes[i] for i in range(len(strikes)-1)]
    # Most common gap
    gap = min(gaps)
    return gap

# Sample - Inplace of this have the stricks from instrument/option chain
strikes = [19800, 19850, 19900, 19950, 20000]

gap = get_strike_gap(strikes)
print("Strike Gap:", gap)
×

Start a Discussion

Get help from the AlgoDelta community.

×

Welcome Back!

Enter your email to sign in or create an account. No passwords needed.

⚠️

Delete This?

Are you sure you want to delete this? This action is permanent and cannot be undone.

Scroll to Top