Creating a trading system from scratch

How many lines of code you are comfortable with


  • Total voters
    61
master there is too much pain around options
But, what price to enter? Maybe the ATM option.
But in any case, calculating the IV would help us backtest and see the patterns in a better manner.
Could you try it out the same strategy on cash markets and options using historical volatility?
As far as I know, there is no easy framework for options constructions out of the box.
Are you a full time trader?
master we can copy calculate iv from options in nse and apply on stock or future and stay away from options or can deep dive into their pricing we but dont think it will be same as nse,
from tasty trades In simple terms, IV is determined by the current price of option contracts on a particular stock or future. It is represented as a percentage that indicates the annualized expected one standard deviation range for the stock based on the option prices. For example, an IV of 25% on a $200 stock would represent a one standard deviation range of $50 over the next year.

i think implied volatility is a metric derived from the market price which gives measure of how volatile the market believes the asset underlying is.
 

UberMachine

Well-Known Member
master there is too much pain around options

master we can copy calculate iv from options in nse and apply on stock or future and stay away from options or can deep dive into their pricing we but dont think it will be same as nse,
from tasty trades In simple terms, IV is determined by the current price of option contracts on a particular stock or future. It is represented as a percentage that indicates the annualized expected one standard deviation range for the stock based on the option prices. For example, an IV of 25% on a $200 stock would represent a one standard deviation range of $50 over the next year.

i think implied volatility is a metric derived from the market price which gives measure of how volatile the market believes the asset underlying is.
You nailed it. You got to have an estimation of IV, though it may not be exact we might get a close approximation from libraries such as vollib, given enough data and careful analysis (Its painful)
I think the example is picked from options playbook; (everywhere its the same). But in any case, we need to estimate IV.
And to be honest, I still don't know how to convert sigma to IV and vice-versa (its possible; all you need to do is to get prices and movements for the past few days; run a simulated forward test and then estimate the IV and check it with the real data but I haven't done it quite convicingly so far to warrant a backtest).

This is one of the reasons I stay away from options because I don't exactly know how to test them statistically.
One easy thing you could do is to download the IV at different times for a few stocks and then compare them with vollib library to get a sense of how much we differ; else you could try predicting the value of the stock and then using it to arrive at the option price.

We must be able to predict either the underlying or the IV to some degree of accuracy to test options (working on it but it would take tons of time). Inputs are welcome
 
Last edited:

UberMachine

Well-Known Member
View attachment 31186

another example
Open Price1161.25
SD-17.63
ATM IV 29 estimated
Upper range1178
lower range1143
took this from https://traderslounge.in/ivrank-TCS/
looks like estimation is also enough
https://traderslounge.in/implied-volatility-rank-nse-fno-stocks/
this guy is calculating as he said in a post---- IVs are calculated from IVs of At-the-Money and two Out-of-the-Money strike put & call options.
Impressive details; have you tried their website apps?
Sorry but again, how do we estimate IV is 29 for past data?
May be, we can get present IV and then calculate the 1SD mark and automate the trade. Is this what you expect?
 
Impressive details; have you tried their website apps?
Sorry but again, how do we estimate IV is 29 for past data?
May be, we can get present IV and then calculate the 1SD mark and automate the trade. Is this what you expect?
master i mixed up some stuff by mistake so i edited the post above iv is taken as stated in his website https://traderslounge.in/ivrank-RELIANCE/ on 28th ,lets see if calulation can be done
 

UberMachine

Well-Known Member
master i mixed up some stuff by mistake so i edited the post above iv is taken as stated in his website https://traderslounge.in/ivrank-RELIANCE/ on 28th ,lets see if calulation can be done
Do these IV's match with NSE website and also Sensibull (they must be close enough)? Kindly check it tomorrow.
And regarding implementation, nothing in the near time (I need ot undestand the options beast completely) but we can just scrap this data and create an automated system if you want.
 
Do these IV's match with NSE website and also Sensibull (they must be close enough)? Kindly check it tomorrow.
And regarding implementation, nothing in the near time (I need ot undestand the options beast completely) but we can just scrap this data and create an automated system if you want.
yes master decode these option i think they must have some clues to future,
another thing is these bollinger bands hav some same functionality to them as Stdev but it keeps on movingo_O both of my examples are seen touchinng extreme BB,

master create automated system if it isnt too taxing just to see performance
 
Last edited:

prabhsingh

Well-Known Member
master i mixed up some stuff by mistake so i edited the post above iv is taken as stated in his website https://traderslounge.in/ivrank-RELIANCE/ on 28th ,lets see if calulation can be done
I know this guy and his IV won't match with NSE because these guys consider combination of ATM and ITM for calculation of IV not exactly know there calculation to be honest but this is mixture of such thing.
 

UberMachine

Well-Known Member
yes master decode these option i think they must have some clues to future,
another thing is these bollinger bands hav some same functionality to them as Stdev but it keeps on movingo_O both of my examples are seen touchinng extreme BB,

master create automated system if it isnt too taxing just to see performance
Options are quite complicated (and they are a beast). You can still create a strategy out of them but need to understand their elegance before diving in deeper (that's why there is no options tracking backtest out of the box). Quant connect offers one but require in depth knowlege.

BB on cash markets is fine; futures is also OK.
Options framework need to wait longer.
Else, I would be treating options as plain lol stocks and try something (crazy but let's see if something works out)
 
Last edited:
master
Code:
from scipy import log,exp,sqrt,stats
from scipy import log,exp,sqrt,stats
S=10907;X=10900;T=0.0821918;r=0.0655;c=208.1
def bsCall(S,X,T,r,sigma):
    d1=(log(S/X)+(r+sigma*sigma/2.)*T)/(sigma*sqrt(T))
    d2 = d1-sigma*sqrt(T)
    return S*stats.norm.cdf(d1)-X*exp(-r*T)*stats.norm.cdf(d2)


def impliedVolBinary(S,X,T,r,c):
    k=1
    volLow=0.001
    volHigh=1.0
    cLow=bsCall(S,X,T,r,volLow)
    cHigh=bsCall(S,X,T,r,volHigh)
    if cLow>c or cHigh<c:  
        raise ValueError
    while k ==1:  
       

        cLow=bsCall(S,X,T,r,volLow)
        cHigh=bsCall(S,X,T,r,volHigh)   
        volMid=(volLow+volHigh)/2.0   
        cMid=bsCall(S,X,T,r,volMid)
        if abs(cHigh-cLow)<0.01:  
            k=2  
        elif cMid>c: 
            volHigh=volMid  
        else: 
             volLow=volMid 
    return volMid, cLow, cHigh
print("Vol,     cLow,      cHigh")
print(impliedVolBinary(S,X,T,r,c))
from python for finance looks pretty close on call side
 

Similar threads