반응형
import plotly.graph_objects as go
import pandas as pd
# Sample data: Date, Open, High, Low, Close
data = {
'Date': pd.date_range(start='2024-01-01', periods=5, freq='D'),
'Open': [100, 105, 103, 108, 107],
'High': [110, 108, 106, 112, 109],
'Low': [95, 102, 101, 105, 106],
'Close': [105, 107, 104, 110, 108],
}
df = pd.DataFrame(data)
# Creating the candlestick chart
fig = go.Figure(data=[go.Candlestick(x=df['Date'],
open=df['Open'], high=df['High'],
low=df['Low'], close=df['Close'],
increasing_line_color='green', decreasing_line_color='red')])
fig.update_layout(title='Candlestick Chart', xaxis_title='Date', yaxis_title='Price')
fig.show()
반응형
'Python' 카테고리의 다른 글
[Python]파이썬 출력 화면 지우기 (0) | 2024.05.10 |
---|---|
[Python]PyQt Widgets (0) | 2024.05.07 |
Dragon Moving Banner (0) | 2024.05.07 |
[Errno 13] Permission denied: '/dev/ttyUSB0' (0) | 2024.05.02 |
[Python] How to Run 70B LLMs on a Single 4GB GPU (0) | 2024.04.25 |
댓글