Skip to main content

Python implementation of the R package RTL

Project description

risktools

Python implementation of the R package RTL.

See CRAN for original R version

https://cran.r-project.org/web/packages/RTL/index.html

Purpose

Purposely designed functions for trading, trading analytics and risk practitioners 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.

Version Notes

Note that the latest version will require compilation on Windows for python version 3.11 due to the 
dependency on arch. Arch does not come with binaries and must be compiled on Windows which can be
avoided by installing numba, however numba is not yet available for python 3.11.

Features

Historical forward curves charting.

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

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

Morningstar Marketplace API functions getPrice(), getPrices() and getCurve() using your own Morningstar credentials. Current feeds included:
    ICE_EuroFutures
    ICE_EuroFutures_continuous
    CME_NymexFutures_EOD
    CME_NymexFutures_EOD_continuous
    CME_NymexOptions_EOD
    CME_CbotFuturesEOD
    CME_CbotFuturesEOD_continuous
    CME_Comex_FuturesSettlement_EOD
    CME_Comex_FuturesSettlement_EOD_continuous
    LME_AskBidPrices_Delayed
    SHFE_FuturesSettlement_RT
    CME_CmeFutures_EOD
    CME_CmeFutures_EOD_continuous
    CME_STLCPC_Futures
    CFTC_CommitmentsOfTradersCombined
    ICE_NybotCoffeeSugarCocoaFutures
    ICE_NybotCoffeeSugarCocoaFutures_continuous
    Morningstar_FX_Forwards
    ERCOT_LmpsByResourceNodeAndElectricalBus
    PJM_Rt_Hourly_Lmp
    AESO_ForecastAndActualPoolPrice
    LME_MonthlyDelayed_Derived
    … 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.

chart_eia_steo() and chart_eia_sd() return either a chart or dataframe of supply demand balances from the EIA.

chart_spreads() to generate specific contract spreads across years e.g. ULSD March/April. Requires Morningstar credentials.

swapInfo() returns all information required to price first line futures contract averaging swap or CMA physical trade, including a current month instrument with prior settlements.

Data Sets

Accessible via risktools.data.open_data(datsetname). Also use risktools.data.get_names() to get list of available data.

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.
...

Usernames and password for API services are required.

Changelog

Version 0.2.0

New functions added:

  • get_curves
  • get_gis
  • get_ir_swap_curve
  • refineryLP
  • swap_fut_weight
  • swap_info
  • dist_desc_plot

New feeds for get_prices:

  • ERCOT_LmpsByResourceNodeAndElectricalBus
  • PJM_Rt_Hourly_Lmp
  • AESO_ForecastAndActualPoolPrice
  • LME_MonthlyDelayed_Derived
  • SHFE_FuturesSettlement_RT
  • CFTC_CommitmentsOfTradersCombined

New datasets for risktools.data.open_data function

  • Replicated/refreshed RTL datsets

removed geojson files and dependencies to geopandas - replaced with get_gis function removed support for Python 3.6. Supports >= 3.7

Companion package to https://github.com/bbcho/finoptions-dev

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

risktools-0.2.8.7.tar.gz (6.6 MB view details)

Uploaded Source

Built Distributions

risktools-0.2.8.7-cp312-cp312-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.12Windows x86-64

risktools-0.2.8.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

risktools-0.2.8.7-cp311-cp311-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.11Windows x86-64

risktools-0.2.8.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

risktools-0.2.8.7-cp310-cp310-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.10Windows x86-64

risktools-0.2.8.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

risktools-0.2.8.7-cp39-cp39-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.9Windows x86-64

risktools-0.2.8.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

risktools-0.2.8.7-cp38-cp38-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.8Windows x86-64

risktools-0.2.8.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

risktools-0.2.8.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

Details for the file risktools-0.2.8.7.tar.gz.

File metadata

  • Download URL: risktools-0.2.8.7.tar.gz
  • Upload date:
  • Size: 6.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for risktools-0.2.8.7.tar.gz
Algorithm Hash digest
SHA256 57973ce132d85fb03cffbde922f7381269709ba4fc50b457c88266f34a124508
MD5 be8fb744eb3b960e87724acf06cf9415
BLAKE2b-256 a19120df567bdd8fdb97d904f59da21fb095b590fdb3230e6ec1d7a745b6099c

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 02d2cead42d67e6a797430d8de3facf34f13f96536c6e267e2a25ff3cf81b3e1
MD5 de2c3b06ddf655b3d9305c292e81cffc
BLAKE2b-256 d0e0e2bb3c72ca1bcda56510d1c937d8d7b4b4ffc6c25cf932bf1baa5f386b11

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2e31994f33c4ba4eea9dc2545e79c1beba82e02df42fc9a6d7ac7f3c30c896d1
MD5 bc821d4cafa2c5dbd2864dcf779a2758
BLAKE2b-256 94cd903b02aa96ac7167120e344358e0508200990c6cc6f4883b0c51737f29e7

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9066ad6e604b2fd3eb9e3c88493c44b46eb43328204c447d42d5ba07f8a1a613
MD5 8a44a105f18613e4941acae28344480f
BLAKE2b-256 39bd184e3f7ea05a01ed17c96494d1d4128048866a48fa6b0bfa6909db894b62

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fae721c3cd7e82c141489d04ecf2c82c0e028b0184568587b9a99ec112de985d
MD5 9266bc1d1aa2897fc69aad349c28952f
BLAKE2b-256 a2965247c9d010795f5d5ea3cfd00c8cb1fd664e8bfc2b71a523f192061ae26f

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9de3052f7d8d132a7dfca2987ea3554465c6eb8fd55cf167fec828b1d2376b5d
MD5 58191f4c86bb2e00364456388bfa5aac
BLAKE2b-256 87fedf4500806dae01bbd8c53fe4b50cb44492fd2e5830f9ec4d77f65bb4a174

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 98555b75884a5b5aaf8e0d10433aff818fd66bb47fcaca8ccbc338d59b56aabc
MD5 d15e2f271f5b075fb6631172e7faad07
BLAKE2b-256 620e6fe073946de2d6bc40a2389e887a51ca589cfa824c4c48584ede5de9c52a

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: risktools-0.2.8.7-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.13

File hashes

Hashes for risktools-0.2.8.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 34ed2dc0dbd5e7ba8f0bf4b4d28016790c6e2520ce5cf6093ac6e50859db37e9
MD5 bc3a766758627a2f1317e79abdd0e19e
BLAKE2b-256 55c0abfff52f410d3715613ca420238997535876aacbe2fc011c8dfd382d3526

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b5f7bb86a5faa5b1e7786efa0dbddb4fc3591fd5f1e3351bf4430802f067b8bf
MD5 92c53d47855b2b899ab1056f99642eab
BLAKE2b-256 9666e2d25e85fce9c9aaf7df39a51c2c45356e4c17d95ab6b7725a3b90da4000

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: risktools-0.2.8.7-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.8.10

File hashes

Hashes for risktools-0.2.8.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b2e0ea951e594c61a9507d5f43de16eeb1158779802ab3a37d028b3221530a2e
MD5 4150f89fa2c4dd1bb256aa1609bd425e
BLAKE2b-256 772380e80883daeb2fd021a4ac5c9838570671b320372938048af9018f734ad8

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4cdb63968dcda8d1130375e0625e604cfce62f2e2feed9b9a3207c7b0cd5f27a
MD5 2f52a4c55ea6648bc75cca2434c5ee1e
BLAKE2b-256 56a700d92b7aff7394c6d4c815b68dc818f545527198e830d706b594e1b0d6b9

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f620881dd1729ecd9d951481787ff210731132f145b645f0806b2c002bd45910
MD5 92b05827f08acfe7ba5cd5782ab7a940
BLAKE2b-256 2f0c2cffc066ece0d041746729c944bf73e53d882210729760e5afcfdb0cc624

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page