An open API service indexing awesome lists of open source software.

https://github.com/imanuelcostigan/dataonderivatives

Easily source publicly available data on derivatives
https://github.com/imanuelcostigan/dataonderivatives

cran derivative derivatives r

Last synced: 6 months ago
JSON representation

Easily source publicly available data on derivatives

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```

# OTC derivatives data

Liquidity and pricing in the over-the-counter (OTC) derivative markets have tended to have less transparent than their exchange traded (lit) equivalents. The Bank of International Settlements (BIS) has [published statistics](https://www.bis.org/statistics/derstats.htm) of trading in the OTC markets on a triennial basis. However, representative statistics of volume and pricing data on a more frequent basis has been near impossible to obtain. Post-GFC derivatives reforms have lifted the veil in these markets.

## Swap execution facilities

Some Over-The-Counter (OTC) derivatives have been Made Available for Trade (MAT) by the CTFC. This means they must be traded on [Swap Execution Facilities (SEFs)](https://www.cftc.gov/IndustryOversight/TradingOrganizations/SEF2/index.htm). These SEFs are compelled publish trading volume and prices for these MAT derivatives on a daily basis.

Some of the most widely used SEFs are run by [Bloomberg](https://www.bloomberg.com/professional/product/swap-execution-facility/), [ICAP](https://tpicap.com/tpicap/regulatory-hub/tp-icap-sef), [Tullett Prebon](https://www.tullettprebon.com/swap-execution-facility/) and [Tradeweb](https://www.tradeweb.com/our-markets/market-regulation/sef/) among others.

## Swap data repositories

The key economic terms of traded swaps must be reported to an authorised [Swap Data Repository (SDR)](https://www.cftc.gov/IndustryOversight/DataRepositories/index.htm). Some of the most widely used SDRs are the [DTCC Data Repository](https://www.dtcc.com/repository-and-derivatives-services/repository-services/gtr-north-america), [ICE Trade Vault](https://www.theice.com/technology/post-trade) and the [CME's SDR](https://www.cmegroup.com/trading/global-repository-services/cme-swap-data-repository.html). The [CFTC provides weekly snapshots](https://www.cftc.gov/MarketReports/SwapsReports/index.htm) of data collected by these SDRs on a weekly basis. SDRs domiciled in different regulatory jurisdictions are expected to provide differing levels of data. [U.S. regulations](https://www.cftc.gov/IndustryOversight/DataRepositories/index.htm) compel U.S. domiciled SDRs to provide (anonymised) trade level data to the public while SDRs in other jurisdictions (e.g. in [Europe](https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2013:052:0033:0036:EN:PDF)) expected far less granular, and typically only aggregated, data.

# dataonderivatives

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/dataonderivatives)](https://CRAN.R-project.org/package=dataonderivatives)
[![R-CMD-check](https://github.com/imanuelcostigan/dataonderivatives/workflows/R-CMD-check/badge.svg)](https://github.com/imanuelcostigan/dataonderivatives/actions)
[![Codecov test coverage](https://codecov.io/gh/imanuelcostigan/dataonderivatives/branch/master/graph/badge.svg)](https://app.codecov.io/gh/imanuelcostigan/dataonderivatives?branch=master)

You can source OTC derivatives data from supported sources. Supported sources include BloombergSEF and several U.S. domiciled SDRs including DTCC's DDR, Bloomberg's SDR and CME. SDRs in other jurisdictions do not provide trade level data and consequently these sources are unsupported. Further sources that provide trade level data will be added over time (and pull requests to that end are welcome).

## Usage

You can download daily trade data executed on the BloombergSEF:

```{r bsef}
library("dataonderivatives")
bsef(as.Date("2021-12-13"), asset_class = "IR")
# Get more than one day's data
bsef(as.Date("2021-12-13"), as.Date("2021-12-17"), asset_class = "IR")
```

You can also download the data reported to the DTCC's and CME's SDRs:

```{r ddr}
ddr(as.Date("2021-12-13"), "IR")
cme(as.Date("2021-12-13"), "CO")
```