Learn R Programming

⚠️There's a newer version (1.3.7) of this package.Take me there.

Purpose

  • Purposely designed functions for trading, trading analytics and risk practitioners in in Commodities and Finance.
  • Build to support delivery of Finance classes from one of the co-authors of RTL at the Alberta School of Business.

Features

  • Historical forward curves charting.

  • Calendars and expiry dates data objects for a wide range of commodity futures contracts.

  • Function to adjust continuous contracts returns for roll adjustments using expiries above.

  • Morningstar Marketplace API functions getPrice() and getPrices() using your own Morningstar credentials. Current feeds included:

    • ICE_EuroFutures and ICE_EuroFutures_continuous.
    • CME_NymexFutures_EOD and CME_NymexFutures_EOD_continuous.
    • CME_NymexOptions_EOD.
    • CME_CbotFuturesEOD and CME_CbotFuturesEOD_continuous.
    • CME_CmeFutures_EOD and CME_CmeFutures_EOD_continuous.
    • CME_STLCPC_Futures.
    • ICE_NybotCoffeeSugarCocoaFutures and ICE_NybotCoffeeSugarCocoaFutures_continuous.
    • Morningstar_FX_Forwards.
    • ... see ?getPrice for up to date selection and examples.
  • chart_zscore() supports seasonality adjusted analysis of residuals, particularly useful when dealing with commodity stocks and/or days demand time series with trends as well as non-constant variance across seasonal periods.

Data Sets

Accessible via data(datsetname)

  • expiry_table: Historical and forward futures contract metadata.
  • holidaysOil: Holiday calendars for ICE and NYMEX.
  • tickers_eia: Mapping of EIA tickers to crude and refined products markets for building supply demand balances.
  • usSwapIRDef: Data frame of definitions for instruments to build a curve for use with RQuantlib. Use getIRswapCurve() to extract the latest data from FRED and Morningstar.
  • usSwapIR: Sample data set output of getIRswapCurve.
  • usSwapCurves: Sample data set output of RQuantlib::DiscountCurve().
  • cancrudeassays contains historical Canadian crude assays by batch from Crudemonitor. cancrudeassayssum is a summarised average assays version.
  • crudeassaysXOM for all publicly available complete assays in Excel format from ExxonMobil
  • crudeassaysBP for all publicly available complete assays in Excel format from BP
  • eiaStocks: Sample data set of EIA.gov stocks for key commodiities.
  • eiaStorageCap: EIA crude storage capacity by PADD.
  • dflong and dfwide contain continuous futures prices sample data sets for Nymex (CL, HO, RB and NG contracts) and ICE Brent.
  • crudepipelines and refineries contain GIS information in the North American crude space.
  • twtrump and twoott are historical tweets toy data sets from @realDonaldTrump and #OOTT for learning NLP.

Python

A python wrapper for some functions is available at https://github.com/bbcho/pyRTL

Installation

Latest Package devtools::install_github("risktoollib/RTL")

CRAN Stable install.packages("RTL")

Credentials

Usernames and password for API services are required.

Copy Link

Version

Install

install.packages('RTL')

Monthly Downloads

395

Version

0.1.3

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Philippe Cote

Last Published

June 7th, 2020

Functions in RTL (0.1.3)

cancrudeprices

cancrudeprices
npv

npv
usSwapCurves

usSwapCurves
getPrice

getPrice
swapCOM

swapCOM
getPrices

getPrices
stl_decomp

stl_decomp
chart_fwd_curves

chart_fwd_curves
usSwapCurvesPar

usSwapCurvesPar
chart_PerfSummary

chart_PerformanceSummary
expiry_table

expiry_table
holidaysOil

holidaysOil
crudepipelines

crudepipelines
distdescplot

distdescplot
garch

garch
eia2tidy

eia2tidy
ir_df_us

ir_df_us
cancrudeassays

cancrudeassays
cancrudeassayssum

cancrudeassayssum
fitOU

fitOU
chart_pairs

chart_pairs
eiaStocks

eiaStocks
getIRswapCurve

getIRswapCurve
simOU

simOU
simOUJ

simOUJ
twtrump

twtrump
planets

planets
eiaStorageCap

eiaStorageCap
promptBeta

promptBeta
twoott

twoott
tradeCycle

tradeCycle
tradeStats

tradeStats
rolladjust

rolladjust
swapIRS

swapIRS
simGBM

simGBM
tickers_eia

tickers_eia
returns

returns
refineries

refineries
%>%

Pipe operator
usSwapIRdef

usSwapIRdef
usSwapIR

usSwapIR
CRReuro

CRReuro
bond

bond
chart_zscore

chart_zscore
crudeassaysBP

crudeassaysBP
crudeassaysXOM

crudeassaysXOM
crudes

crudes
df_fut

df_fut
dflong

dflong
dfwide

dfwide