library(magrittr) knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The goal of CSE (Casablanca Stock Exchange) is to simplify financial programming workflow with Casablanca stock exchange data.
Currently, it implements 3 mains functions:
listed_symbols
: Returns all listed symbols (stocks, indexes, or both) in Casablanca stock exchange.
get_symbol
: Returns a symbol historical data corresponding to a specific date range.
ipo_date
: Returns a symbol IPO (Initial Public Offering) date.
all_stocks <- CSE::listed_symbols(type = "stock") all_stocks %>% length()
dplyr::data_frame(Firm = all_stocks) %>% head(n = 10) %>% knitr::kable()
all_indexes <- CSE::listed_symbols(type = "index") all_indexes %>% nrow()
all_indexes %>% head(n = 10) %>% knitr::kable()
firm_sample <- all_stocks %>% sample(size = 5) ipo_dates <- firm_sample %>% purrr::map(CSE::ipo_date) dplyr::data_frame(Firm = firm_sample, IPO_Date = do.call(c, ipo_dates)) %>% knitr::kable()
iam <- CSE::get_symbol("ITISSALAT AL-MAGHRIB", "2016-01-01", "2018-07-16", type = "stock") masi <- CSE::get_symbol("MASI", "2016-01-01", "2018-07-16", type = "index")
dim(iam) dim(masi) xts::first(iam, n = 5) xts::last(iam, n = 5) xts::first(masi, n = 5) xts::last(masi, n = 5)
plot(masi, main = "MASI Historical Values") plot(iam$Adjusted, main = "IAM Historical Adjusted Prices")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.