Skip to content

Commit

Permalink
Merge branch 'main' of github.com:prof-rossetti/python-for-finance in…
Browse files Browse the repository at this point in the history
…to main
  • Loading branch information
s2t2 committed Sep 15, 2024
2 parents 76180f6 + 4a40025 commit 15d3a01
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 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,7 +58,7 @@ 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)
Expand Down

0 comments on commit 15d3a01

Please sign in to comment.