Similar to the overview for fuel prices, here is my Apple-like stock market card, using the Yahoo Finance integration: GitHub - iprak/yahoofinance: Home Assistant component which allows you to get stock updates from Yahoo finance.
Code
type: custom:stack-in-card
mode: vertical
cards:
- type: custom:layout-card
layout_type: grid
layout:
grid-template-columns: 70% 30%
grid-gap: 0px;
cards:
- type: custom:mushroom-template-card
entity: sensor.yahoofinance_aex
primary: ^AEX
secondary: '{{state_attr(entity, ''friendly_name'')}}'
icon: mdi:currency-eur
icon_color: grey
card_mod:
style:
mushroom-shape-icon$: |
.shape:after {
font-size: 20px;
content: '🇳🇱';
}
ha-icon {
width: 0px !important;
}
.: |
ha-card {
box-shadow: none;
margin: -4px -7px;
}
- type: custom:mushroom-template-card
entity: sensor.yahoofinance_aex
primary: '{{states(entity)}}'
secondary: |
{% if state_attr(entity, 'trending') == "up" %}+{% endif
%}{{state_attr(entity,'regularMarketChangePercent')}}%
card_mod:
style:
mushroom-state-info$: |
* {
text-align: end;
font-family: 'SF Pro Rounded';
}
.: |
ha-card {
--secondary-text-color: {% if state_attr(config.entity, 'trending') == "up" %}rgba(var(--rgb-green)){% else %}rgba(var(--rgb-red)){% endif %};
margin: -3px 2px -6px 0px;
box-shadow: none;
}
- type: custom:mushroom-template-card
card_mod:
style: |
ha-card {
margin: -25px 0px 0px 66px;
border-bottom: solid 2px rgba(var(--rgb-disabled), 0.2);
}
- type: custom:layout-card
layout_type: grid
layout:
grid-template-columns: 70% 30%
grid-gap: 0px;
cards:
- type: custom:mushroom-template-card
entity: sensor.yahoofinance_vusa_as
primary: VUSA.AS
secondary: '{{state_attr(entity, ''friendly_name'')}}'
icon: '{{state_attr(entity,"icon")}}'
icon_color: grey
card_mod:
style: |
ha-card {
box-shadow: none;
margin: -4px -7px;
}
- type: custom:mushroom-template-card
entity: sensor.yahoofinance_vusa_as
primary: '{{states(entity)}}'
secondary: |
{% if state_attr(entity, 'trending') == "up" %}+{% endif
%}{{state_attr(entity,'regularMarketChangePercent')}}%
card_mod:
style:
mushroom-state-info$: |
* {
text-align: end;
font-family: 'SF Pro Rounded';
}
.: |
ha-card {
--secondary-text-color: {% if state_attr(config.entity, 'trending') == "up" %}rgba(var(--rgb-green)){% else %}rgba(var(--rgb-red)){% endif %};
margin: -3px 2px -6px 0px;
box-shadow: none;
}
Just adding my old version here as well, should anyone prefer this one:
Code
square: false
columns: 2
type: grid
cards:
- type: custom:mushroom-template-card
entity: sensor.yahoofinance_aex
icon: '{{state_attr(entity,"icon")}}'
icon_color: >-
{% if state_attr(entity,'regularMarketChangePercent')|float > 0 %} green
{% else %} red {% endif %}
primary: '{{state_attr(entity, "friendly_name")}}'
multiline_secondary: true
secondary: >-
€ {{states(entity)}} ({% if state_attr(entity, 'trending') == "up" %}+{%
endif %}{{state_attr(entity,'regularMarketChangePercent')}}%)
tap_action:
action: more-info
fill_container: true
card_mod:
style: |
ha-card {
--secondary-text-color: {% if state_attr('sensor.yahoofinance_aex', 'trending') == "up" %}rgba(var(--rgb-green)){% else %}rgba(var(--rgb-red)){% endif %};
}
- type: custom:mushroom-template-card
entity: sensor.yahoofinance_vusa_as
icon: '{{state_attr(entity,"icon")}}'
icon_color: >-
{% if state_attr(entity,'regularMarketChangePercent')|float > 0 %} green
{% else %} red {% endif %}
primary: '{{state_attr(entity, "friendly_name")}}'
multiline_secondary: true
secondary: >-
€ {{states(entity)}} ({% if state_attr(entity, 'trending') == "up" %}+{%
endif %}{{state_attr(entity,'regularMarketChangePercent')}}%)
tap_action:
action: more-info
fill_container: true
card_mod:
style: |
ha-card {
--secondary-text-color: {% if state_attr('sensor.yahoofinance_vusa_as', 'trending') == "up" %}rgba(var(--rgb-green)){% else %}rgba(var(--rgb-red)){% endif %};
}