Options solution?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Options solution?

BBands
The options solution I have used forever no longer works well, so I am
looking for a new option analysis solution. My needs are rather
simple, really all I want are nice P&L graphs for option positions
with a number of legs. Flexibility is key. I was thinking about
Hoadley, which I have used on and off, but I am no longer a fan of
analytics in Excel. So I thought that this might be a chance to expand
my R skills. I've seen a couple of ideas and there must be a ton of R
solutions that I am not aware of. This is one that I have found:
http://www.r-bloggers.com/scenario-analysis-and-trading-options-using-r/
Do you know of any that are particularly elegant or that you like well?

Thanks,

    John
--
John Bollinger
www.BollingerBands.com

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Options solution?

Jeffrey Ryan
Hi John,

I have a package that isn't quite 'complete' that might be of use.

https://code.google.com/p/rgreeks/

I'm intending on pushing what is complete to CRAN this week.

I also gave a lightning talk at R/Finance this year as a quick 5 min
overview:

http://www.rinfinance.com/agenda/2013/talk/JeffRyan.pdf

HTH
Jeff


On Fri, Aug 23, 2013 at 4:32 PM, BBands <[hidden email]> wrote:

> The options solution I have used forever no longer works well, so I am
> looking for a new option analysis solution. My needs are rather
> simple, really all I want are nice P&L graphs for option positions
> with a number of legs. Flexibility is key. I was thinking about
> Hoadley, which I have used on and off, but I am no longer a fan of
> analytics in Excel. So I thought that this might be a chance to expand
> my R skills. I've seen a couple of ideas and there must be a ton of R
> solutions that I am not aware of. This is one that I have found:
> http://www.r-bloggers.com/scenario-analysis-and-trading-options-using-r/
> Do you know of any that are particularly elegant or that you like well?
>
> Thanks,
>
>     John
> --
> John Bollinger
> www.BollingerBands.com
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>



--
Jeffrey Ryan
[hidden email]

www.lemnica.com

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Options solution?

BBands
Thanks Jeff, that looks interesting. I'll dig in soon.

Was the lightning talk recorded?

     John

On Sun, Aug 25, 2013 at 8:14 AM, Jeff Ryan <[hidden email]> wrote:
> Hi John,
>
> I have a package that isn't quite 'complete' that might be of use.
>
> https://code.google.com/p/rgreeks/

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Options solution?

BBands
Hi Jeff,

I downloaded the source via svn, but I can't figure out how to install
it into R. I tried:

install.packages("/home/john/software/rgreeks-read-only/pkg", repos =
NULL, type="source")

without any luck. Hint please.

Thanks,

John




On Tue, Aug 27, 2013 at 8:14 AM, BBands <[hidden email]> wrote:

> Thanks Jeff, that looks interesting. I'll dig in soon.
>
> Was the lightning talk recorded?
>
>      John
>
> On Sun, Aug 25, 2013 at 8:14 AM, Jeff Ryan <[hidden email]> wrote:
>> Hi John,
>>
>> I have a package that isn't quite 'complete' that might be of use.
>>
>> https://code.google.com/p/rgreeks/



--
John Bollinger
www.BollingerBands.com

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Options solution?

Joshua Ulrich
I'm not Jeff, but I'll try to help anyway. :)

Your command works for me (after changing the path).  What error do
you get?  Also, what's the output from sessionInfo() from your R
session?

You can also build/install on the command line via:
R CMD build pkg
R CMD INSTALL greeks_0.5-4.tar.gz

Best,
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com


On Thu, Oct 3, 2013 at 4:57 PM, BBands <[hidden email]> wrote:

> Hi Jeff,
>
> I downloaded the source via svn, but I can't figure out how to install
> it into R. I tried:
>
> install.packages("/home/john/software/rgreeks-read-only/pkg", repos =
> NULL, type="source")
>
> without any luck. Hint please.
>
> Thanks,
>
> John
>
>
>
>
> On Tue, Aug 27, 2013 at 8:14 AM, BBands <[hidden email]> wrote:
>> Thanks Jeff, that looks interesting. I'll dig in soon.
>>
>> Was the lightning talk recorded?
>>
>>      John
>>
>> On Sun, Aug 25, 2013 at 8:14 AM, Jeff Ryan <[hidden email]> wrote:
>>> Hi John,
>>>
>>> I have a package that isn't quite 'complete' that might be of use.
>>>
>>> https://code.google.com/p/rgreeks/
>
>
>
> --
> John Bollinger
> www.BollingerBands.com
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com


On Thu, Oct 3, 2013 at 4:57 PM, BBands <[hidden email]> wrote:

> Hi Jeff,
>
> I downloaded the source via svn, but I can't figure out how to install
> it into R. I tried:
>
> install.packages("/home/john/software/rgreeks-read-only/pkg", repos =
> NULL, type="source")
>
> without any luck. Hint please.
>
> Thanks,
>
> John
>
>
>
>
> On Tue, Aug 27, 2013 at 8:14 AM, BBands <[hidden email]> wrote:
>> Thanks Jeff, that looks interesting. I'll dig in soon.
>>
>> Was the lightning talk recorded?
>>
>>      John
>>
>> On Sun, Aug 25, 2013 at 8:14 AM, Jeff Ryan <[hidden email]> wrote:
>>> Hi John,
>>>
>>> I have a package that isn't quite 'complete' that might be of use.
>>>
>>> https://code.google.com/p/rgreeks/
>
>
>
> --
> John Bollinger
> www.BollingerBands.com
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Options solution?

BBands
In reply to this post by BBands
Got it now.

Thanks,

     John

On Thu, Oct 3, 2013 at 2:57 PM, BBands <[hidden email]> wrote:

> Hi Jeff,
>
> I downloaded the source via svn, but I can't figure out how to install
> it into R. I tried:
>
> install.packages("/home/john/software/rgreeks-read-only/pkg", repos =
> NULL, type="source")
>
> without any luck. Hint please.
>
> Thanks,
>
> John
>
>
>
>
> On Tue, Aug 27, 2013 at 8:14 AM, BBands <[hidden email]> wrote:
>> Thanks Jeff, that looks interesting. I'll dig in soon.
>>
>> Was the lightning talk recorded?
>>
>>      John
>>
>> On Sun, Aug 25, 2013 at 8:14 AM, Jeff Ryan <[hidden email]> wrote:
>>> Hi John,
>>>
>>> I have a package that isn't quite 'complete' that might be of use.
>>>
>>> https://code.google.com/p/rgreeks/
>
>
>
> --
> John Bollinger
> www.BollingerBands.com



--
John Bollinger
www.BollingerBands.com

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Options solution?

Kris-2
In reply to this post by Jeffrey Ryan
Another way to get the greeks besides Jeff's excellent package could be with AD tools in R.
I just noticed that there was a GSOC to add automatic differentiation in R and
the package radx on github looks promising.  One could to automagically compute
greeks on the fly for free.
 
Here is a little code snippet that computes the option price and magically gives you the delta for free!

>>>>

#require(devtools)  #make sure we have devtools installed
#install_github("radx","quantumelixir") #install radx from github

rm(list=ls())
require(radx)

FT<-1.35
X<-1.32
Time<-1/4
rate<-0.01
vol<-0.12
putcall<-"C"


#Simple blackscholesmerton pricer for options
bspricer <- function(putcall,vol,FT,X,Time,rate)
{
 
  d1 <- (log(FT/X)+(rate+0.5*(vol*vol))*Time)/(vol*sqrt(Time))
  d2 <- d1-vol*sqrt(Time)
 
  FT=radx(FT,1)  # this is where all the magic happens
 
  if(putcall=="C") {
    return((FT*pnorm(d1)-X*exp(-rate*Time)*pnorm(d2)))
  } else {
    return((X*exp(-rate*Time)*pnorm(-d2)-FT*pnorm(-d1)))
  }
}

#Calling this function below

>bspricer(putcall,vol,FT,X,Time,rate)

Value      : 0.05128281
Coefficients:[1]  0.6722788
Derivatives :[1]  0.6722788
Order       : 1
Directions  : 1

>>>>>>>


So no more worries around the appropriate shift in finite difference methods, roundoff errors from machine
precision issues (IEEE 754) or knowing the exact analytical formula for the greeks.



Cheers
Krishna



On Aug 25, 2013, at 11:14 AM, Jeff Ryan wrote:

> Hi John,
>
> I have a package that isn't quite 'complete' that might be of use.
>
> https://code.google.com/p/rgreeks/
>
> I'm intending on pushing what is complete to CRAN this week.
>
> I also gave a lightning talk at R/Finance this year as a quick 5 min
> overview:
>
> http://www.rinfinance.com/agenda/2013/talk/JeffRyan.pdf
>
> HTH
> Jeff
>
>
> On Fri, Aug 23, 2013 at 4:32 PM, BBands <[hidden email]> wrote:
>
>> The options solution I have used forever no longer works well, so I am
>> looking for a new option analysis solution. My needs are rather
>> simple, really all I want are nice P&L graphs for option positions
>> with a number of legs. Flexibility is key. I was thinking about
>> Hoadley, which I have used on and off, but I am no longer a fan of
>> analytics in Excel. So I thought that this might be a chance to expand
>> my R skills. I've seen a couple of ideas and there must be a ton of R
>> solutions that I am not aware of. This is one that I have found:
>> http://www.r-bloggers.com/scenario-analysis-and-trading-options-using-r/
>> Do you know of any that are particularly elegant or that you like well?
>>
>> Thanks,
>>
>>    John
>> --
>> John Bollinger
>> www.BollingerBands.com
>>
>> _______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions
>> should go.
>>
>
>
>
> --
> Jeffrey Ryan
> [hidden email]
>
> www.lemnica.com
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.


        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: Options solution?

BBands
That's interesting and I will explore. Thanks. My interest lies in
really short-term options where often the BS values don't seem to make
a lot of sense, so I am looking into different modeling methods. This
was all inspired by the discovery of decent liquidity in the weekly
options and the sort of Xmas-like idea of an expiration a week. Any
thoughts on analysing very sort-term options in R very welcome.

Best,

     John

On Tue, Oct 8, 2013 at 6:35 PM, Kris <[hidden email]> wrote:
> Another way to get the greeks besides Jeff's excellent package could be with AD tools in R.
> I just noticed that there was a GSOC to add automatic differentiation in R and
> the package radx on github looks promising.  One could to automagically compute
> greeks on the fly for free.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.