-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
112 lines (79 loc) · 2.89 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
library(magrittr)
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
[![Project Status: Moved to https://github.com/bilnash/RCSE – The project has been moved to a new location, and the version at that location is no longer working due to changes in Casablanca Stock Exchange API.](https://www.repostatus.org/badges/latest/moved.svg)](https://www.repostatus.org/#moved)
# <span style="color:red">Warning:</span> The project has been moved to a new location, and the version at that location is no longer working due to changes in Casablanca Stock Exchange API. New version is available at [[https://github.com/bilnash/RCSE](https://github.com/bilnash/RCSE)
# CSE
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.
## Installation
You can install CSE from github with:
* Quick Installation without vignette:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("bilnash/CSE", build_vignettes = FALSE)
```
* Installation with vignette:
```{r gh-installation2, eval = FALSE}
# install.packages("devtools")
devtools::install_github("bilnash/CSE", build_vignettes = TRUE)
```
## Documentation
Please refer to the package vignette:
```{r documentation, eval = FALSE}
vignette("cse_vignette", package = "CSE")
```
Also available at: https://bilnash.github.io/CSE/vignettes/cse_vignette.html
## Basic Example
This is a basic example which shows you how to use CSE:
```{r listed_stocks}
listed_stocks <- CSE::listed_symbols(type = "stock")
available_indexes <- CSE::listed_symbols(type = "index")
```
```{r, eval=FALSE}
sample(listed_stocks, size = 6L)
```
```{r, echo=FALSE}
sample(listed_stocks, size = 6L) %>%
dplyr::tibble(Stock = .) %>%
knitr::kable()
```
```{r, eval=FALSE}
head(available_indexes)
```
```{r, echo=FALSE}
head(available_indexes) %>%
knitr::kable()
```
```{r historical_stocks}
cosumar_data <- CSE::get_symbol(symbol = "COSUMAR", from = "2015-01-01", to = "2021-09-29",
type = "stock", format.as.xts = FALSE)
masi_data <- CSE::get_symbol(symbol = "MASI", from = "2015-01-01", to = "2021-09-29",
type = "index", format.as.xts = FALSE)
```
```{r, eval=FALSE}
head(cosumar_data)
```
```{r, echo=FALSE}
head(cosumar_data) %>%
knitr::kable()
```
```{r, eval=FALSE}
tail(masi_data)
```
```{r, echo=FALSE}
tail(masi_data) %>%
knitr::kable()
```