{"id":13741429,"url":"https://github.com/imanuelcostigan/fmbasics","last_synced_at":"2025-06-25T19:33:40.486Z","repository":{"id":17342316,"uuid":"78982112","full_name":"imanuelcostigan/fmbasics","owner":"imanuelcostigan","description":"Financial Market Building Blocks","archived":false,"fork":false,"pushed_at":"2022-02-01T07:44:45.000Z","size":545,"stargazers_count":12,"open_issues_count":7,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-15T11:36:25.541Z","etag":null,"topics":["derivatives","finance","r"],"latest_commit_sha":null,"homepage":"https://imanuelcostigan.github.io/fmbasics","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imanuelcostigan.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-15T00:48:49.000Z","updated_at":"2024-04-05T08:47:18.000Z","dependencies_parsed_at":"2022-08-07T08:15:57.621Z","dependency_job_id":null,"html_url":"https://github.com/imanuelcostigan/fmbasics","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imanuelcostigan%2Ffmbasics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imanuelcostigan%2Ffmbasics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imanuelcostigan%2Ffmbasics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imanuelcostigan%2Ffmbasics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imanuelcostigan","download_url":"https://codeload.github.com/imanuelcostigan/fmbasics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247623013,"owners_count":20968574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["derivatives","finance","r"],"created_at":"2024-08-03T04:00:59.095Z","updated_at":"2025-04-07T08:52:04.128Z","avatar_url":"https://github.com/imanuelcostigan.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":["Financial Instruments and Pricing"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"inst/README-\"\n)\n```\n\n# fmbasics - Financial Market Building Blocks\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/fmbasics)](https://CRAN.R-project.org/package=fmbasics) [![GitHub Actions](https://github.com/imanuelcostigan/fmbasics/workflows/R-CMD-check/badge.svg)](https://github.com/imanuelcostigan/fmbasics/actions?workflow=R-CMD-check) [![Coverage Status](https://img.shields.io/codecov/c/github/imanuelcostigan/fmbasics/master.svg)](https://codecov.io/github/imanuelcostigan/fmbasics?branch=master)\n\u003c!-- badges: end --\u003e\n\nImplements basic financial market objects like currencies, currency pairs,\ninterest rates and interest rate indices. You will be able to use Benchmark\ninstances of these objects which have been defined using their most common\nconventions or those defined by International Swap Dealer Association (ISDA,\nhttps://www.isda.org) legal documentation.\n\n## Basic objects\n\nYou can create instances of key currencies and currency pairs (and of course create your own implementations):\n\n```{r}\nlibrary(\"fmdates\")\nlibrary(\"fmbasics\")\nAUD()\nAUDUSD()\n```\n\nThese come with implementations of handy methods:\n\n```{r, message = FALSE}\nlibrary(\"lubridate\")\nto_fx_value(dates = ymd(20171230), tenor = \"spot\", x = AUDUSD())\nto_fx_value(ymd(20171230), months(3), AUDUSD())\n```\n\n\nYou can create instances of key IBOR or ONIA interest rate indices:\n\n```{r}\nUSDLIBOR(months(3))\nEONIA()\n```\n\nThese also come with implementations of handy methods:\n\n```{r}\nto_reset(dates = as.Date(\"2017-01-20\"), index = USDLIBOR(months(3)))\nto_value(as.Date(\"2017-01-20\"), USDLIBOR(months(3)))\nto_maturity(as.Date(\"2017-01-20\"), USDLIBOR(months(3)))\n```\n\n## Interest rates and discount factors\n\nYou can create and perform basic manipulation of interest rates and discount factors:\n\n```{r}\nrr \u003c- InterestRate(value = 0.01, compounding = Inf, day_basis = \"act/365\")\nas_DiscountFactor(rr, d1 = ymd(20170120), d2 = ymd(20210120))\n# Convert to different rate basis\nas_InterestRate(rr, day_basis = \"act/360\")\nas_InterestRate(rr, compounding = 2, day_basis = \"act/360\")\ndd \u003c- DiscountFactor(0.75, d1 = ymd(20170120), d2 = ymd(20210120))\nas_InterestRate(dd, compounding = Inf, day_basis = \"act/360\")\n```\n\n\n## Pricing objects\n\nIt is also possible to create and interpolate on zero coupon interest rate curves:\n\n```{r}\nzc \u003c- build_zero_curve()\nplot(zc$pillar_times, zc$pillar_zeros, xlab = 'Years', ylab = 'Zero')\ninterpolate(zc, year_frac(zc$reference_date, ymd(20170331), \"act/365\"))\ninterpolate_zeros(zc, ymd(20170331))\ninterpolate_fwds(zc, ymd(20170331), ymd(20170630))\ninterpolate_dfs(zc, ymd(20170331), ymd(20170630))\n```\n\nBasic support for creating and interpolating volatility surfaces is possible:\n\n```{r}\n# vs \u003c- build_vol_surface()\n# at \u003c- tibble::tibble(\n#  maturity = as.Date(c(\"2020-03-31\", \"2021-03-31\")),\n#  smile = c(0.40, 0.80)\n# )\n# interpolate(vs, at)\n```\n\n\nFurther details can be found in this package's help pages and vignettes (`vignette(package = \"fmbasics\")`) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimanuelcostigan%2Ffmbasics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimanuelcostigan%2Ffmbasics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimanuelcostigan%2Ffmbasics/lists"}