Candlestick chart
Tags: #yahoofinance #trading #yfin
Author: Carlo Occhiena

Input

Install and import libraries

1
import datetime as dt
2
import pandas_datareader as pdr
3
try:
4
import mplfinance as mpf
5
except:
6
!pip install mplfinance
7
import mplfinance as mpf
8
try:
9
import yfinance as yfin
10
except:
11
!pip install yfinance
12
import yfinance as yfin
Copied!

Variables

datefrom, dateto, the list of cryptocurrencies you need.
1
# update date range "start" as desired
2
start = dt.datetime(2021, 1, 1)
3
end = dt.datetime.now()
4
ticker = "ETH-USD"
Copied!

Model

candlestick chart, correlation heatmap, visual chart for all the currencies.
1
# insert cryptoasset (in Yahoo format "NNN-CCC" es BTC-EUR or ETH-USD) here
2
yfin.pdr_override()
3
data = yfin.download(ticker, start, end)
4
data
Copied!

Output

Create a candlestick chart for a given asset

👉 Completely customize the timeframe and asset you need
1
mpf.plot(data, title=f"{ticker} trend",
2
type="candle",
3
volume=True,
4
style="yahoo")
Copied!
1
Copied!
Copy link
Edit on GitHub