Options - Financial Hacker

Posted By: Ger1

Options - Financial Hacker - 10/07/17 09:46

I am trying to replicate the experiments from the financial hacker but I can't get the script OptionsSellRandom running properly.
In my case no trades are executed.

I ran all other options scripts from financial hacker and the results were the same as on the website. I also ran SPY-options for generating the curves and it worked too, so I guess the generation of artificial options data worked too.

Can anyone advise what is going wrong and why no trades are generated when running OptionsSellRandom ?
Posted By: mhdus

Re: Options - Financial Hacker - 10/08/17 18:30

I once had the same problem and finally I realized that my R installation had a dependency to RQuantlib missing (I believe it was Rcpp but I am not sure anymore ...).
General question to the R experts here: does R (on Windows) offer any indiction of such missing dependencies?
Posted By: Ger1

Re: Options - Financial Hacker - 10/09/17 06:25

Thanks for your suggestion. The thing is I got Rcpp with quantlib.

Is there another way to find out if the .t8 file has been created properly?

I still try to understand the basics of options scripts ...
Posted By: jcl

Re: Options - Financial Hacker - 10/09/17 08:27

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=468518#Post468518
Posted By: Ger1

Re: Options - Financial Hacker - 10/13/17 23:15

Thanks a lot jcl, that was it!

It did not install properly. It took me some time to figure out how to install it properly.
If anyone faces the same issue, below link did it for me:

https://stackoverflow.com/questions/39849542/installation-of-rquantlib
Posted By: mhdus

Re: Options - Financial Hacker - 10/23/17 21:34

I just had the same issue while installing Zorro and R on a new VPS.

I did follow the R installation instructions from the Zorro manual: there were no error messages but options-specific functions in Zorro were simply not working without any hint what could be wrong.

After following the installation instructions from the above stackoverflow URL the options functions in Zorro are working fine.

The test directly in the R console suggested by jcl is still not working, though:

> AmericanOption('put', strike=100, volatility=0.4, 100, 0.02, 0.03, 0.5, engine='CrankNicolson')
Error in AmericanOption("put", strike = 100, volatility = 0.4, 100, 0.02, :
could not find function "AmericanOption"
>

I'm afraid I'm outing myself as a complete R idiot but I believe I'm not the only one ...
So the Zorro manual may deserve a slight improvement in the RQuantLib installation (and eventually troubleshooting) instructions for those of us who are not familiar at all with R.

Thanks in advance.
Posted By: jcl

Re: Options - Financial Hacker - 10/24/17 07:39

The problem with RQuantlib is that it is not in the standard R package repository. So you must install it either directly as described in the manual, or via DRAT as described in the Stackoverflow link.

For this reason, dependencies such as Rcpp are also not automatically installed. This gives no error message, but calls to RQuantlib fail. So you must also manually install Rcpp. I believe that is the only dependency.

The message "could not find function AmericanOption" means that RQuantlib itself is not linked or not installed. AmericanOption is heavily used by contractVal, so this function would then also fail. If all is correctly installed, the response from R is:

Code:
> library('RQuantLib',quiet=TRUE)
> AmericanOption('put', strike=100, volatility=0.4, 100, 0.02, 0.03, 0.5, engine='CrankNicolson')
Concise summary of valuation for AmericanOption 
  value   delta   gamma    vega   theta     rho  divRho 
10.9173 -0.4358  0.0140      NA      NA      NA      NA



I've added some details to the manual description.
Posted By: mhdus

Re: Options - Financial Hacker - 10/24/17 12:01

Thanks. "library('RQuantLib',quiet=TRUE)" did the trick to make the AmericanOption() function work in the R console.

However, Zorro's ContractVal() function did already work before (I used the OptionsCurve script to test), so it appears as if Zorro could already use RQuantLib while R console could not.

Please note that while following the installation instructions from the stackoverflow URL above, Rcpp got installed automatically.

Thanks for the add-on to the manual.
© 2024 lite-C Forums