2
$\begingroup$

I am having difficulties when using the HNGOption program in R.

The program will only run for 1 specific option price, meaning that I would have to manually insert strike price etc. and this would take forever.

This is the code that I can successfully run:

hnpr <- LogRetDaily
hngarchSim(model=list(lambda=-0.5,omega=var(hnpr),alpha=0.1*var(hnpr),beta=0.1,
gamma=0,rf=0), n=1000, innov=hnpr, n.start=0, start.innov=NULL, rand.gen=rnorm)

hngf <- hngarchFit(x=hnpr,model=model,symmetric=FALSE,trace=TRUE)
HNGOption(TypeFlag = "c", model=model, S=2712.96, X=2450, Time.inDays=16, r.daily=0.0139/252)

However, I would like the code to estimate the option prices of my entire dataset of options.

I have tried the following code, but with no success:

hnpr <- LogRetDaily
hngarchSim(model=list(lambda=-0.5,omega=var(hnpr),alpha=0.1*var(hnpr),beta=0.1,
gamma=0,rf=0), n=1000, innov=hnpr, n.start=0, start.innov=NULL, rand.gen=rnorm)

hngf <- hngarchFit(x=hnpr,model=model,symmetric=FALSE,trace=TRUE)

HNGOption(TypeFlag = "c",model=model,S=underlying_price, X=strike,
Time.inDays = DaysToMaturity,r.daily = RiskFree/252)

Where the data in HNGOption is the entire dataset. I hope this makes sense.

I have been informed that it would require making a loop, but I have no experience constructing these.

I really hope somebody can help.

Thank you

August

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.