Skip to content

Commit

Permalink
Update format (#17)
Browse files Browse the repository at this point in the history
* Add JuliaFormatter config file

* Rename + split files

* Format getdata* functions

* Format plots* functions

* Format helper.jl

* Format app.jl

* Format runtests.jl

* Reduce line cols in docs

* Update minor version

* Make var. naming consistent

* Update README

* Add header comment
  • Loading branch information
vnegi10 authored Jun 25, 2022
1 parent cd7cc20 commit 523f99e
Show file tree
Hide file tree
Showing 15 changed files with 1,485 additions and 1,070 deletions.
17 changes: 17 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Configuration file for JuliaFormatter.jl
# Formatting options are described here: https://github.com/domluna/JuliaFormatter.jl

indent = 4
margin = 80
remove_extra_newlines = true
trailing_comma = false

always_for_in = true
always_use_return = true

whitespace_typedefs = true
whitespace_ops_in_indices = true
whitespace_in_kwargs = true

verbose = true
overwrite = true
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CryptoDashApp"
uuid = "8f55a569-a1ee-45d2-b761-b2b316ddd8e9"
authors = ["Vikas Negi <vikas.negi10@gmail.com>"]
version = "0.1.5"
version = "0.2.0"

[deps]
AlphaVantage = "6348297c-a006-11e8-3a05-9bbf8830fd7b"
Expand Down Expand Up @@ -33,4 +33,4 @@ JSON = "0.21"
PlotlyJS = "0.15"
Query = "1.0"
StatsBase = "0.33"
julia = "1.6"
julia = "1.6"
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@

[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://vnegi10.github.io/CryptoDashApp.jl/stable)

Interactive visualization of historical price (currently only in EUR), health metrics, candlestick and volume data for various cryptocurrencies. Data are obtained via API queries to Alpha Vantage.
The app is written in Julia and makes use of Dash.jl along with its react framework to generate a dashboard style view accessible via a browser.
Different moving averages are also calculated and plotted along with the daily average price data. Averaging window can be selected by the user.
Interactive visualization of historical price (currently only in EUR), health metrics, candlestick
and volume data for various cryptocurrencies. Data are obtained via API queries to Alpha Vantage.
The app is written in Julia and makes use of Dash.jl along with its react framework to generate a
dashboard style view accessible via a browser. Different moving averages are also calculated and
plotted along with the daily average price data. Averaging window can be selected by the user.

Functionality of the app will be extended in the future by adding more technical indicators.
Functionality of the app will be extended in the future by adding more technical indicators.
**Contributions are most welcome!**

## How to use?

This package is available via the General registry. Add it to your working Julia environment by doing the following in the REPL:
This package is available via the General registry. Add it to your working Julia environment by
doing the following in the REPL:
* Press ']' to enter Pkg prompt

```julia
pkg> add CryptoDashApp
```

Once all the packages are downloaded, you can make use of the **CryptoDashApp** module from the REPL itself or within a script by executing:
Once all the packages are downloaded, you can make use of the **CryptoDashApp** module from the
REPL itself or within a script by executing:

```julia
julia> using CryptoDashApp
Expand All @@ -30,7 +35,11 @@ Free API key can be obtained from [here.](https://www.alphavantage.co/support/#a

Now, open a new tab in your browser and check if you can access http://0.0.0.0:8056/ or http://127.0.0.1:8056/

First plot will take a few seconds to appear, wait patiently! If you are running this app for the first time, or on a different date, new data will be retrieved from Alpha Vantage, and then saved to CSV files on disk. Keep in mind that the free API key imposes a limit of five calls/minute, which means you won't be able to load data for more than five currencies in quick succession. In case you see an error, wait for a while and then try again.
First plot will take a few seconds to appear, wait patiently! If you are running this app for the
first time, or on a different date, new data will be retrieved from Alpha Vantage, and then saved
to CSV files on disk. Keep in mind that the free API key imposes a limit of five calls/minute,
which means you won't be able to load data for more than five currencies in quick succession. In
case you see an error, wait for a while and then try again.

## App demo

Expand Down
78 changes: 60 additions & 18 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,37 @@
---

## Overview
CryptoDashApp.jl creates a dashboard that allows the user to monitor historical cryptocurrency market data and calculate some key technical indicators. Data is obtained from Alpha Vantage for which an API key is necessary. Free API keys can be created [here.](https://www.alphavantage.co/support/#api-key)
CryptoDashApp.jl creates a dashboard that allows the user to monitor historical
cryptocurrency market data and calculate some key technical indicators. Data is
obtained from Alpha Vantage for which an API key is necessary. Free API keys can
be created [here.](https://www.alphavantage.co/support/#api-key)

Do note that the number of API calls are restricted to five per minute and 500 requests per day (more than enough for our app). We somewhat circumvent the former limitation by saving the data to the disk in the form of CSV files. Before downloading fresh data for a given date, older files are deleted.
Do note that the number of API calls are restricted to five per minute and 500
requests per day (more than enough for our app). We somewhat circumvent the former
limitation by saving the data to the disk in the form of CSV files. Before downloading
fresh data for a given date, older files are deleted.

## App UI
Data type and currency of interest can be selected via drop-down lists. Currently, data for only one currency can be viewed at a time. Averaging window (for calculating various moving averages) and historical timeframe can be selected via checkboxes.
Data type and currency of interest can be selected via drop-down lists. Currently, data
for only one currency can be viewed at a time. Averaging window (for calculating various
moving averages) and historical timeframe can be selected via checkboxes.

The plots are interactive, which means you can hover your cursor over the data points to see their value, and also zoom into a particular region. There is also an option to download the plot as a png file. By clicking on the legends, you can turn off the display for that data, which is useful for example when you want to look at only a certain type of data.
The plots are interactive, which means you can hover your cursor over the data points
to see their value, and also zoom into a particular region. There is also an option to
download the plot as a png file. By clicking on the legends, you can turn off the display
for that data, which is useful for example when you want to look at only a certain type
of data.

## Available modes

### Average price + Daily trade
- Left plot shows the daily average price for a given currency. Averaging is done by taking the mean of open, close, high and low price for all days. When a moving average window other than 1-day is selected, the SMA (Simple Moving Average), WMA (Weighted Moving Average) and EMA (Exponential Moving Average) are also visible.
- Left plot shows the daily average price for a given currency. Averaging is done by taking
the mean of open, close, high and low price for all days. When a moving average window other
than 1-day is selected, the SMA (Simple Moving Average), WMA (Weighted Moving Average) and
EMA (Exponential Moving Average) are also visible.

- Right plot shows the daily trade data, which is simply the product of volume (number of coins) multiplied by the average price.
- Right plot shows the daily trade data, which is simply the product of volume (number of
coins) multiplied by the average price.

### Candlestick + Volume
- Left plot shows the candlestick data for selected timeframe.
Expand All @@ -26,22 +42,40 @@ The plots are interactive, which means you can hover your cursor over the data p
### Cumulative + Daily return
- Left plot shows the cumulative return that will be obtained from a given starting date.

- Right plot shows the daily return distribution. Green indicates an increase in price, whereas red indicates the opposite. Percentage share of green/red is also indicated in the legend.
- Right plot shows the daily return distribution. Green indicates an increase in price,
whereas red indicates the opposite. Percentage share of green/red is also indicated in
the legend.

### Daily volatility
- This plot shows the distribution of the daily price change for a given currency over the specified timeframe. A wider distribution (higher 3σ) indicates a more volatile behavior.
- This plot shows the distribution of the daily price change for a given currency over
the specified timeframe. A wider distribution (higher 3σ) indicates a more volatile behavior.

### MACD + Signal
- Left plot shows the daily average price data along with 12-day and 26-day EMAs. These are used to calculate the Moving Average Convergence Divergence (MACD) indicator, which is shown on the right.
- Left plot shows the daily average price data along with 12-day and 26-day EMAs. These are
used to calculate the Moving Average Convergence Divergence (MACD) indicator, which is shown
on the right.

- Right plot shows the MACD (26-day EMA subtracted from 12-day EMA) along with its signal line (9-day EMA of the MACD). A buy signal occurs when MACD crosses the signal line from below, and a sell signal occurs when the crossing is from above. Distance between the MACD and the signal line is shown via bars in the same plot, with green bars (bullish momentum) indicating the region where MACD > signal, and red bars (bearish momentum) for the opposite. For more description, see [link.](https://www.investopedia.com/terms/m/macd.asp)
- Right plot shows the MACD (26-day EMA subtracted from 12-day EMA) along with its signal
line (9-day EMA of the MACD). A buy signal occurs when MACD crosses the signal line from below,
and a sell signal occurs when the crossing is from above. Distance between the MACD and the signal
line is shown via bars in the same plot, with green bars (bullish momentum) indicating the region
where MACD > signal, and red bars (bearish momentum) for the opposite. For more description,
see [link.](https://www.investopedia.com/terms/m/macd.asp)

### Linear regression channel
- This metric can be used to identify trends and their direction. Plot shows a linear regression line that is the best fit to the data available for the selected duration. The **upper channel** line runs parallel to the linear regression line, and is located two standard deviations above it. Same goes for the **lower channel** line except that it's located two standard deviations below.
- This metric can be used to identify trends and their direction. Plot shows a linear regression
line that is the best fit to the data available for the selected duration. The **upper channel** line
runs parallel to the linear regression line, and is located two standard deviations above it.
Same goes for the **lower channel** line except that it's located two standard deviations below.

- When the price drops below the lower channel, it is considered as a buy signal. Similarly, price rising above the upper channel leads to a sell signal. If the price spends time outside the channel, it could indicate that a trend reversal is imminent.
- When the price drops below the lower channel, it is considered as a buy signal. Similarly, price
rising above the upper channel leads to a sell signal. If the price spends time outside the channel,
it could indicate that a trend reversal is imminent.

- Plot title also contains $R^2$, which is a statistical measure representing the proportion of variation in the dependent variable that is explained by different features (independent variables) in this model. A value closer to 1 (maximum) indicates a good fit. The linear regression channel metric will therefore not be very useful when $R^2 < 0.50$.
- Plot title also contains $R^2$, which is a statistical measure representing the proportion of
variation in the dependent variable that is explained by different features (independent variables)
in this model. A value closer to 1 (maximum) indicates a good fit. The linear regression channel metric
will therefore not be very useful when $R^2 < 0.50$.

### Bollinger bands
- These are price envelopes plotted at two standard deviations (std) above (upper band) and below
Expand All @@ -58,23 +92,31 @@ the upper band might be considered as the next profit target. Prices can also cr
during strong trends.

### Fundamental Cryptocurrency Asset Score (FCAS) data
- This metric tells us about the market health of an asset. In the case of cryptocurrencies, they are user activity, developer behavior, and market maturity, which are provided by [Flipside Crypto](https://app.flipsidecrypto.com/tracker/all-coins).
- This metric tells us about the market health of an asset. In the case of cryptocurrencies, they are
user activity, developer behavior, and market maturity, which are provided
by [Flipside Crypto](https://app.flipsidecrypto.com/tracker/all-coins).

### Following modes make use of the CoinGecko API
---

### Developer + Community data
- Left plot shows various developer metrics (number of stars in the repository, commits, closed issues, pull requests etc.) that gives us an idea on how active the software development team is for a given cryptocurrency. In particular, for an actively maintained repository, the delta between the number of "closed issues" and the number of "total issues" should not be too big.
- Left plot shows various developer metrics (number of stars in the repository, commits, closed issues,
pull requests etc.) that gives us an idea on how active the software development team is for a given
cryptocurrency. In particular, for an actively maintained repository, the delta between the number of
"closed issues" and the number of "total issues" should not be too big.

- Right plot shows social media activity (number of followers, accounts etc.) on popular platforms such as reddit, telegram and twitter.
- Right plot shows social media activity (number of followers, accounts etc.) on popular platforms
such as reddit, telegram and twitter.

### Exchange volume data per currency
- Left plot shows the total volume (number of coins) that has been traded over last 24 hours for the selected cryptocurrency on the top ten exchanges.
- Left plot shows the total volume (number of coins) that has been traded over last 24 hours for the
selected cryptocurrency on the top ten exchanges.

- Right plot shows the USD equivalent for the same data.

### Overall exchange volume data
- This stacked bar plot shows the total 24-hr volume (in BTC) of all the cryptocurrencies traded on various exchanges over the course of last 30 days.
- This stacked bar plot shows the total 24-hr volume (in BTC) of all the cryptocurrencies traded on
various exchanges over the course of last 30 days.

## Run app
```@docs
Expand Down
Loading

2 comments on commit 523f99e

@vnegi10
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

  • Support for new mode: Bollinger bands
  • Updated docs, tests
  • Code restructuring

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/63108

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" 523f99e0c69d2e86adbfd4e9bb763dc1b05ea81a
git push origin v0.2.0

Please sign in to comment.