Currencies Analysis (beta)

This commit is contained in:
codez0mb1e 2022-03-29 09:12:29 +00:00
parent dfd136c380
commit 94f079e469
2 changed files with 2035 additions and 22 deletions

View File

@ -9,11 +9,14 @@ 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 ~~the most promised cryptotokens~~ currencies.***
## Set envinroment :earth_asia: ## Prepare
Install packages and set environment :earth_asia:
`install.packages("azuremlsdk")` `install.packages("azuremlsdk")`
```{r set_envinroment, message=FALSE} ```{r set_envinroment, message=FALSE}
suppressPackageStartupMessages({
library(dplyr) library(dplyr)
library(tidyr) library(tidyr)
@ -27,25 +30,33 @@ library(glue)
library(ggplot2) library(ggplot2)
library(azuremlsdk) library(azuremlsdk)
})
```
## set params
```{r set_params}
.azureml_dataset_name <- "Currencies" .azureml_dataset_name <- "Currencies"
```
## connect to Azure ML workspace
Connect to Azure ML workspace:
```{r azureml_connect}
ws <- azuremlsdk::load_workspace_from_config() ws <- azuremlsdk::load_workspace_from_config()
sprintf( sprintf(
"%s workspace located in %s region", ws$name, ws$location "%s workspace located in %s region", ws$name, ws$location
) )
``` ```
## Load dataset
## Load dataset
```{r get_azure_dataset} ```{r get_azure_dataset}
currencies_ds <- azuremlsdk::get_dataset_by_name(ws, name = .azureml_dataset_name) currencies_ds <- azuremlsdk::get_dataset_by_name(ws, name = .azureml_dataset_name)
currencies_ds$name currencies_ds$name
currencies_ds$description currencies_ds$description
``` ```
Get USD/RUB top higher rates:
```{r prepare_dataframe} ```{r prepare_dataframe}
quotes_df <- currencies_ds$to_pandas_dataframe() quotes_df <- currencies_ds$to_pandas_dataframe()
@ -71,6 +82,10 @@ quotes_df %>%
) )
``` ```
## Preprocessing data
Calculate `Return` and `Log Return` for last 10 years:
```{r preprocessing} ```{r preprocessing}
quotes_df %<>% quotes_df %<>%
transmute( transmute(
@ -125,7 +140,7 @@ quotes_stats %>%
gt() %>% gt() %>%
tab_header( tab_header(
title = "Least Volatility Currencies", title = "The Least Volatile Currencies",
subtitle = glue("{min(quotes_df$date)} to {max(quotes_df$date)}") subtitle = glue("{min(quotes_df$date)} to {max(quotes_df$date)}")
) %>% ) %>%
fmt_number( fmt_number(
@ -138,7 +153,7 @@ My broker available pairs:
symbols <- c( symbols <- c(
'RUB', 'RUB',
'EUR', 'GBP', 'CHF', 'CNY', 'HKD', 'JPY', 'SEK', 'SGD', 'AUD', 'EUR', 'GBP', 'CHF', 'CNY', 'HKD', 'JPY', 'SEK', 'SGD', 'AUD',
'KZT', 'BYN', 'TRY', 'MXN' 'AED', 'KZT', 'BYN', 'TRY', 'MXN'
) )
quotes_stats %>% quotes_stats %>%
@ -147,14 +162,13 @@ quotes_stats %>%
) %>% ) %>%
mutate( mutate(
`100x Volatility` = volatility*100 `100x Volatility` = volatility*100
#risk = if_else(volatility > volatility_threshold, "High", "Medium or low", NA_character_)
) %>% ) %>%
arrange(volatility) %>% arrange(volatility) %>%
select(-volatility) %>% select(-volatility) %>%
gt() %>% gt() %>%
tab_header( tab_header(
title = "Least Volatility Currencies", title = "The Most Promised Currencies",
subtitle = glue("{min(quotes_df$date)} to {max(quotes_df$date)}") subtitle = glue("{min(quotes_df$date)} to {max(quotes_df$date)}")
) %>% ) %>%
fmt_number( fmt_number(

1999
src/fx_currencies_anlysis.md Normal file

File diff suppressed because it is too large Load Diff