Get startedGet started for free

Plot a candlestick chart

A candlestick chart is a style of chart that packs multiple pieces of price information into one chart. It can provide you with a good sense of price action and visual aid for technical analysis.

You will plot a candlestick chart using the same data as the previous exercise, which has been preloaded as bitcoin_data. Also, plotly.graph_objects has been imported as go.

This exercise is part of the course

Financial Trading in Python

View Course

Exercise instructions

  • Define a candlestick object using columns from bitcoin_data.
  • Create a plot using the candlestick object defined in the previous step.
  • Display the candlestick chart.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Define the candlestick data
candlestick = ____(
    x=bitcoin_data.index,
    open=bitcoin_data['____'],
    high=bitcoin_data['____'],
    low=bitcoin_data['____'],
    close=bitcoin_data['____'])

# Create a candlestick figure   
fig = ____(data=[____])
fig.update_layout(title='Bitcoin prices')                        

# Show the plot
fig.____()
Edit and Run Code