|
8 | 8 | import plotly.graph_objects as go
|
9 | 9 | import plotly.express as px
|
10 | 10 |
|
11 |
| -from src.apps.treasury.util.constants import BCT_ERC20_CONTRACT |
| 11 | +from src.apps.treasury.util.constants import BCT_ERC20_CONTRACT, KLIMA_GREEN |
12 | 12 | from src.apps.treasury.data.protocol_metrics import \
|
13 | 13 | sg, last_metric, get_last_asset_price_by_address
|
14 | 14 |
|
|
26 | 26 | go.Indicator(
|
27 | 27 | mode="number",
|
28 | 28 | value=sg.query([last_metric.marketCap]),
|
29 |
| - number={"prefix": "$", "valueformat": ".2s"}, |
| 29 | + number={"prefix": "$", "valueformat": ".2s", "font": {"family": "Poppins-ExtraBold"}}, |
30 | 30 | title={
|
31 | 31 | "text":
|
32 |
| - ("KLIMA <a title='KLIMA supply multiplied by current price' href=" |
| 32 | + ("KLIMA<br><b><a title='KLIMA supply multiplied by current price' href=" |
33 | 33 | "'https://www.coinbase.com/learn/crypto-basics/what-is-market-cap'>"
|
34 |
| - "Market Cap</a>") |
| 34 | + "Market Cap</a></b>"), |
| 35 | + 'align': 'left', |
| 36 | + "font": {"family": "Poppins-Bold", 'size': 30} |
35 | 37 | },
|
36 |
| - domain={'y': [0, 0.5], 'x': [0.25, 0.75]}, |
| 38 | + domain={'y': [0, 0.35], 'x': [0.25, 0.75]}, |
37 | 39 | )
|
38 | 40 | )
|
39 | 41 |
|
|
42 | 44 | go.Indicator(
|
43 | 45 | mode="number",
|
44 | 46 | value=sg.query([last_metric.treasuryMarketValue]),
|
45 |
| - number={"prefix": "$", "valueformat": ".2s"}, |
| 47 | + number={"prefix": "$", "valueformat": ".2s", "font": {"family": "Poppins-ExtraBold"}}, |
46 | 48 | title={
|
47 | 49 | "text":
|
48 |
| - "Treasury <a href='https://en.wikipedia.org/wiki/Market_value'>Market Value</a>" |
| 50 | + "Treasury<br><b><a href='https://en.wikipedia.org/wiki/Market_value'>Market Value</a></b>", |
| 51 | + 'align': 'left', |
| 52 | + "font": {"family": "Poppins-Bold", 'size': 30} |
49 | 53 | },
|
50 |
| - domain={'y': [0.5, 1], 'x': [0.25, 0.75]}, |
| 54 | + domain={'y': [0.65, 1], 'x': [0.25, 0.75]}, |
51 | 55 | )
|
52 | 56 | )
|
53 | 57 |
|
|
131 | 135 |
|
132 | 136 |
|
133 | 137 | # TODO: style holdings as $xx.yy[m/k] (i.e. human-formatted like indicators)
|
134 |
| -# TODO: visualize targets in some way |
| 138 | +# TODO: visualize targets in a better way on single chart |
135 | 139 | # TODO: load targets from Google Sheet for ease of maintenance
|
| 140 | +color_map = { |
| 141 | + 'Op Ex': '#f2ae00', |
| 142 | + 'Carbon Forwards': '#6fff93', |
| 143 | + 'Carbon Backing': KLIMA_GREEN, |
| 144 | + 'Treasury Holdings': '#ddf641' |
| 145 | +} |
| 146 | + |
136 | 147 | green_ratio_fig = px.pie(
|
137 | 148 | green_ratio_df, values="value",
|
138 | 149 | names="bucket", hole=.3, color="bucket",
|
139 |
| - color_discrete_map={ |
140 |
| - 'Op Ex': '#f2ae00', |
141 |
| - 'Carbon Forwards': '#6fff93', |
142 |
| - 'Carbon Backing': '#00cc33', |
143 |
| - 'Treasury Holdings': '#ddf641' |
144 |
| - }, |
| 150 | + color_discrete_map=color_map, |
145 | 151 | category_orders={'bucket': order},
|
146 |
| - title="Green Ratio: Current", |
| 152 | + title="Green Ratio:<br><b>Current</b>", |
147 | 153 | )
|
148 | 154 | green_ratio_fig.update_layout(
|
149 |
| - title_x=0.5, |
| 155 | + title_x=0.1, |
| 156 | + title_font_size=30, |
| 157 | + title_font_family='Poppins-Bold', |
150 | 158 | legend=dict(
|
151 | 159 | yanchor='bottom',
|
152 |
| - y=-.5, |
153 |
| - xanchor='auto', |
154 |
| - x=.5 |
| 160 | + y=0, |
| 161 | + xanchor='left', |
| 162 | + x=1.25 |
155 | 163 | )
|
156 | 164 | )
|
157 | 165 |
|
158 | 166 | green_ratio_target_fig = px.pie(
|
159 | 167 | green_ratio_df, values="target",
|
160 | 168 | names="bucket", hole=.3, color="bucket",
|
161 |
| - color_discrete_map={ |
162 |
| - 'Op Ex': '#f2ae00', |
163 |
| - 'Carbon Forwards': '#6fff93', |
164 |
| - 'Carbon Backing': '#00cc33', |
165 |
| - 'Treasury Holdings': '#ddf641' |
166 |
| - }, |
| 169 | + color_discrete_map=color_map, |
167 | 170 | category_orders={'bucket': order},
|
168 |
| - title="<a href='https://forum.klimadao.finance/d/285-rfc-green-ratio'>Green Ratio: Target</a>", |
| 171 | + title="<a href='https://forum.klimadao.finance/d/285-rfc-green-ratio'>Green Ratio:<br><b>Target</b></a>", |
169 | 172 | )
|
170 | 173 | green_ratio_target_fig.update_layout(
|
171 |
| - title_x=0.5, |
| 174 | + title_x=0.1, |
| 175 | + title_font_size=30, |
| 176 | + title_font_family='Poppins-Bold', |
172 | 177 | legend=dict(
|
173 | 178 | yanchor='bottom',
|
174 |
| - y=-.5, |
175 |
| - xanchor='auto', |
176 |
| - x=.5 |
| 179 | + y=0, |
| 180 | + xanchor='left', |
| 181 | + x=1.25 |
177 | 182 | )
|
178 | 183 | )
|
179 | 184 |
|
180 |
| -layout = dbc.Container([ |
181 |
| - html.Div([ |
182 |
| - dbc.Row([ |
183 |
| - dbc.Col([ |
184 |
| - dcc.Graph(figure=metric_fig) |
185 |
| - ], xs=12, sm=12, md=12, lg=4, xl=4), |
186 |
| - dbc.Col([ |
187 |
| - dcc.Graph(figure=green_ratio_fig) |
188 |
| - ], xs=12, sm=6, md=6, lg=4, xl=4), |
189 |
| - dbc.Col([ |
190 |
| - dcc.Graph(figure=green_ratio_target_fig) |
191 |
| - ], xs=12, sm=6, md=6, lg=4, xl=4) |
192 |
| - ]), |
193 |
| - dbc.Row([ |
194 |
| - dbc.Col([ |
195 |
| - dbc.Button( |
196 |
| - 'Learn more', |
197 |
| - size='lg', |
198 |
| - href='https://dune.com/klimadao/klima' |
199 |
| - ) |
200 |
| - ], xs=12, sm=12, md=12, lg=12, xl=12) |
201 |
| - ]) |
202 |
| - ], className='center') |
203 |
| -], id='page_content_hud', fluid=True) |
| 185 | +layout = dbc.Container( |
| 186 | + [ |
| 187 | + html.Div([ |
| 188 | + dbc.Row([ |
| 189 | + dbc.Col([ |
| 190 | + dcc.Graph(figure=metric_fig) |
| 191 | + ], xs=12, sm=12, md=12, lg=4, xl=4), |
| 192 | + dbc.Col([ |
| 193 | + dcc.Graph(figure=green_ratio_fig) |
| 194 | + ], xs=12, sm=6, md=6, lg=4, xl=4), |
| 195 | + dbc.Col([ |
| 196 | + dcc.Graph(figure=green_ratio_target_fig) |
| 197 | + ], xs=12, sm=6, md=6, lg=4, xl=4) |
| 198 | + ]), |
| 199 | + dbc.Row([ |
| 200 | + dbc.Col([ |
| 201 | + dbc.Button( |
| 202 | + ['LEARN MORE ', html.Img(src='./assets/arrow.svg')], |
| 203 | + size='lg', |
| 204 | + href='https://dune.com/klimadao/klima' |
| 205 | + ) |
| 206 | + ], xs=12, sm=12, md=12, lg=12, xl=12) |
| 207 | + ]) |
| 208 | + ], className='center') |
| 209 | + ], |
| 210 | + id='page_content_hud', fluid=True, |
| 211 | + style={'border': f'4px solid {KLIMA_GREEN}', 'border-radius': '30px', 'padding': '20px', 'margin': '10px'} |
| 212 | +) |
0 commit comments