Plotly
Create chart easily with plotly
Plotly: The front end for ML and data science models
plotlygraphs
Website

Stock

Create stock chart from Dataframe
If you use yahoo driver you can pass it without option it's made to work together
Give a data frame with theses columns
Date
Open
High
Low
Close
Adj Close
Volume
Company
2014-04-14
133.95
145.95
133.95
143.95
114.599
13650000
TSLA
You can give Moving average with column start with MA (Max 2)
MA5
MA20
You can plot prediction coming from prediction driver with theses column
ARIMA
SVR
LINEAR
COMPOUND
​
​
​
​
all this data can be generated for you by the Yahoo driver

Basic

1
df = naas_drivers.yahoo.stock("TSLA")
2
chart = naas_drivers.plot.stock(df)
Copied!

Chart type

1
kind = "linechart"
2
# can be linechart, linechart_open, linechart_close or candlestick
3
naas_drivers.plot.stock("TSLA", kind=kind)
Copied!

Filter

1
naas_drivers.plot.stock("TSLA", filter=True, filter_title="Stock")
Copied!

Linechart

If you use yahoo driver you can pass it without option it's made to work together

Basic

1
df = naas_drivers.yahoo.stock("TSLA")
2
chart = naas_drivers.plot.linechart(df, label_x="Date", label_y=["Close"])
Copied!

Candlestick

If you use yahoo driver you can pass it without option it's made to work together

Basic

1
df = naas_drivers.yahoo.stock("TSLA")
2
chart = naas_drivers.plot.candlestick(df,
3
label_x="Date",
4
label_open="Open",
5
label_high="Hight"
6
label_low="Low",
7
label_close="Close"
8
)
Copied!

Export

SCREENSHOT_API: this should be set as env vars. in local naas
this should connect to this docker machine :
Docker Hub

Simple

1
chart = naas_drivers.plot.stock("TSLA")
2
filename = "Tesla.png" # can be png, jpeg or html
3
naas_drivers.plot.export(chart, "Tesla.png", css=None)
Copied!

Css custom

1
chart = naas_drivers.plot.stock("TSLA")
2
filename = "Tesla.png" # can be png or html
3
css = ".custom_css {color: white}"
4
naas_drivers.plot.export(chart, "Tesla.png", css=css)
Copied!

Official documentation:

Getting Started with Plotly
plotlygraphs