Skip to content

Commit 98a7372

Browse files
committed
getPrice update for Zema
1 parent ee5f667 commit 98a7372

23 files changed

+33
-32
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ Type: Package
22
Package: RTL
33
Title: Risk Tool Library - Trading, Risk, Analytics for Commodities
44
Version: 1.3.7
5-
Date: 2025-07-10
5+
Date: 2025-08-20
66
Authors@R: c(
77
person("Philippe", "Cote", , "[email protected]", role = c("aut", "cre")),
88
person("Nima", "Safaian", , "[email protected]", role = "aut")
99
)
1010
Description: A toolkit for Commodities 'analytics', risk management and
1111
trading professionals. Includes functions for API calls to
12-
<https://commodities.morningstar.com/#/>, <https://developer.genscape.com/>,
12+
<https://www.zema.global/platforms/zema-marketplace>, <https://developer.genscape.com/>,
1313
and <https://www.bankofcanada.ca/valet/docs>.
1414
License: MIT + file LICENSE
1515
URL: https://github.com/risktoollib/RTL

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Enhancement
44
+ `spreadOption` function added for spread options on European option using Kirk's approximation.
55
+ `barrierSpreadPrice` function added for barrier spread options.
6+
+ Morningstar Commodities functions switched to Zema Marketplace.
67

78
## Bugs & Fixes
89

README.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Valid credentials for commercial API services are required.
5353

5454
#### Morningstar Commodities
5555

56-
[Morningstar Marketplace API](https://mp.morningstarcommodity.com/marketplace/) functions:
56+
[Zema Marketplace API](https://www.zema.global/platforms/zema-marketplace) functions:
5757

5858
+ `getPrice()`, `getPrices()` and `getCurve()` using your own Morningstar credentials. Current feeds included:
5959

data-raw/DATASET.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ stocks$uso <- tidyquant::tq_get("USO", adjust = TRUE) %>%
145145
quantmod::adjustOHLC(., use.Adjusted = TRUE) %>%
146146
timetk::tk_tbl(rename_index = "Date") %>%
147147
dplyr::select(-Adjusted) %>%
148-
dplyr::mutate(across(where(is.numeric), round, digits = 2))
148+
dplyr::mutate(across(where(is.numeric), \(x) round(x, digits = 2)))
149149

150150

151151
ry <- tidyquant::tq_get("RY", adjust = TRUE, from = "2000-01-01") %>%
@@ -154,7 +154,7 @@ ry <- tidyquant::tq_get("RY", adjust = TRUE, from = "2000-01-01") %>%
154154
quantmod::adjustOHLC(.,use.Adjusted = TRUE) %>%
155155
timetk::tk_tbl(rename_index = "Date") %>%
156156
dplyr::select(-Adjusted) %>%
157-
dplyr::mutate(across(where(is.numeric), round, digits = 2))
157+
dplyr::mutate(across(where(is.numeric), \(x) round(x, digits = 2)))
158158

159159
dividends <- tidyquant::tq_get("RY", get = "dividends" , from = "2000-01-01",adjust = TRUE)
160160
stocks$ry <- ry %>%
@@ -256,8 +256,8 @@ crude <- RTL::getPrices(
256256
feed = "CME_NymexFutures_EOD_continuous",
257257
contracts = crude,
258258
from = startdate,
259-
iuser = iuser,
260-
ipassword = ipassword
259+
iuser = mstar[[1]],
260+
ipassword = mstar[[2]]
261261
) %>%
262262
pivot_longer(-date, names_to = "series", values_to = "value") %>%
263263
dplyr::mutate(series = stringr::str_replace_all(series, c("_0" = "", "_Month" = ""))) %>%
@@ -267,8 +267,8 @@ crudeICE <- RTL::getPrices(
267267
feed = "ICE_EuroFutures_continuous",
268268
contracts = crudeICE,
269269
from = startdate,
270-
iuser = iuser,
271-
ipassword = ipassword
270+
iuser = mstar[[1]],
271+
ipassword = mstar[[2]]
272272
) %>%
273273
pivot_longer(-date, names_to = "series", values_to = "value") %>%
274274
dplyr::mutate(series = stringr::str_replace_all(series, c("_0" = "", "_Month" = ""))) %>%
@@ -278,8 +278,8 @@ pdts <- RTL::getPrices(
278278
feed = "CME_NymexFutures_EOD_continuous",
279279
contracts = pdts,
280280
from = startdate,
281-
iuser = iuser,
282-
ipassword = ipassword
281+
iuser = mstar[[1]],
282+
ipassword = mstar[[2]]
283283
) %>%
284284
pivot_longer(-date, names_to = "series", values_to = "value") %>%
285285
dplyr::mutate(series = stringr::str_replace_all(series, c("_0" = "", "_Month" = ""))) %>%
@@ -932,7 +932,7 @@ usethis::use_data(expiry_table, overwrite = T)
932932

933933
# cma ---------------------------------------------------------------------
934934

935-
swp <- function(Month = "2023-01-01",
935+
swp <- function(Month = "2025-01-01",
936936
contract = "cmewti",
937937
exchange = "nymex") {
938938
# Pricing days

data-raw/storagecapacity.xlsx

-45.7 KB
Binary file not shown.

data/cushing.rda

1.25 KB
Binary file not shown.

data/dflong.rda

23.2 KB
Binary file not shown.

data/dfwide.rda

26.3 KB
Binary file not shown.

data/eiaStocks.rda

554 Bytes
Binary file not shown.

data/eiaStorageCap.rda

195 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)