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:

Quick Demo

Firms currently listed in Casablanca stock exchange

all_stocks <- CSE::listed_symbols(type = "stock")
all_stocks %>% length()
dplyr::data_frame(Firm = all_stocks) %>%
    head(n = 10) %>%
    knitr::kable()

Available indexes

all_indexes <- CSE::listed_symbols(type = "index")
all_indexes %>% nrow()
all_indexes %>%
    head(n = 10) %>%
    knitr::kable()

IPO Dates

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()

Get Some Historical Data

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")


blnash508/CSE documentation built on May 3, 2019, 11:52 p.m.