greeks

greeks: Sensitivities of Prices of Financial Options and Implied Volatilities - Published in JOSS (2024)

https://github.com/ahudde/greeks

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: springer.com, joss.theoj.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

asian-option greeks implied-volatility option r-package
Last synced: 6 months ago · JSON representation

Repository

Sensitivities of Prices of Financial Options and Implied Volatilites

Basic Info
  • Host: GitHub
  • Owner: ahudde
  • License: other
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 23.6 MB
Statistics
  • Stars: 7
  • Watchers: 2
  • Forks: 3
  • Open Issues: 1
  • Releases: 1
Topics
asian-option greeks implied-volatility option r-package
Created almost 5 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License

README.md

greeks

R-CMD-check status Codecov test coverage

The package greeks provides functions to compute financial option prices and sensitivities of financial option prices for European, American, Asian, and Digital options in the Black Scholes model, and in more general jump diffusion models. Furthermore, based on the implementations of Vega, efficient functions for calculating implied volatilities not just for European options, but also for American, Asian, and digital options are provided.

Classical formulas are implemented for European options in the Black Scholes Model. Furthermore, functions to calculate Malliavin Monte Carlo Greeks are given, as presented e.g., in Hudde, A. & Rüschendorf, L. (2016). European and Asian Greeks for exponential Lévy processes (https://link.springer.com/article/10.1007/s11009-023-10014-5). These functions work for classical payoff functions, as well as for any custom square integrable function provided by the user. Additionally, these calculations are not restricted to the Black Scholes model, but work for more general Lévy Jump diffusion model, which is also customizable by the user.

greeks on CRAN

You can view the documentation of this package on CRAN.R-project.org/package=greeks/greeks.pdf and the vignette on CRAN.R-project.org/package=greeks/vignettes/using_greeks.html.

Installation

# The cran version can be installed by 
install.packages("greeks")
# The development version can be installed by
install.packages("devtools")
library("devtools")
devtools::install_github("ahudde/greeks")

Computing option prices and Greeks in the shiny app

The option prices and volatilities for European options can be displayed with the interactive shiny app by calling

library(greeks)
Greeks_UI()

or online on anselmhudde.shinyapps.io/greeks/

Greeks_UI

The function Greeks

Most of the options prices and Greeks can easily be calculated with the function Greeks.

# Load package

library(greeks)

# Option price and most common Greeks of a European call option on a share with
# price 100 and volatility of 30%, where the exercise price is 120, the time to
# maturity of 5 years, and the riskless interest rate of 1%.

Greeks(initial_price = 100,
       exercise_price = 120,
       r = 0.01,
       time_to_maturity = 5,
       volatility = 0.30,
       payoff = "call")

##    fair_value         delta          vega         theta           rho 
##  21.577149923   0.554941778  88.358901748  -2.989937331 169.585139380 
##         gamma 
##   0.005890593

# Option price and most common Greeks of an American put option on a share with
# price 100 and volatility of 25%, where the exercise price is 100, the time to
# maturity of 1 year, and the riskless interest rate of -0.5%.

Greeks(initial_price = 100,
       exercise_price = 100,
       r = -0.005,
       time_to_maturity = 1,
       volatility = 0.30,
       payoff = "put",
       option_type = "American")

##  fair_value       delta        vega       theta         rho       gamma 
##  12.2027075  -0.4469782  39.5313017  -6.2141979 -56.9005269  -0.1275472

Computing implied volatilities

The package greeks also provides a function to compute implied volatilities for a wide range of option types and payoff functions:

# Implied volatility of an Asian call option with on an option price of 15, a
# share price of 100, an exercise_price of 100, a risk-free interest rate of
# 0.05 and a time to maturity of 1.

Implied_Volatility(option_price = 15, initial_price = 100,
             exercise_price = 100, r = 0.05, time_to_maturity = 1,
             option_type = "Asian", payoff = "call")

## [1] 0.6330451

Contributions, bug reports or support

Bug reports and contributions are very welcome. Also, if you need assistance, please open an issue on github.com/ahudde/greeks/issues.

Owner

  • Login: ahudde
  • Kind: user

JOSS Publication

greeks: Sensitivities of Prices of Financial Options and Implied Volatilities
Published
March 19, 2024
Volume 9, Issue 95, Page 5987
Authors
Anselm Hudde ORCID
University of Applied Sciences Koblenz, Germany
Editor
Charlotte Soneson ORCID
Tags
Option Pricing Financial Mathematics Malliavin Calculus

GitHub Events

Total
  • Watch event: 1
  • Push event: 11
Last Year
  • Watch event: 1
  • Push event: 11

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 346
  • Total Committers: 6
  • Avg Commits per committer: 57.667
  • Development Distribution Score (DDS): 0.376
Past Year
  • Commits: 20
  • Committers: 1
  • Avg Commits per committer: 20.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
hudde h****e@r****e 216
anselmhudde 6****e 57
ahudde 6****u 47
ahudde 6****e 23
Charlotte Soneson c****n@g****m 2
olivroy 5****y 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 19
  • Total pull requests: 2
  • Average time to close issues: about 2 months
  • Average time to close pull requests: about 4 hours
  • Total issue authors: 3
  • Total pull request authors: 2
  • Average comments per issue: 3.21
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • lrnv (17)
  • bahung (1)
  • ahudde (1)
Pull Request Authors
  • csoneson (2)
  • olivroy (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 467 last-month
  • Total docker downloads: 20,358
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 21
  • Total maintainers: 1
cran.r-project.org: greeks

Sensitivities of Prices of Financial Options and Implied Volatilities

  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 467 Last month
  • Docker Downloads: 20,358
Rankings
Downloads: 18.7%
Average: 28.0%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • Rcpp * imports
  • dqrng * imports
  • ggplot2 * imports
  • magrittr * imports
  • plotly * imports
  • shiny * imports
  • tibble * imports
  • tidyr * imports
  • R.rsp * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests