mirror of
https://github.com/codez0mb1e/resistance.git
synced 2024-11-25 11:52:21 +00:00
Currencies Analysis (beta)
This commit is contained in:
parent
dfd136c380
commit
94f079e469
@ -9,43 +9,54 @@ 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}
|
||||||
library(dplyr)
|
suppressPackageStartupMessages({
|
||||||
library(tidyr)
|
library(dplyr)
|
||||||
|
library(tidyr)
|
||||||
|
|
||||||
library(lubridate)
|
library(lubridate)
|
||||||
library(stringr)
|
library(stringr)
|
||||||
|
|
||||||
library(gt)
|
library(gt)
|
||||||
library(tidyverse)
|
library(tidyverse)
|
||||||
library(glue)
|
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
1999
src/fx_currencies_anlysis.md
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user