/
dashboard.qmd
98 lines (75 loc) · 1.51 KB
/
dashboard.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
title: "Stock Explorer"
author: "Ty Coon"
logo: logo.png
format:
dashboard:
theme: [yeti, custom.scss]
---
```{python}
#| tags: [parameters]
# to render w/ a different ticker parameter:
# quarto render dashboard.qmd -P ticker:GOOG
ticker = "BA"
```
```{python}
import helpers
stock = helpers.get_stock(ticker)
data = helpers.get_data(stock)
```
## Row
```{python}
from IPython.display import Markdown
Markdown("**{symbol}** --- {longName} --- [{website}]({website})"
.format(**stock.info))
```
## Row
```{python}
#| content: valuebox
#| title: "Current Price"
dict(
icon = "currency-dollar",
color = "secondary",
value = helpers.get_price(data)
)
```
```{python}
#| content: valuebox
#| title: "Change"
change = helpers.get_change(data)
dict(
value = change['amount'],
icon = change['icon'],
color = change['color']
)
```
```{python}
#| content: valuebox
#| title: "Percent Change"
dict(
icon = "percent",
color = "light",
value = change['percent'],
)
```
## Row
### Column {width=75%}
```{python}
#| title: Price History
#| padding: 0
helpers.make_candlestick_chart(data, ticker.upper())
```
### Column {width=25%}
```{python}
ohlc = helpers.make_OHLC_table(data)
```
::: {.card}
#### Last Close: `{python} ohlc['date']`
| Close | `{python} ohlc['close']` |
|:-------|--------------------------:|
| Open | `{python} ohlc['open']` |
| High | `{python} ohlc['high']` |
| Low | `{python} ohlc['low']` |
| Volume | `{python} ohlc['volume']` |
: {.striped}
:::