Financial plotting
There are situations where more raw values per time point are needed to understand a trend for prediction. The candlestick plot is a commonly used visualization in technical analysis in finance to show a price trend, most often seen in the stock market. To draw a candlestick plot, we can use the candlestick_ohlc
API in the mpl_finance
package.
mpl_finance
can be downloaded from GitHub. After cloning the repository in the Python site-packages directory, call python3 setup.py install
in the terminal to install it.
candlestick_ohlc()
takes the input of a Pandas DataFrame with five columns: date
in floating-point numbers, open
, high
, low
, and close
.
In our tutorial, we use the cryptocurrency market values as an example. Let's again look at the data table we obtained:
import pandas as pd # downloaded from kaggle "Cryptocurrency Market Data" dataset curated by user jvent # Source URL: https://www.kaggle.com/jessevent/all-crypto-currencies crypt = pd.read_csv('crypto-markets.csv...