diff --git a/src/fx_currencies_analysis.Rmd b/src/fx_currencies_analysis.Rmd index dd966c0..71d3269 100755 --- a/src/fx_currencies_analysis.Rmd +++ b/src/fx_currencies_analysis.Rmd @@ -1,13 +1,19 @@ --- title: "Currencies Analysis" -output: github_document +date: "`r format(Sys.time(), '%d %B, %Y')`" +output: + github_document: + toc: false + toc_depth: 2 + fig_width: 9 + fig_height: 9 --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = T, warning = F) ``` -***Analysis price of the my list of ~~the most promised cryptotokens~~ currencies.*** +***Analysis price of the my list of currencies.*** ## Prepare @@ -16,6 +22,9 @@ Install packages and set environment :earth_asia: `install.packages("azuremlsdk")` ```{r set_envinroment, message=FALSE} +options(max.print = 1e3, scipen = 999, width = 1e2) +options(stringsAsFactors = F) + suppressPackageStartupMessages({ library(dplyr) library(tidyr) @@ -51,12 +60,19 @@ sprintf( ## Load dataset +WARNING: I used `currency exchange rates` data from [Kaggle Dataset](https://www.kaggle.com/datasets/dhruvildave/currency-exchange-rates): + ```{r get_azure_dataset} currencies_ds <- azuremlsdk::get_dataset_by_name(ws, name = .azureml_dataset_name) -currencies_ds$name -currencies_ds$description + +sprintf( + "Dataset name: %s. %s", + currencies_ds$name, + currencies_ds$description +) ``` -Get USD/RUB top higher rates: + +Get `USD/RUB` top higher rates: ```{r prepare_dataframe} quotes_df <- currencies_ds$to_pandas_dataframe() @@ -210,11 +226,20 @@ quotes_df %>% ggplot + geom_line(aes(x = date, y = R, color = symbol)) + + scale_y_continuous(labels = scales::percent_format(accuracy = 1)) + facet_grid(jumper ~ ., scales = "free") + - labs(x = "", y = "Return of Investment", title = "Currencies Exchange Rates", subtitle = "Return of Investment for last 10 years") + - theme_bw() + labs( + title = "Currencies Exchange Rates", subtitle = "Return of Investment for last 10 years", + x = "", y = "Return of Investment", + caption = currencies_ds$description) + + theme_minimal() + + + theme( + legend.position = "top", legend.title = element_blank(), + plot.caption = element_text(size = 8) + ) ``` diff --git a/src/fx_currencies_anlysis.md b/src/fx_currencies_analysis.md similarity index 55% rename from src/fx_currencies_anlysis.md rename to src/fx_currencies_analysis.md index ffc05ce..4d5d04a 100644 --- a/src/fx_currencies_anlysis.md +++ b/src/fx_currencies_analysis.md @@ -1,16 +1,19 @@ Currencies Analysis ================ +04 April, 2022 -***Analysis price of the my list of ~~the most promised cryptotokens~~ -currencies.*** +***Analysis price of the my list of currencies.*** ## Prepare -Install packages and set environment :earth\_asia: +Install packages and set environment :earth asia: `install.packages("azuremlsdk")` ``` r +options(max.print = 1e3, scipen = 999, width = 1e2) +options(stringsAsFactors = F) + suppressPackageStartupMessages({ library(dplyr) library(tidyr) @@ -45,20 +48,22 @@ sprintf( ## Load dataset +WARNING: I used `currency exchange rates` data from [Kaggle +Dataset](https://www.kaggle.com/datasets/dhruvildave/currency-exchange-rates): + ``` r currencies_ds <- azuremlsdk::get_dataset_by_name(ws, name = .azureml_dataset_name) -currencies_ds$name + +sprintf( + "Dataset name: %s. %s", + currencies_ds$name, + currencies_ds$description +) ``` - ## [1] "Currencies" + ## [1] "Dataset name: Currencies. Source: https://www.kaggle.com/datasets/dhruvildave/currency-exchange-rates" -``` r -currencies_ds$description -``` - - ## [1] "Source: https://www.kaggle.com/datasets/dhruvildave/currency-exchange-rates" - -Get USD/RUB top higher rates: +Get `USD/RUB` top higher rates: ``` r quotes_df <- currencies_ds$to_pandas_dataframe() @@ -86,409 +91,7 @@ quotes_df %>% ## Selecting by close -
- @@ -562,7 +165,7 @@ quotes_df %>%
-
+ ## Preprocessing data @@ -625,409 +228,7 @@ quotes_stats %>% ) ``` -
- @@ -1538,7 +739,7 @@ quotes_stats %>%
-
+ My broker trades the following pairs: @@ -1572,409 +773,8 @@ quotes_stats %>% ) ``` -
- @@ -2121,17 +921,27 @@ jumper_symbols <- quotes_stats %>% filter(max_min_rate > 2) %>% pull(symbol) quotes_df %>% filter(symbol %in% low_risk_symbols) %>% mutate( - jumper = if_else(symbol %in% jumper_symbols, T, F) + jumper = if_else(symbol %in% jumper_symbols, "High risk currencies", "Low risk currencies") ) %>% group_by(symbol) %>% mutate(R = cumsum(return)) %>% ggplot + geom_line(aes(x = date, y = R, color = symbol)) + - + scale_y_continuous(labels = scales::percent_format(accuracy = 1)) + + facet_grid(jumper ~ ., scales = "free") + - theme_bw() + labs( + title = "Currencies Exchange Rates", subtitle = "Return of Investment for last 10 years", + x = "", y = "Return of Investment", + caption = currencies_ds$description) + + theme_minimal() + + + theme( + legend.position = "top", legend.title = element_blank(), + plot.caption = element_text(size = 8) + ) ``` -![](fx_currencies_anlysis_files/figure-gfm/unnamed-chunk-3-1.png) +![](fx_currencies_analysis_files/figure-gfm/unnamed-chunk-3-1.png) diff --git a/src/fx_currencies_analysis_files/figure-gfm/unnamed-chunk-3-1.png b/src/fx_currencies_analysis_files/figure-gfm/unnamed-chunk-3-1.png new file mode 100644 index 0000000..ad48797 Binary files /dev/null and b/src/fx_currencies_analysis_files/figure-gfm/unnamed-chunk-3-1.png differ diff --git a/src/fx_currencies_anlysis_files/figure-gfm/unnamed-chunk-3-1.png b/src/fx_currencies_anlysis_files/figure-gfm/unnamed-chunk-3-1.png deleted file mode 100644 index 07aec77..0000000 Binary files a/src/fx_currencies_anlysis_files/figure-gfm/unnamed-chunk-3-1.png and /dev/null differ