Modifying Candlestick Graph

Candlestick graphs are based on data which includes: Date, Open, High, Low, Close for each candle.

My data includes also additional parameter: color which can have the values: 'blue', 'yellow' or 'gray' .

Based on this value I would like to color the candle.

I don’t know how to use the color data in the update_traces .

How can I achieve this setting?

The code I used:

# Imports that you are going to need to read a file
import pandas as pd

# Import the library you need to create the chart
import plotly.graph_objs as go

# Read the file using pandas - so much easier than writing your own file I/O!
df_symbol_bar_Data = pd.read_csv("d:/spy.csv")

# Show some of the data you read
print(df_symbol_bar_Data.head())

data=[go.Candlestick(x=df_symbol_bar_Data['Date'],
                open=df_symbol_bar_Data['Open'],
                high=df_symbol_bar_Data['High'],
                low=df_symbol_bar_Data['Low'],
                close=df_symbol_bar_Data['Close'])]

fig = go.Figure(data=data)

fig.update_traces(increasing_fillcolor='green', selector=dict(type='candlestick'))
fig.update_traces(increasing_line_color='green', selector=dict(type='candlestick'))

fig.update_traces(decreasing_line_color='red', selector=dict(type='candlestick'))
fig.update_traces(decreasing_fillcolor='red', selector=dict(type='candlestick'))

fig.show()

     Date        Open        High      ...   Adj Close    Volume   Color
0  23/12/2019  321.589996  321.649994  ...  315.331268  52990000    blue
1  24/12/2019  321.470001  321.519989  ...  315.341095  20270000  yellow
2  26/12/2019  321.649994  322.950012  ...  317.019714  30911200  yellow
3  27/12/2019  323.739990  323.799988  ...  316.941162  42528800  yellow
4  30/12/2019  322.950012  323.100006  ...  315.193817  49729100    gray

[5 rows x 8 columns]

Example:

enter image description here