I am having trouble plotting values on Candlestick plotly chart. For some reason, I get all green bars instead of green/red bars. Green for when values are up and red when the values go down.
Here is my code that you can run as is if you just install cbpro:
# Import Dependencies
import time
import cbpro
import pandas as pd
import json
import plotly.graph_objects as go
from datetime import datetime
# Establish Public Client
public_client = cbpro.PublicClient()
# Create start and end time variable
stime = public_client.get_time()
etime = list(public_client.get_time().values())[0]
# Get past transaction for ETH
past_transactions = pd.DataFrame(public_client.get_product_historic_rates(product_id='ETH-USD'))
# Rename the columsn
past_transactions.columns= ["Date","Open","High","Low","Close","Volume"]
# Format the date
past_transactions['Date'] = pd.to_datetime(past_transactions['Date'], unit='s')
# Set the date as index
past_transactions.set_index('Date', inplace=True)
# Sorting values by date
past_transactions.sort_values(by='Date', ascending=True, inplace=True)
# Plot the values on CandleStick plotly chart
fig = go.Figure(data=[go.Candlestick(x= past_transactions.index,
open = past_transactions['Open'],
high = past_transactions['High'],
low = past_transactions['Low'],
close = past_transactions['Close']
)])
fig.show()
past_transactions
What am I doing wrong here?


