Skip to content

Commit

Permalink
Update candlestick-charts.qmd
Browse files Browse the repository at this point in the history
address line wrapping
  • Loading branch information
s2t2 authored Sep 11, 2024
1 parent d61e372 commit 591fe83
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions docs/notes/dataviz/candlestick-charts.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ We start with some OHLC data:

```{python}
ohlc_data = [
{"date": "2030-03-16", "open": 236.2800, "high": 240.0550, "low": 235.9400, "close": 237.7100, "volume": 28092196},
{"date": "2030-03-15", "open": 234.9600, "high": 235.1850, "low": 231.8100, "close": 234.8100, "volume": 26042669},
{"date": "2030-03-12", "open": 234.0100, "high": 235.8200, "low": 233.2300, "close": 235.7500, "volume": 22653662},
{"date": "2030-03-11", "open": 234.9600, "high": 239.1700, "low": 234.3100, "close": 237.1300, "volume": 29907586},
{"date": "2030-03-10", "open": 237.0000, "high": 237.0000, "low": 232.0400, "close": 232.4200, "volume": 29746812}
{"date": "2030-03-16", "open": 236.2800, "high": 240.0550,
"low": 235.9400, "close": 237.7100, "volume": 28092196},
{"date": "2030-03-15", "open": 234.9600, "high": 235.1850,
"low": 231.8100, "close": 234.8100, "volume": 26042669},
{"date": "2030-03-12", "open": 234.0100, "high": 235.8200,
"low": 233.2300, "close": 235.7500, "volume": 22653662},
{"date": "2030-03-11", "open": 234.9600, "high": 239.1700,
"low": 234.3100, "close": 237.1300, "volume": 29907586},
{"date": "2030-03-10", "open": 237.0000, "high": 237.0000,
"low": 232.0400, "close": 232.4200, "volume": 29746812}
]
```

Expand Down Expand Up @@ -53,9 +58,10 @@ Finally, creating the chart:


```{python}
from plotly.graph_objects import Figure, Candlestick #, Scatter
from plotly.graph_objects import Figure, Candlestick
stick = Candlestick(x=dates, open=opens, high=highs, low=lows, close=closes)
stick = Candlestick(x=dates, open=opens, high=highs,
low=lows, close=closes)
fig = Figure(data=[stick])
fig.update_layout(title="Example Candlestick Chart")
Expand Down

0 comments on commit 591fe83

Please sign in to comment.