mirror of
https://github.com/codez0mb1e/resistance.git
synced 2024-11-24 11:22:19 +00:00
Update report
This commit is contained in:
parent
94f079e469
commit
e923f5169c
@ -111,7 +111,9 @@ quotes_df %<>%
|
|||||||
na.omit
|
na.omit
|
||||||
```
|
```
|
||||||
|
|
||||||
Base and quote currencies:
|
## Discover Data
|
||||||
|
|
||||||
|
Calculate statistics and `volatility`:
|
||||||
|
|
||||||
```{r discover}
|
```{r discover}
|
||||||
quotes_stats <- quotes_df %>%
|
quotes_stats <- quotes_df %>%
|
||||||
@ -124,14 +126,7 @@ quotes_stats <- quotes_df %>%
|
|||||||
volatility = sd(log_return)
|
volatility = sd(log_return)
|
||||||
)
|
)
|
||||||
|
|
||||||
volatility_threshold <- quotes_stats %>% pull(volatility) %>% quantile(probs = .75)
|
|
||||||
|
|
||||||
|
|
||||||
quotes_stats %>%
|
quotes_stats %>%
|
||||||
filter(
|
|
||||||
volatility <= volatility_threshold |
|
|
||||||
symbol == "USD/RUB"
|
|
||||||
) %>%
|
|
||||||
mutate(
|
mutate(
|
||||||
`100x Volatility` = volatility*100
|
`100x Volatility` = volatility*100
|
||||||
) %>%
|
) %>%
|
||||||
@ -140,14 +135,14 @@ quotes_stats %>%
|
|||||||
|
|
||||||
gt() %>%
|
gt() %>%
|
||||||
tab_header(
|
tab_header(
|
||||||
title = "The Least Volatile Currencies",
|
title = "The Least and The Most 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(
|
||||||
columns = c(max_price, min_price, max_min_rate, `100x Volatility`)
|
columns = c(max_price, min_price, max_min_rate, last_price, `100x Volatility`)
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
My broker available pairs:
|
My broker trades the following pairs:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
symbols <- c(
|
symbols <- c(
|
||||||
@ -156,9 +151,12 @@ symbols <- c(
|
|||||||
'AED', 'KZT', 'BYN', 'TRY', 'MXN'
|
'AED', 'KZT', 'BYN', 'TRY', 'MXN'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
symbols <- str_c("USD", symbols, sep = "/")
|
||||||
|
|
||||||
|
|
||||||
quotes_stats %>%
|
quotes_stats %>%
|
||||||
filter(
|
filter(
|
||||||
symbol %in% str_c("USD", symbols, sep = "/")
|
symbol %in% symbols
|
||||||
) %>%
|
) %>%
|
||||||
mutate(
|
mutate(
|
||||||
`100x Volatility` = volatility*100
|
`100x Volatility` = volatility*100
|
||||||
@ -172,26 +170,21 @@ quotes_stats %>%
|
|||||||
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(
|
||||||
columns = c(max_price, min_price, max_min_rate, `100x Volatility`)
|
columns = c(max_price, min_price, last_price, max_min_rate, `100x Volatility`)
|
||||||
)
|
)
|
||||||
|
|
||||||
```
|
```
|
||||||
Plot exchange rate for out favorites:
|
Plot exchange rate for out favorites:
|
||||||
|
|
||||||
```{r}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
Define low risk symbols:
|
Define low risk symbols:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
|
usdrub_vol <- quotes_stats %>% filter(symbol == "USD/RUB") %>% pull(volatility)
|
||||||
|
|
||||||
low_risk_symbols <- quotes_stats %>%
|
low_risk_symbols <- quotes_stats %>%
|
||||||
filter(
|
filter(
|
||||||
symbol %in% str_c("USD", symbols, sep = "/")
|
symbol %in% symbols &
|
||||||
) %>%
|
volatility <= usdrub_vol
|
||||||
filter(
|
|
||||||
volatility <= volatility_threshold |
|
|
||||||
symbol == "USD/RUB"
|
|
||||||
) %>%
|
) %>%
|
||||||
pull(symbol) %>%
|
pull(symbol) %>%
|
||||||
unique
|
unique
|
||||||
@ -204,4 +197,26 @@ cat(
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```{r}
|
||||||
|
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)
|
||||||
|
) %>%
|
||||||
|
group_by(symbol) %>%
|
||||||
|
mutate(R = cumsum(return)) %>%
|
||||||
|
|
||||||
|
ggplot +
|
||||||
|
geom_line(aes(x = date, y = R, color = symbol)) +
|
||||||
|
|
||||||
|
facet_grid(jumper ~ ., scales = "free") +
|
||||||
|
|
||||||
|
theme_bw()
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
BIN
src/fx_currencies_anlysis_files/figure-gfm/unnamed-chunk-3-1.png
Normal file
BIN
src/fx_currencies_anlysis_files/figure-gfm/unnamed-chunk-3-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 121 KiB |
Loading…
Reference in New Issue
Block a user