knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
tasi
The goal of tasi
is to provide the missing API to obtain historical prices for Saudi stocks and TASI (Tadawul All Share Index) as well as easy access to the released financial statements
Currently tasi
is only available on github. You can install the latest version of tasi
with:
devtools::install_github("Hussain-Alsalman/tasi")
This is a basic example which shows you how to obtain and plot TASI historical performance for the past year:
library("tasi") library("ggplot2") library("magrittr") df <- get_index_records("2021-01-01","2022-12-31") df %>% ggplot(mapping = aes(x = as.POSIXct(transactionDate), y = previousClosePrice)) + geom_line() + labs(title = "Historical data for tasi index 2021-2022", x = "Date", y = "TASI index") + theme_classic()
This is more sophisticated example using quantmod
package to create candlesticks chart
library("quantmod") library("dplyr") library("xts") library("tasi") # Performance of Saudi Aramco company stock comp_df <- get_company_records("2020-07-01","2021-02-06",company_symbol = 2222) comp_df %>% df_to_xts() %>% chart_Series()
Now you can extract any financial statement for any specified company in the Saudi Market. Let see how can we easily extract an income statement for a company
library("tasi") library("dplyr") income_df <- get_income_statement(1180, period_type = "q") # q stands for quarterly. opts <- options(knitr.kable.NA = "-") income_df %>% knitr::kable(format.args = list(big.mark = ",", scientific = FALSE)) options(opts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.