Skip to content

Instantly share code, notes, and snippets.

@rsalaza4
Created October 30, 2021 00:37
Show Gist options
  • Select an option

  • Save rsalaza4/3119fcead0d32ec675d636b95c6c554d to your computer and use it in GitHub Desktop.

Select an option

Save rsalaza4/3119fcead0d32ec675d636b95c6c554d to your computer and use it in GitHub Desktop.
# Create an hvplot table for the stock data
TSLA_df_table = TSLA.hvplot.table(width=1000)
# Create an hvplot line plot for the closing price
TSLA_closing_price_plot = TSLA.drop(columns="Daily_Return").hvplot.line(title="TSLA Closing Price & Simple Moving Average", ylabel="USD", height=500, width=1000)
# Create an hvplot line plot for the daily return
TSLA_daily_retrun_plot = TSLA["Daily_Return"].hvplot.line(title="TSLA Daily Returns", ylabel="Daily Return", height=500, width=1000)
# Create an hvplot bar plot for the daily volume
TSLA_trading_volume_barplot = TSLA_data["Volume"].hvplot.bar(title="TSLA Trading Volume", ylabel="Volume", height=500, width=1000).opts(alpha=0.2, xaxis=None)
# Create a candlestick plot for the stock data
TSLA_candlestick = go.Figure(data=[go.Candlestick(x=TSLA_data.index,
open=TSLA_data['Open'],
high=TSLA_data['High'],
low=TSLA_data['Low'],
close=TSLA_data['Close'])])
TSLA_candlestick.update_layout(height=800, width=1000, title='TSLA Candlestick')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment