Display chart from ticker
With this template, you can get data from any ticker available in Yahoo finance.
Tags: #yahoofinance #trading #plotly #naas_drivers
Author: Florent Ravenel

Input

Import libraries

1
from naas_drivers import yahoofinance, plotly
Copied!

Input parameters

👉 Here you can change the ticker, timeframe and add moving averages analysiss
1
ticker = "TSLA"
2
date_from = -365
3
date_to = "today"
4
interval = '1d'
5
moving_averages = [20, 50]
Copied!

Model

Get dataset from Yahoo Finance

1
df_yahoo = yahoofinance.get(ticker,
2
date_from=date_from,
3
date_to=date_to,
4
interval=interval,
5
moving_averages=moving_averages)
Copied!

Output

Display chart

1
chart = plotly.linechart(df_yahoo,
2
x="Date",
3
y=["Close", "MA20", "MA50"],
4
showlegend=True,
5
title=f"{ticker} stock as of today")
Copied!
Copy link
Edit on GitHub