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.4.tar.gz (6.6 MB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

risktools-0.2.8.4-cp311-cp311-macosx_10_9_universal2.whl (7.3 MB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

risktools-0.2.8.4-cp310-cp310-macosx_11_0_x86_64.whl (7.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

risktools-0.2.8.4-cp39-cp39-macosx_11_0_x86_64.whl (7.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

risktools-0.2.8.4-cp38-cp38-macosx_11_0_x86_64.whl (7.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

risktools-0.2.8.4-cp37-cp37m-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

risktools-0.2.8.4-cp37-cp37m-macosx_11_0_x86_64.whl (7.2 MB view details)

Uploaded CPython 3.7m macOS 11.0+ x86-64

File details

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

File metadata

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

File hashes

Hashes for risktools-0.2.8.4.tar.gz
Algorithm Hash digest
SHA256 9c97633e325a30c93f45b6301f19ae59ba648ed4628e77641ccc18c39600e564
MD5 b6b853a002e307cb0cec4be27251dcc0
BLAKE2b-256 f1e5123f070923b63b4d877a4b38eabba6de7fe5a844f795e8d3a438742e1348

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 773684d5de573cdffea382f1f6bac76b340ed66d77589d31864a12e4b3ab221a
MD5 c47f5e36f1bfe4537533b27b317f56ee
BLAKE2b-256 964787a9803cb25c58b1cab9504554cd51869ec79335d29ed2ed9e017a3e255f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd44b67b0d70953fb36a2984bf7fc095d4700db45554b3b1e627c9c015fac989
MD5 0250f143ce9e5bd48e3bead337711d73
BLAKE2b-256 c6f8f046c238fb8ffe0c39f5209a77d55e82d28eed01f02e8cd37711f7a32ca5

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.4-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 193bad617e1adda3905da21aef35bd9d94f2b529e9461b737f4a1049b46427e3
MD5 dd90114027cb8d782655d5b7e406c3c7
BLAKE2b-256 5aef35e478bd9437a3c285a8806804c6ae10c400d1e2bfd82696253ec345c4a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 57e26551807d5cf2a8521bcdbd30facd2cf91cbb5f948dbf87834b3cec73d3c1
MD5 fcfc281982062e2d01f08092ede76196
BLAKE2b-256 4fc480a7d8be5a8606243d3382cd7ed19d0499a0fc9b806ab9ba25cdd5931bf0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ff7db9c33f73c064b92041eb156f663b0d3cbc4cadcc89b0726f7b70aa63889
MD5 0b56ccb2304298573417c0c6c95839a0
BLAKE2b-256 f7375503f617802d27d70ccb2684c97ac5ab857ccad015a238a1beb1c52b655b

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.4-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 5116b9fc0da5176bdf0a3e1eab87942fa9d4534f0c98a2e6014c6e19090c4aba
MD5 3e0a6ca9af454916fc32299a59dd6d60
BLAKE2b-256 d845fbc579a257e8d27f20daf002f236a1b15453bccfab592449e78abc8cc6fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 70cf21f98bc26ae8c3a8280260c5f0ba4d0458514ea1962077a107047552efd4
MD5 35960e9f6eb506da13f443ee2fd7808d
BLAKE2b-256 f52899bddf4552469d0c4f1b7a1de1deafca2b449d2fba91af297f5000b351d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 43d5e6a5dac4c4d842e95568fac77cc51bc889b8085f7d659e93d425f3306ba8
MD5 edc0789978d2cc8591ef9c83d913dac8
BLAKE2b-256 455c9c5458eeaa673f3a8e44331e93624c5ec8df3fa78c77ca669955537898db

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.4-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 ca279ae7e7ac6e71586a97f59aefed23f4ad8acd8ac957701f8a50867e3078fb
MD5 5c66751936d6c6e83076b16708c17eda
BLAKE2b-256 8cc7402cf85f8d457e32fa23c01308987021a560927a5d6fdc00273218e176a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 753762478cddcb86771561a3f36f18c8366e0ee22afbb7b195ae49c2d5152ef1
MD5 bc1542d58fe063958a4c86b60c5b3e6e
BLAKE2b-256 fbc9975c043af99bdb5af202c6e50baa05e08b2e9dbe147b4ca1a63fd7c3632d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17a4d78ed5cd015fb973e245fff654eb75fafa667a993278f3c87ce69623f41c
MD5 b1309189635ecd9b56059cf8912f8e10
BLAKE2b-256 9e4ac4f0359e7b3aa5e0d71a8386ca6b0f99cc254199637871d18cf03db503a8

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.4-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 d505b53d25f966325f181d9620b0c2cf46cc0f2892efc7a3562a98b57dbb631d
MD5 a4fc53a453ba6a8967b7811d2f7c52a1
BLAKE2b-256 9818665a5310d8fd7d467aa07ef7c25812a5d7177fcfbfabb0f272d4d18b0e1d

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.4-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 67eab837df3bdd6197c3546bbd2635268c8094bbad6ccfe9d9fadde68113fd69
MD5 a6a8167a89f47bb35c42899764c1291a
BLAKE2b-256 46d4a4e38f92a39d480b8127abf785afb44fcfddd0742fdff114bafa1d1b5823

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 afcbd7b0e38ce30a39ae859f8ebd9b326109f80f0b476565fd92cb4752c7e5cb
MD5 05140fec23212ee4ae72f3e01fe3356d
BLAKE2b-256 2ba3d4bd9cf7686041c8b8bef29b68e1a6cae54708db1a25870744973abea5c8

See more details on using hashes here.

File details

Details for the file risktools-0.2.8.4-cp37-cp37m-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for risktools-0.2.8.4-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a86aaf94e69fe71785fd08d8e5e67a24aadcc849bf4f33d23de2154d679e1df4
MD5 2361a5a1e0b343ed40b58651cdd7e2ff
BLAKE2b-256 55ec53220ddfb9f7f9450977bf47fc0e815bf5588ed0e04be713f6d96249f88d

See more details on using hashes here.

Supported by

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