Learn R Programming


title: "Library BRVM" date: "14 février,2024" output: html_document: toc: yes fig_caption: yes keep_md: yes fig_width: 8 fig_height: 6 word_document: toc: yes pdf_document: toc: yes latex_engine: lualatex always_allow_html: true

BRVM

Description {.tabset}

English

This R package provides a user-friendly interface for accessing data from the BRVM, which is a regional stock exchange serving multiple West African countries. With this package, users can easily retrieve historical stock price data, trading volumes, and other financial indicators for a variety of stocks traded on the BRVM.

The package is designed to simplify the process of gathering and analyzing financial data, making it easier for researchers, investors, and other users to extract insights and make informed decisions based on the information available. Overall, BRVM library is a valuable tool for anyone looking to gain a better understanding of the BRVM and the financial markets in West Africa.

Français

Ce package R fournit une interface conviviale pour accéder aux données de la BRVM, qui est une bourse régionale desservant plusieurs pays d'Afrique de l'Ouest. Avec ce package, les utilisateurs peuvent facilement récupérer des données historiques sur les prix des actions, les volumes de transactions et d'autres indicateurs financiers pour une variété d'actions négociées sur la BRVM.

Le package est conçu pour simplifier le processus de collecte et d'analyse de données financières, ce qui facilite la tâche des chercheurs, des investisseurs et d'autres utilisateurs pour extraire des informations et prendre des décisions éclairées en se basant sur les informations disponibles. Dans l'ensemble, notre package R est un outil précieux pour quiconque cherche à mieux comprendre la BRVM et les marchés financiers en Afrique de l'Ouest.

Installation guidelines

You can install using CRAN version

install.packages("BRVM")

You can install the development version of BRVM from github with:

# github dev version
## We can use devtools
# install.packages("devtools")
devtools::install_github("Koffi-Fredysessie/BRVM")

# Or use remotes
# install.packages("remotes")
remotes::install_github("Koffi-Fredysessie/BRVM")

Html version of the Readme

Since the size of the readme is huge due to the charts, you can visit the html version of the readme on RPubs

library(BRVM)

The BRVM_ticker_desc() function

It receives no argument and returns BRVM tickers information such as its full name, sector and country.

# Display tickers of BRVM
tickers <- BRVM_ticker_desc()
tickers

The BRVM_index() function :

It receives no argument and returns a table of updated data (with as table header: indexes, previous closing, closing, change (%), Year to Date Change) on all the indices available on the BRVM exchange.

the_index <- BRVM_index() 
the_index

The BRVM_get(".symbol", ".from", ".to") function

This function will get the data of the companies listed on the BVRM stock exchange in Rich Bourse website. The function takes a single parameter, .symbol (which represents the "Ticker"). The function will automatically format tickers you enter in uppercase using toupper() and then ensure that the passed ticker is in a Google spreadsheet of allowed tickers.

  • .symbol : A vector of symbols, like: c("BICC","XOM","SlbC") ;
  • .from : A quoted start date, ie. "2020-01-01" or "2020/01/01". The date must be in ymd format "YYYY-MM-DD" or "YYYY/MM/DD" ;
  • .to : A quoted end date, ie. "2022-01-31" or "2022/01/31". The date must be in ymd format "YYYY-MM-DD" or "YYYY/MM/DD".

#' Displaying data of SONATEL Senegal stock
BRVM_get(.symbol = "snts")
#> # A tibble: 246 × 6
#>    Date        Open  High   Low Close Volume
#>    <date>     <dbl> <dbl> <dbl> <dbl>  <dbl>
#>  1 2023-02-14 15275 15300 15275 15300  10529
#>  2 2023-02-15 15400 15400 15305 15305   7023
#>  3 2023-02-16 15350 15350 15300 15300  22423
#>  4 2023-02-17 15400 15400 15300 15300  18325
#>  5 2023-02-20 15305 15395 15305 15395   4011
#>  6 2023-02-21 15395 15400 15395 15400   6237
#>  7 2023-02-22 15400 15440 15400 15440   4015
#>  8 2023-02-23 15440 15440 15400 15400  71763
#>  9 2023-02-24 15500 15690 15500 15690  22593
#> 10 2023-02-27 15700 15945 15700 15945  47984
#> # ℹ 236 more rows

symbols <- c("BiCc","XOM","SlbC")   # We use here three tickers
data_tbl <- BRVM_get(.symbol = symbols, .from = "2020-01-01", .to = Sys.Date() - 1)

# Display the first twenty observations of the table
head(data_tbl, 20)
#> # A tibble: 20 × 7
#>    Date        Open  High   Low Close Volume Ticker
#>    <date>     <dbl> <dbl> <dbl> <dbl>  <dbl> <chr> 
#>  1 2020-01-10  6500  6500  6500  6500     24 BICC  
#>  2 2020-01-13  6370  6500  6370  6500     29 BICC  
#>  3 2020-01-14  6495  6495  6495  6495     10 BICC  
#>  4 2020-01-29  6010  6010  6010  6010     24 BICC  
#>  5 2020-01-30  6000  6000  6000  6000     50 BICC  
#>  6 2020-02-04  5800  5800  5800  5800     12 BICC  
#>  7 2020-02-07  5650  5650  5650  5650      5 BICC  
#>  8 2020-02-10  5500  5500  5500  5500      5 BICC  
#>  9 2020-02-14  5300  5300  5300  5300      9 BICC  
#> 10 2020-02-17  4910  4910  4910  4910    210 BICC  
#> 11 2020-02-18  4910  4910  4910  4910     50 BICC  
#> 12 2020-02-20  4895  4895  4895  4895      5 BICC  
#> 13 2020-02-21  4895  4895  4890  4890     13 BICC  
#> 14 2020-02-25  4525  4525  4525  4525     16 BICC  
#> 15 2020-02-26  4435  4435  4430  4430     21 BICC  
#> 16 2020-02-27  4345  4760  4335  4760   1809 BICC  
#> 17 2020-03-03  4745  4750  4745  4750     11 BICC  
#> 18 2020-03-05  4700  4700  4700  4700      5 BICC  
#> 19 2020-03-06  4695  4695  4695  4695      6 BICC  
#> 20 2020-03-11  4345  4450  4345  4450    135 BICC


# Display the last twenty elements of the table
tail(data_tbl, 20)
#> # A tibble: 20 × 7
#>    Date        Open  High   Low Close Volume Ticker
#>    <date>     <dbl> <dbl> <dbl> <dbl>  <dbl> <chr> 
#>  1 2023-12-14 88200 90000 88200 90000      4 SLBC  
#>  2 2023-12-15 90000 90000 90000 90000      5 SLBC  
#>  3 2023-12-18 89000 90000 89000 89000      1 SLBC  
#>  4 2023-12-19 89000 89000 85000 85000    716 SLBC  
#>  5 2023-12-20 79000 90000 85000 89900     10 SLBC  
#>  6 2023-12-22 90000 90000 89900 90000      1 SLBC  
#>  7 2023-12-26 83300 90000 83300 88495      3 SLBC  
#>  8 2023-12-27 88500 88500 88495 88500      1 SLBC  
#>  9 2023-12-28 83300 88500 83300 87000     13 SLBC  
#> 10 2024-01-02 87000 90000 87000 90000      2 SLBC  
#> 11 2024-01-04 89500 90000 89500 89500      5 SLBC  
#> 12 2024-01-11 88000 89500 88000 88000    160 SLBC  
#> 13 2024-01-12 88000 89500 88000 89500     11 SLBC  
#> 14 2024-01-15 89500 89500 88000 88000     13 SLBC  
#> 15 2024-01-16 89500 89500 88000 89500      4 SLBC  
#> 16 2024-01-19 89500 89500 88050 88050     14 SLBC  
#> 17 2024-01-23 88950 88950 88050 88950      5 SLBC  
#> 18 2024-01-25 88935 88950 88940 88940      2 SLBC  
#> 19 2024-02-09 82270 88940 82270 88500     29 SLBC  
#> 20 2024-02-13 88495 88500 88495 88495      1 SLBC

The BRVM_get1("ticker ", "Period", "from", "to") function

This function will get data of the companies listed on the BVRM stock exchange through the sikafinance site. The function takes in a single parameter of ticker and will auto-format the tickers you input into all upper case by using toupper()

  • ticker : A vector of ticker, like: c("BICC","XOM","SlbC", "BRvm10");
  • Period : Numeric number indicating time period. Valid entries are 0, 1, 5, 30, 91, and 365 representing respectively 'daily', 'one year', 'weekly', 'monthly', 'quarterly' and 'yearly';
  • from : A quoted start date, ie. "2020-01-01" or "2020/01/01". The date must be in ymd format "YYYY-MM-DD" or "YYYY/MM/DD";
  • to : A quoted end date, ie. "2022-01-31" or "2022/01/31". The date must be in ymd format "YYYY-MM-DD" or "YYYY/MM/DD"

** NB : There is a small difference between the BRVM_get and BRVM_get1 functions.

  • With BRVM_get it is only possible to download tickers' daily data.
  • But with BRVM_get1, you can download daily, weekly, monthly, annual tickers’ data, indices and even market capitalization.
#' Displaying data of SONATEL Senegal stock
BRVM_get1("snts")
#> # A tibble: 63 × 5
#>    Date        Open  High   Low Close
#>    <date>     <int> <int> <int> <int>
#>  1 2023-11-17 17095 17150 17095 17150
#>  2 2023-11-20 17160 17160 17090 17090
#>  3 2023-11-21 17090 17195 17090 17195
#>  4 2023-11-22 17000 17245 17000 17245
#>  5 2023-11-23 17000 17295 17000 17295
#>  6 2023-11-24 17200 17295 17200 17295
#>  7 2023-11-27 17000 17295 17000 17295
#>  8 2023-11-28 17295 17295 17200 17200
#>  9 2023-11-29 17200 17200 17200 17200
#> 10 2023-11-30 17195 17200 17195 17200
#> # ℹ 53 more rows

# Get daily data of all indexes
all_ind <- BRVM_get1("ALL INDEXES", Period = 0, from = "2020-01-04", to = "2023-03-24") 

# display the first two tens elements of the table
head(all_ind, 20)
#> # A tibble: 20 × 7
#>    Date        Open  High   Low Close Volume Ticker
#>    <date>     <dbl> <dbl> <dbl> <dbl>  <dbl> <chr> 
#>  1 2022-12-26  293.  293.  293.  293.      0 BRVMAG
#>  2 2022-12-27  292.  292.  292.  292.      0 BRVMAG
#>  3 2022-12-28  285.  285.  285.  285.      0 BRVMAG
#>  4 2022-12-29  285.  285.  285.  285.      0 BRVMAG
#>  5 2022-12-30  284.  284.  284.  284.      0 BRVMAG
#>  6 2023-01-02  283.  283.  283.  283.      0 BRVMAG
#>  7 2023-01-03  281.  281.  281.  281.      0 BRVMAG
#>  8 2023-01-04  275.  275.  275.  275.      0 BRVMAG
#>  9 2023-01-05  279.  279.  279.  279.      0 BRVMAG
#> 10 2023-01-06  269.  269.  269.  269.      0 BRVMAG
#> 11 2023-01-09  276.  276.  276.  276.      0 BRVMAG
#> 12 2023-01-10  276.  276.  276.  276.      0 BRVMAG
#> 13 2023-01-11  276.  276.  276.  276.      0 BRVMAG
#> 14 2023-01-12  275.  275.  275.  275.      0 BRVMAG
#> 15 2023-01-13  275.  275.  275.  275.      0 BRVMAG
#> 16 2023-01-16  273.  273.  273.  273.      0 BRVMAG
#> 17 2023-01-17  273.  273.  273.  273.      0 BRVMAG
#> 18 2023-01-18  271.  271.  271.  271.      0 BRVMAG
#> 19 2023-01-19  281.  281.  281.  281.      0 BRVMAG
#> 20 2023-01-20  281.  281.  281.  281.      0 BRVMAG

# display the two tens of the last elements of the table
tail(all_ind, 20)
#> # A tibble: 20 × 7
#>    Date          Open    High     Low   Close Volume Ticker
#>    <date>       <dbl>   <dbl>   <dbl>   <dbl>  <dbl> <chr> 
#>  1 2020-02-26 4281311 4281311 4281311 4281311      0 CAPIB 
#>  2 2020-02-27 4314933 4314933 4314933 4314933      0 CAPIB 
#>  3 2020-02-28 4346515 4346515 4346515 4346515      0 CAPIB 
#>  4 2020-03-02 4424073 4424073 4424073 4424073      0 CAPIB 
#>  5 2020-03-03 4379647 4379647 4379647 4379647      0 CAPIB 
#>  6 2020-03-04 4369550 4369550 4369550 4369550      0 CAPIB 
#>  7 2020-03-05 4342229 4342229 4342229 4342229      0 CAPIB 
#>  8 2020-03-06 4359879 4359879 4359879 4359879      0 CAPIB 
#>  9 2020-03-09 4338293 4338293 4338293 4338293      0 CAPIB 
#> 10 2020-03-10 4357221 4357221 4357221 4357221      0 CAPIB 
#> 11 2020-03-11 4332656 4332656 4332656 4332656      0 CAPIB 
#> 12 2020-03-12 4318096 4318096 4318096 4318096      0 CAPIB 
#> 13 2020-03-13 4318112 4318112 4318112 4318112      0 CAPIB 
#> 14 2020-03-16 4285184 4285184 4285184 4285184      0 CAPIB 
#> 15 2020-03-17 4301727 4301727 4301727 4301727      0 CAPIB 
#> 16 2020-03-18 4288582 4288582 4288582 4288582      0 CAPIB 
#> 17 2020-03-19 4207231 4207231 4207231 4207231      0 CAPIB 
#> 18 2020-03-20 4209788 4209788 4209788 4209788      0 CAPIB 
#> 19 2020-03-23 4154445 4154445 4154445 4154445      0 CAPIB 
#> 20 2020-03-24 4144325 4144325 4144325 4144325      0 CAPIB

# To get yearly data
yearly_data <- BRVM_get1(c("brvmtr", "BiCc", "BOAS"), Period = 365 ) 

# display the first two tens elements of the table
head(yearly_data, 20) 
#> # A tibble: 20 × 6
#>    Date         Open   High    Low  Close Ticker
#>    <date>      <dbl>  <dbl>  <dbl>  <dbl> <chr> 
#>  1 2004-02-19   76.8   89.2   72.9   89.2 BRVMTR
#>  2 2005-01-03   89.2  107.    70.7  104.  BRVMTR
#>  3 2006-01-02  104.   158.   104.   153.  BRVMTR
#>  4 2007-01-02  153.   275.   149.   249.  BRVMTR
#>  5 2008-01-02  249.   386.   226.   296.  BRVMTR
#>  6 2009-01-02  275.   296.   227.   236.  BRVMTR
#>  7 2010-01-04  236.   259.   224.   238.  BRVMTR
#>  8 2011-01-03  238.   249.   204.   239   BRVMTR
#>  9 2012-01-02  239    349.   201.   349.  BRVMTR
#> 10 2013-01-02  349.   794.   339.   789.  BRVMTR
#> 11 2014-01-02  789.  1213.   601.  1213.  BRVMTR
#> 12 2015-01-02 1213.  1525.   653.  1525.  BRVMTR
#> 13 2016-01-04 1525.  1525.  1216.  1432.  BRVMTR
#> 14 2017-01-02 1432.  1433.   764.  1203.  BRVMTR
#> 15 2018-01-02 1114.  1193.   966.   966.  BRVMTR
#> 16 2019-06-03  403.   429.   311.   367.  BRVMTR
#> 17 2020-01-01  367.   475.   292.   379.  BRVMTR
#> 18 2021-01-04  376.   622.   325    622.  BRVMTR
#> 19 2022-01-03  667.   667.   295.   342.  BRVMTR
#> 20 2023-01-02  341.   414.   307.   331.  BRVMTR

# display the two tens of the last elements of the table
tail(yearly_data, 20) 
#> # A tibble: 20 × 6
#>    Date        Open  High   Low Close Ticker
#>    <date>     <dbl> <dbl> <dbl> <dbl> <chr> 
#>  1 2016-01-04 10000 10700  8566  9890 BICC  
#>  2 2017-01-05  9750 10000  6440  8490 BICC  
#>  3 2018-01-02  8700  8750  3795  7900 BICC  
#>  4 2019-01-04  7550  7550  3710  6800 BICC  
#>  5 2020-01-01  6800  6890  2855  6680 BICC  
#>  6 2021-01-04  6680  7525  4280  7400 BICC  
#>  7 2022-01-03  7250  7250  5550  6850 BICC  
#>  8 2023-01-02  6500  7495  5785  7490 BICC  
#>  9 2024-01-04  7450  7485  6900  7445 BICC  
#> 10 2014-12-10  1613  3225  1613  3225 BOAS  
#> 11 2015-01-02  3370  4300  2900  3950 BOAS  
#> 12 2016-01-04  3700  4101  2000  2350 BOAS  
#> 13 2017-01-02  2325  3875  2035  2500 BOAS  
#> 14 2018-01-02  2400  3250  1700  2020 BOAS  
#> 15 2019-01-02  1900  2000  1500  1545 BOAS  
#> 16 2020-01-01  1550  1700  1295  1495 BOAS  
#> 17 2021-01-04  1480  2750  1340  2350 BOAS  
#> 18 2022-01-03  2350  2780  2200  2450 BOAS  
#> 19 2023-01-02  2580  3650  2175  3200 BOAS  
#> 20 2024-01-01  3200  3400  3000  3050 BOAS

The BRVM.index() function :

It receives no argument and returns the name of all indexes available on BRVM Stock Exchange.

BRVM.index()
#>  [1] "BRVMAG" "BRVMC"  "BRVMAS" "BRVMDI" "BRVMFI" "BRVMIN" "BRVMSP" "BRVMTR"
#>  [9] "BRVMPR" "BRVMPA" "BRVM30"

The BRVM_bySector(".sectors") function :

This function will take in the name of sector(s) and returns data for companies belonging to that/those sector(s)

  • .sectors : A vector of sectors you wish to have returned.
# Get informations about brvm sectors like other and agriculture sectors
BRVM_bySector(.sectors = c("Other", "Agriculture"))
#> # A tibble: 6 × 8
#>   Ticker `Company name`  Volume `Previous price`  Open Close `Change (%)` Sector
#>   <chr>  <chr>            <dbl>            <dbl> <dbl> <dbl>        <dbl> <chr> 
#> 1 STAC   SETAO COTE D'I…      0              855     0   855         0    Other 
#> 2 PALC   PALM COTE D'IV…    171             6550  6550  6800         0    Agric…
#> 3 SCRC   SUCRIVOIRE COT…    321              470   470   470        -5.05 Agric…
#> 4 SICC   SICOR COTE D'I…      0             3600     0  3600         0    Agric…
#> 5 SOGC   SOGB COTE D'IV…   3956             3050  3050  3050        -0.97 Agric…
#> 6 SPHC   SAPH COTE D'IV…    169             2245  2100  2245        -0.22 Agric…

The BRVM_stock_market(".weekday") function :

This function receives as input a day of the week (working day) and returns the official quotation revews of that day.

  • .weekday : A quoted date, ie. "2022-01-31" or "2022/01/31". The date must be in ymd format "YYYY-MM-DD" or "YYYY/MM/DD". Must not be a weekend or a holiday.
# The BOC of 2022-02-23
BRVM_stock_market("2022-02-23")

Copy Link

Version

Install

install.packages('BRVM')

Monthly Downloads

290

Version

5.3.0

License

MIT + file LICENSE

Maintainer

Sessie Koffi Frederic

Last Published

February 21st, 2024

Functions in BRVM (5.3.0)

company_sector

Company's sector - To know the sector of a given company
company_cap

Company capitalization - To know the capitalization of a given company
company_traded_val

Brvm Company traded volume value - To know the traded volume value of each company
%>%

Pipe operator
normality_test

Normality test with univariate data
company_nbrank

BRVM get company rank - Get a ticker rank according to brvm quote
company_country

Company's country - To know the country of a given company
stationarity_test

Stationarity test with univariate data
tidyeval

Tidy eval helpers
BRVM_company_url

BRVM company url
BRVM_get

BRVM Get - Get Ticker Data
BRVM_get1

BRVM Get - Get BRVM stock exchange Ticker Data
BRVM_cap

BRVM Capitalization
BRVM_company_cap

BRVM companies capitalization value - To get the capitalization value data of all companies listed on BRVM stock exchange
BRVM_bySector

BRVM By Sector
BRVM_company_info

BRVM Get info about a ticker beta, RSI, Closing, Valorisation, etc.
BRVM.index

BRVM Available Indexes
BRVM_direction

BRVM Rank
BRVM_company_rank

BRVM Companies Rank - Get all tickers rank according to last quotation
BRVM_stock_market

BRVM Official Quotation reviews
BRVM_rank

BRVM_rank - Get top or flop data of BRVM stock exchange
BRVM_plot

BRVM PLOT
BRVM_market_activity

BRVM MARKET ACTIVITIES
BRVM_index

BRVM Get - Get BRVM indexes Data
BRVM_index_stock

BRVM index stock - Given a set of indexes, return their stock data
BRVM_tickers

BRVM Tickers - Information about listed companies on BRVM Stock exchange
BRVM_ticker_desc

BRVM ticker description - BRVM ticker information
BRVM_traded_val

BRVM traded value - To get the traded volume value data of all companies listed on BRVM stock exchange