| Title: | Interactive Cryptocurrency Time Series and Market Data Explorer |
|---|---|
| Description: | A 'shiny' application for exploring cryptocurrency exchange rates. Plots interactive candlestick and volume charts of historical prices since 2013 for any active cryptocurrency, and shows a table of the top 100 cryptocurrencies by market capitalisation with price changes over 24 hours to 90 days, market dominance and fully diluted market cap. Also compares normalized prices of several coins, and shows a market cap treemap, a calendar of monthly returns, whether a coin's recent volatility is normal, with a GARCH forecast, and its falls from its all-time high. Market data is retrieved from 'CoinMarketCap'. |
| Authors: | Dimitrios Zacharatos [aut, cre] (ORCID: <https://orcid.org/0000-0003-1789-8294>) |
| Maintainer: | Dimitrios Zacharatos <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-11-19 18:40:17 UTC |
| Source: | https://github.com/sedzinfo/golemcrypto |
Starts an interactive 'shiny' application for exploring cryptocurrency exchange rates and market data from 'CoinMarketCap'.
crypto( api_key = Sys.getenv("COINMARKETCAP_APIKEY"), analytics = FALSE, keep_alive = TRUE, ... )crypto( api_key = Sys.getenv("COINMARKETCAP_APIKEY"), analytics = FALSE, keep_alive = TRUE, ... )
api_key |
A 'CoinMarketCap' API key, needed for the market listings.
By default it is read from the |
analytics |
|
keep_alive |
|
... |
Further arguments passed to |
The application has the following tabs:
Candlestick chart of daily open, high, low and close prices in USD since 2013 for any active cryptocurrency, with its 50- and 200-day moving averages, and charts of the volume and of the drawdown (how far the price is below its all-time high) underneath.
Table of the top 100 cryptocurrencies by market cap with price, volume, 24h to 90d price changes, market dominance and fully diluted market cap.
Close prices of up to 10 coins, normalized to 100 on the first date all of them have data.
Top 100 coins sized by market cap and colored by 24h change.
Monthly returns by year for the coin selected in the Timeseries tab.
The returns of the coin selected in the Timeseries tab by day of the week, week of the year, month or year of the halving cycle, with a test of whether the differences could be chance.
Market listings are downloaded when the app starts and refreshed every 10
minutes. When they cannot be downloaded, for example because the API key
has used up its credits, the app still starts, and the Top 100 and
Treemap tabs tell the visitors why and when the limit resets. Historical prices are downloaded on demand with
crypto2::crypto_history() and kept on disk between R sessions, so
after the first download only the days since the last one are fetched.
An internet connection is required. When 'CoinMarketCap' limits the requests,
crypto2 prints "Retrying in 60 seconds" and the chart appears about a
minute later.
A shiny::shinyApp() object. Printing it, or calling crypto() at
the console, opens the app in the browser.
if (interactive()) crypto() # with the API key passed directly, on a fixed port if (interactive()) crypto(api_key = "your-api-key", options = list(port = 8080))if (interactive()) crypto() # with the API key passed directly, on a fixed port if (interactive()) crypto(api_key = "your-api-key", options = list(port = 8080))
How far each close is below the highest close up to that day, the all-time high so far, in percent: 0 on a new high and -50 at half of it.
drawdown(close)drawdown(close)
close |
Numeric vector of close prices, sorted by date. |
A numeric vector as long as close, from -100 to 0.
drawdown(c(100, 120, 90, 130, 65))drawdown(c(100, 120, 90, 130, 65))
How far is the coin below its all-time high, and how does
that compare with its earlier falls? See drawdown_episodes() for how
the falls are found.
Now: the last close against the all-time high, the lowest close since that high, the rise the price needs to get back to it, and the earlier falls that went at least as deep as the current one has so far: how many days they took to get back to their high.
The history: the falls of at least min_depth percent, the deepest
first, the share of days that closed that far below the high, and the
days that closed at a new all-time high.
drawdown_analysis(history, min_depth = 20)drawdown_analysis(history, min_depth = 20)
history |
Price history of one coin from |
min_depth |
Smallest fall of the history to list, in percent below the high. |
NULL when there are fewer than 2 prices, or a list with:
What was analysed.
date and close of the last day, drawdown_pct, high_date
and high_price of the all-time high, days_since_high, and
rise_needed_pct to get back to it. While the price is below the
high also low_date and low_price, the lowest close since the
high, deepest_pct how far that is below it, rank of the current
fall among all the falls of the history by that depth, 1 for the
deepest, and earlier, the earlier falls at least as deep, as rows of
drawdown_episodes(). At the high, previous holds the last fall of
at least min_depth percent, or no rows.
The falls of at least min_depth percent from
drawdown_episodes(), with their rank in front, 1 for the
deepest.
A row per day: date, close, high (the all-time
high so far) and drawdown_pct (see drawdown()).
Percent of the days that closed at least
min_depth percent below the high.
Days that closed at a new all-time high, the first day of the history left out.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) analysis <- drawdown_analysis(btc) analysis$now$drawdown_pct analysis$episodes drawdown_text(analysis)btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) analysis <- drawdown_analysis(btc) analysis$now$drawdown_pct analysis$episodes drawdown_text(analysis)
Splits a price history into its falls, the drawdown episodes. A fall starts on the last close at an all-time high, the peak, goes down to its lowest close, the trough, and ends on the first close back at or above the peak. The last fall is still going on when the price has not got back to its high. The highs are those of the history given: for a coin whose history starts after its real all-time high, the first fall starts on the first day.
drawdown_episodes(close, date, min_depth = 0)drawdown_episodes(close, date, min_depth = 0)
close |
Numeric vector of close prices, sorted by date. |
date |
Dates of the closes. |
min_depth |
Smallest fall to keep, in percent below the peak: 20 keeps the falls that went at least 20% down. The default, 0, keeps them all. |
A data frame with a row per fall, the deepest first:
peak_date and peak_price, trough_date and trough_price,
depth_pct (from -100 to 0), days_to_trough (from the peak),
recovery_date (NA while the fall goes on), days_to_recover (from
the trough), days_total (from the peak to the recovery, or to the last
date while the fall goes on) and ongoing.
drawdown_episodes(c(100, 120, 90, 130, 65, 70), as.Date("2026-01-01") + 0:5) # only the falls of at least 40% drawdown_episodes(c(100, 120, 90, 130, 65, 70), as.Date("2026-01-01") + 0:5, min_depth = 40)drawdown_episodes(c(100, 120, 90, 130, 65, 70), as.Date("2026-01-01") + 0:5) # only the falls of at least 40% drawdown_episodes(c(100, 120, 90, 130, 65, 70), as.Date("2026-01-01") + 0:5, min_depth = 40)
A sortable table of the falls of drawdown_analysis(), the
deepest first, with the numbers of the chart of plot_drawdowns(). The
fall is shaded red, more strongly the deeper it is, and the current fall,
which has not got back to its high, is in bold.
drawdown_table(analysis)drawdown_table(analysis)
analysis |
The result of |
A DT datatable.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) drawdown_table(drawdown_analysis(btc))btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) drawdown_table(drawdown_analysis(btc))
Sentences built from the numbers of drawdown_analysis(),
for the Drawdowns tab.
drawdown_text(analysis)drawdown_text(analysis)
analysis |
The result of |
A list with now and history, each with a headline and
points, a character vector of sentences.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) drawdown_text(drawdown_analysis(btc))btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) drawdown_text(drawdown_analysis(btc))
Downloads the list of the active coins tracked by
'CoinMarketCap' and keeps it on disk for a day (see disk_cache()). When the
download fails, the kept list is used. Its name_symbol column holds the
labels, such as "Bitcoin (BTC)", that pick coins in get_history().
get_coins()get_coins()
The crypto2::crypto_list() data frame, with a name_symbol
column.
## Not run: coins <- get_coins() head(coins$name_symbol) ## End(Not run)## Not run: coins <- get_coins() head(coins$name_symbol) ## End(Not run)
Returns the daily USD prices of one or more coins from 'CoinMarketCap'. Each coin's history is kept on disk between R sessions, and once it is more than an hour old only the days since its last day are downloaded, so calls are fast and stay below the request limit of 'CoinMarketCap'. When that limit is hit, crypto2 waits a minute and tries again.
get_history(labels, start_date = Sys.Date() - 365, coins = get_coins())get_history(labels, start_date = Sys.Date() - 365, coins = get_coins())
labels |
Character vector of coin labels, such as "Bitcoin (BTC)",
from the |
start_date |
Date. The first day to get, a year ago by default. |
coins |
Data frame of coins from |
A data frame with one row per coin and day, sorted by coin and
date, with the open, high, low, close and volume columns,
timestamp as a Date and the name_symbol label. Labels that match no
coin are left out with a message, and NULL is returned when no label
matches or nothing could be downloaded.
## Not run: btc <- get_history("Bitcoin (BTC)", as.Date("2020-01-01")) plot_timeseries(btc) history <- get_history(c("Bitcoin (BTC)", "Ethereum (ETH)")) plot_compare(normalize_prices(history)) ## End(Not run)## Not run: btc <- get_history("Bitcoin (BTC)", as.Date("2020-01-01")) plot_timeseries(btc) history <- get_history(c("Bitcoin (BTC)", "Ethereum (ETH)")) plot_compare(normalize_prices(history)) ## End(Not run)
Returns the listings of the coins by market cap, with their price, volume, price changes from 24 hours to 90 days, market cap and dominance in USD. The listings are downloaded again when they are older than 10 minutes, and the download is shared by all sessions and app runs in the same R process, so the API is called at most once in that time.
get_listings()get_listings()
The listings need a 'CoinMarketCap' API key in the
COINMARKETCAP_APIKEY environment variable, see the README. A failed
download, for example when the key has used up its credits, is tried again
after 10 minutes. Until then the previous listings and their time are kept,
so the time stays truthful, and problem tells the visitors of the app why,
see listings_problem().
A list with data, a data frame with one row per coin sorted by
market cap, and time, when it was downloaded (both NULL until a
download works), and problem, NULL when the last download worked
and otherwise a sentence on why it failed.
## Not run: listings <- get_listings() listings$time head(listings$data) ## End(Not run)## Not run: listings <- get_listings() listings$time head(listings$data) ## End(Not run)
A sortable table with 100 rows per page and numbers rounded to 2 decimals, showing the price in dollars and the price changes in percent. Losses are shaded red and gains green, more strongly the larger the change, in steps of 0.1 percentile from the 5th to the 95th. Changes near zero keep the table's own background, so the table suits the light and the dark mode.
listings_table(listings)listings_table(listings)
listings |
The |
A DT datatable.
listings_table(get_listings()$data)listings_table(get_listings()$data)
Each month's return is its last close relative to the last close
of the month before, in percent. The first month, and the months still to
come, are NA.
monthly_returns(history)monthly_returns(history)
history |
Price history of one coin from |
A year by month matrix of returns in percent, rounded to 2
decimals, with the years as row names and month.abb as column names.
history <- data.frame( timestamp = as.Date(c("2024-01-31", "2024-02-29", "2024-03-31")), close = c(100, 110, 121) ) monthly_returns(history)history <- data.frame( timestamp = as.Date(c("2024-01-31", "2024-02-29", "2024-03-31")), close = c(100, 110, 121) ) monthly_returns(history)
The simple moving average: each day's value is the mean of the
last days closes, that day included, so the first days - 1 days have
none.
moving_average(close, days)moving_average(close, days)
close |
Numeric vector of close prices, sorted by date. |
days |
Number of days to average, such as 50 or 200. |
A numeric vector as long as close, NA for the first
days - 1 days, and all NA when there are fewer than days closes,
as for a coin younger than the average.
moving_average(c(1, 2, 3, 4, 5), days = 3)moving_average(c(1, 2, 3, 4, 5), days = 3)
Every coin starts at 100 on the first date on which all of them have data, so their lines can be compared directly: 150 means the price rose by half since that date.
normalize_prices(history)normalize_prices(history)
history |
Price history from |
history from the first common date on, with an index column.
history <- data.frame( name_symbol = rep(c("Alpha (A)", "Beta (B)"), each = 3), timestamp = rep(as.Date("2024-01-01") + 0:2, 2), close = c(10, 11, 12, 200, 180, 220) ) normalize_prices(history)history <- data.frame( name_symbol = rep(c("Alpha (A)", "Beta (B)"), each = 3), timestamp = rep(as.Date("2024-01-01") + 0:2, 2), close = c(10, 11, 12, 200, 180, 220) ) normalize_prices(history)
One line per coin, with buttons that switch the y axis between a linear and a log scale.
plot_compare(prices, mode = "light")plot_compare(prices, mode = "light")
prices |
Prices from |
mode |
|
A plotly object.
history <- get_history(c("Bitcoin (BTC)", "Ethereum (ETH)", "Solana (SOL)")) plot_compare(normalize_prices(history))history <- get_history(c("Bitcoin (BTC)", "Ethereum (ETH)", "Solana (SOL)")) plot_compare(normalize_prices(history))
Two panels over the whole history. The upper one is the
close on a log scale with the all-time high so far; the lower one is the
drawdown, how far each close is below that high (see drawdown()), with
a dashed line at min_depth percent. The falls of the analysis are shaded
from their peak to their recovery, the current one in amber, and their
troughs carry their rank, as in drawdown_table(); hover over a trough
for its dates.
plot_drawdowns(analysis, mode = "light")plot_drawdowns(analysis, mode = "light")
analysis |
The result of |
mode |
|
A plotly object.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_drawdowns(drawdown_analysis(btc))btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_drawdowns(drawdown_analysis(btc))
The last closes of a coin and the forecast of its next days
from the GARCH model of volatility_analysis(): the median close, and the
ranges of the middle half and of probability level, which start from the
last close. Hover over the median line for the ranges of a day. It is the
lower panel of plot_volatility(), on its own.
plot_forecast(analysis, mode = "light", context_days = 30)plot_forecast(analysis, mode = "light", context_days = 30)
analysis |
The result of |
mode |
|
context_days |
Closes before the forecast. |
A plotly object.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_forecast(volatility_analysis(btc)) # the next 14 days after the last 60 closes plot_forecast(volatility_analysis(btc, forecast_days = 14), context_days = 60)btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_forecast(volatility_analysis(btc)) # the next 14 days after the last 60 closes plot_forecast(volatility_analysis(btc, forecast_days = 14), context_days = 60)
Months are colored from red to green by their return. The color limit is the 95th percentile of the absolute returns, so a few extreme months do not wash out the rest.
plot_returns_calendar(calendar, label = NULL, mode = "light")plot_returns_calendar(calendar, label = NULL, mode = "light")
calendar |
Matrix from |
label |
Label of the coin for the title, or |
mode |
|
A plotly object.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_returns_calendar(monthly_returns(btc), "Bitcoin (BTC)")btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_returns_calendar(monthly_returns(btc), "Bitcoin (BTC)")
Two panels with a bar per group of seasonality_analysis().
The upper one shows the mean return, green above 0 and red below, with the
median as a diamond; the lower one shows the share of the returns above 0,
with a dashed line at 50%. Hover over a bar for all the numbers of its
group.
plot_seasonality(analysis, mode = "light")plot_seasonality(analysis, mode = "light")
analysis |
The result of |
mode |
|
A plotly object.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_seasonality(seasonality_analysis(btc, "month")) plot_seasonality(seasonality_analysis(btc, "day"), mode = "dark")btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_seasonality(seasonality_analysis(btc, "month")) plot_seasonality(seasonality_analysis(btc, "day"), mode = "dark")
Plots the daily open, high, low and close prices, with a line through the close, its moving averages, date range buttons and a range slider. Underneath, smaller charts show the trading volume and the drawdown: how far the price is below its all-time high so far. A click on a legend entry hides or shows that line.
The vertical axes follow the days in view: zoomed in, each runs from the lowest to the highest value of those days, so a week's candles fill the chart instead of lying flat on an axis that reaches up to the all-time high. The Linear and Log buttons switch the axis of the prices; on the log axis equal distances are equal percentages, which suits the whole history.
plot_timeseries( history, mode = "light", averages = c(50, 200), show_drawdown = TRUE )plot_timeseries( history, mode = "light", averages = c(50, 200), show_drawdown = TRUE )
history |
Price history of one coin from |
mode |
|
averages |
Days of the moving averages to draw (see
|
show_drawdown |
|
A plotly object.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_timeseries(btc) # shorter averages, and no drawdown chart plot_timeseries(btc, averages = c(20, 100), show_drawdown = FALSE)btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_timeseries(btc) # shorter averages, and no drawdown chart plot_timeseries(btc, averages = c(20, 100), show_drawdown = FALSE)
Each box is sized by market cap and colored from red to green by the 24h price change. The color limits are the 5th and 95th percentiles of the changes, so a few outliers do not wash out the rest. Coins without 24h change are labelled n/a and colored white.
plot_treemap(listings, mode = "light")plot_treemap(listings, mode = "light")
listings |
The |
mode |
|
A plotly object.
plot_treemap(get_listings()$data)plot_treemap(get_listings()$data)
Three panels. The upper one is the volatility of every
month_days-day period over the whole history, annualized, with its
median and 95th percentile: where the line is now shows how rough the
last month was. The middle one shows each of the last days days as a bar
of its move in the standard deviations the GARCH model expected for it,
red for falls and green for rises, with lines at 2 and 4 standard
deviations. The lower one shows the last context_days closes and the
forecast of the next days: the median close, and the ranges of the middle
half and of probability level (see volatility_analysis()). Without a
GARCH model only the upper panel is drawn.
plot_volatility(analysis, mode = "light", days = 90, context_days = 30)plot_volatility(analysis, mode = "light", days = 90, context_days = 30)
analysis |
The result of |
mode |
|
days |
Days of the middle panel. |
context_days |
Closes before the forecast in the lower panel. |
A plotly object.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_volatility(volatility_analysis(btc))btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) plot_volatility(volatility_analysis(btc))
A period's return is its last close relative to the last
close of the period before, in percent, as in monthly_returns(). Only
complete periods count: the period and the one before must both have a
close on their last day. The first period, which has none before it, the
current one, which has not ended, and the periods next to missing days
are left out.
Each return is put in a group: the day of the week for days, the ISO 8601 week of the year for weeks (Monday to Sunday), the month for months, and the year of the 4-year cycle of Bitcoin's halvings for years. The halvings came in 2012, 2016, 2020 and 2024, so a year divisible by 4 is a halving year and 2025 is "Halving + 1".
seasonal_returns(history, period = c("day", "week", "month", "year"))seasonal_returns(history, period = c("day", "week", "month", "year"))
history |
Price history of one coin from |
period |
|
A data frame with a row per complete period, the oldest first:
start and end, the first and last day of the period, group, a
factor with the groups in their natural order, and return_pct.
history <- data.frame( timestamp = as.Date("2024-01-01") + 0:120, close = 100 * cumprod(c(1, rep(1.002, 120))) ) seasonal_returns(history, "month") head(seasonal_returns(history, "day"))history <- data.frame( timestamp = as.Date("2024-01-01") + 0:120, close = 100 * cumprod(c(1, rep(1.002, 120))) ) seasonal_returns(history, "month") head(seasonal_returns(history, "day"))
Do some days of the week, weeks of the year, months or years
of the halving cycle bring better returns than others? The returns of the
complete periods (see seasonal_returns()) are summed up by group, and a
Kruskal-Wallis test asks whether the differences between the groups are
larger than chance would give. The test compares the ranks of the
returns, so a few extreme months do not decide it, but it takes the
returns as independent, which crypto returns are only roughly: calm and
wild stretches come in runs.
seasonality_analysis(history, period = c("day", "week", "month", "year"))seasonality_analysis(history, period = c("day", "week", "month", "year"))
history |
Price history of one coin from |
period |
|
NULL when the history has no complete period with one before
it, or a list with:
What was analysed.
The returns of seasonal_returns().
A row per group that has returns, in their natural
order: group, returns (how many), mean_pct, median_pct,
up_pct (the share of the returns above 0), best_pct and
worst_pct.
The same numbers for all the returns together, as a list.
The p-value of the Kruskal-Wallis test, NA when
fewer than two groups have returns, or no group has two.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) analysis <- seasonality_analysis(btc, "month") analysis$groups analysis$p_value seasonality_text(analysis)btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) analysis <- seasonality_analysis(btc, "month") analysis$groups analysis$p_value seasonality_text(analysis)
A table with a row per group of seasonality_analysis(), in
their natural order, with the numbers of the chart of
plot_seasonality(). The mean and the median are shaded red below 0 and
green above it, and the share up red below 50% and green above it, more
strongly the further they are from the middle.
seasonality_table(analysis)seasonality_table(analysis)
analysis |
The result of |
A DT datatable.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) seasonality_table(seasonality_analysis(btc, "month"))btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) seasonality_table(seasonality_analysis(btc, "month"))
Sentences built from the numbers of seasonality_analysis(),
for the Seasonality tab: the best and the worst group, and whether the
differences between the groups could be chance.
seasonality_text(analysis)seasonality_text(analysis)
analysis |
The result of |
A list with groups and chance, each with a headline and
points, a character vector of sentences.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) seasonality_text(seasonality_analysis(btc, "day"))btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) seasonality_text(seasonality_analysis(btc, "day"))
Is the coin's recent volatility normal? The analysis looks at
the daily log returns, log(close(t) / close(t-1)), in two ways.
The last month (month_days days, 30 by default): its volatility, the standard
deviation of the daily returns times sqrt(365), against the year before
it and against every past period of the same length; an F test and the
Fligner-Killeen test, which is robust to a few extreme days, of whether
its variance is larger than the year before; its largest daily move, in
standard deviations of the year before; and its return against every past
period of the same length.
The last days (recent_days days): their return against every past
period of as many days; the same, in standard deviations of the year
before; a GARCH(1,1) model with Student-t errors (see garch_fit()),
fitted to the garch_years years before them, which judges each day
against the volatility the model expected for it given the days before;
and each day's volume against the volume_days days before it (see
volume_ratio()), judged by how often the coin's volume was as far from
usual.
The next days (forecast_days days): the same model, with its
variance brought up to the last day, forecasts the volatility and the range
of the price (see garch_forecast()), and gives the value at risk and the
expected shortfall of the next day (see garch_risk()). A Kupiec test (see
kupiec_test()) checks how often the model's value at risk was exceeded
over the last year. The value at risk and expected shortfall of the last
year's daily returns are given without the model too.
volatility_analysis( history, month_days = 30, recent_days = 2, garch_years = 4, forecast_days = 7, level = 0.95, volume_days = 30 )volatility_analysis( history, month_days = 30, recent_days = 2, garch_years = 4, forecast_days = 7, level = 0.95, volume_days = 30 )
history |
Price history of one coin from |
month_days |
Days of the volatility window, the "month": 30, or for example 7 for the last week or 90 for the last quarter. |
recent_days |
Days in the recent move, such as 1 for the last day alone. |
garch_years |
Years of history to fit the GARCH model to. |
forecast_days |
Days to forecast. |
level |
Probability of the forecast ranges, and of the value at risk: 0.95 is the 95% range and the worst 5% of days. |
volume_days |
Days before each day whose median volume the day's volume is compared with. |
NULL when the history is not longer than a year and the longer
of month_days and recent_days, or the price did not move at all in
the year before the month or the last days, otherwise a list with
coin, first_date and last_date;
month: a list of the month's measures, see the code;
recent: a list of the measures of the last days, with a days data
frame of each day's return, GARCH measures, volume, volume_ratio
and volume_one_in_days (NA without volume);
garch: the fitted model, or NULL when it could not be fitted or
there are fewer than 500 days before the last days;
forecast: NULL without a model, otherwise a list with days, a
data frame with a row per day ahead: its date, sigma (the daily
standard deviation the model expects, in percent) and the closes
low, low_50, median, high_50 and high of the ranges (see
garch_forecast()); sigma and sigma_long_run, the daily standard
deviation expected for the next day and in the long run; half_life,
the days for the volatility to get half-way back to the long run;
var and es, the value at risk and expected shortfall of the next
day; and backtest, the days, exceedances and p_value of the
Kupiec test;
history_risk: var and es of the daily returns of the last
days (365) days, in percent;
series: a data frame with a row per day and the columns date,
close, volume, return_pct, volume_ratio (see
volume_ratio()), volatility_month (of the month_days days up
to the day, annualized, in percent),
garch_sigma (the daily standard deviation the model expected, in
percent), garch_z (the day's move in those standard deviations) and
garch_var (the model's value at risk for the day, in percent);
settings: month_days, recent_days, garch_years,
forecast_days, level and volume_days.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) analysis <- volatility_analysis(btc) analysis$month$level analysis$recent$days analysis$forecast$days volatility_text(analysis) # the volatility of the last week, and the move of the last day volatility_text(volatility_analysis(btc, month_days = 7, recent_days = 1))$month$headlinebtc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) analysis <- volatility_analysis(btc) analysis$month$level analysis$recent$days analysis$forecast$days volatility_text(analysis) # the volatility of the last week, and the move of the last day volatility_text(volatility_analysis(btc, month_days = 7, recent_days = 1))$month$headline
Sentences built from the numbers of volatility_analysis(),
for the Volatility tab.
volatility_text(analysis)volatility_text(analysis)
analysis |
The result of |
A list with month, recent and forecast, each with a headline and
points, a character vector of sentences.
btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) volatility_text(volatility_analysis(btc))btc <- get_history("Bitcoin (BTC)", as.Date("2013-04-29")) volatility_text(volatility_analysis(btc))