Files
glance/config/shared/rates.yml
T

63 lines
3.4 KiB
YAML

# Macro rates box (St. Louis Fed / FRED).
# ponytail: an $include'd file must be a bare YAML sequence, so no shared anchor
# here — the three widgets repeat a static template. Don't add a `define:` key.
- type: custom-api
title: Secured Financing Rate
cache: 12h
url: https://api.stlouisfed.org/fred/series/observations?series_id=SOFR&api_key=${FRED_API_KEY}&file_type=json&sort_order=desc&limit=2
template: |
{{ $latest := .JSON.Float "observations.0.value" }}
{{ $previous := .JSON.Float "observations.1.value" }}
{{ $lastObserve := .JSON.String "observations.0.date" }}
{{ $change := sub $latest $previous }}
<div class="flex justify-between items-center gap-15">
<div class="min-width-0">
<a class="size-h3 block color-highlight" href="https://fred.stlouisfed.org/" target="_blank" rel="noreferrer">{{ .JSON.String "observations.0.value" }}%</a>
<div class="text-truncate">St. Louis Federal Reserve</div>
</div>
<div class="shrink-0">
<div class="size-h3 text-right {{ if lt $change 0.0 }}color-positive{{ else if gt $change 0.0 }}color-negative{{ end }}">{{ printf "%+.2f" $change }}%</div>
<div class="text-right" title="As of {{ $lastObserve }}" {{ $lastObserve | parseRelativeTime "DateOnly" }}></div>
</div>
</div>
- type: custom-api
title: Federal Funds Rate
cache: 12h
url: https://api.stlouisfed.org/fred/series/observations?series_id=FEDFUNDS&api_key=${FRED_API_KEY}&file_type=json&sort_order=desc&limit=2
template: |
{{ $latest := .JSON.Float "observations.0.value" }}
{{ $previous := .JSON.Float "observations.1.value" }}
{{ $lastObserve := .JSON.String "observations.0.date" }}
{{ $change := sub $latest $previous }}
<div class="flex justify-between items-center gap-15">
<div class="min-width-0">
<a class="size-h3 block color-highlight" href="https://fred.stlouisfed.org/" target="_blank" rel="noreferrer">{{ .JSON.String "observations.0.value" }}%</a>
<div class="text-truncate">St. Louis Federal Reserve</div>
</div>
<div class="shrink-0">
<div class="size-h3 text-right {{ if lt $change 0.0 }}color-positive{{ else if gt $change 0.0 }}color-negative{{ end }}">{{ printf "%+.2f" $change }}%</div>
<div class="text-right" title="As of {{ $lastObserve }}" {{ $lastObserve | parseRelativeTime "DateOnly" }}></div>
</div>
</div>
- type: custom-api
title: Real GDP
cache: 12h
url: https://api.stlouisfed.org/fred/series/observations?series_id=A191RL1Q225SBEA&api_key=${FRED_API_KEY}&file_type=json&sort_order=desc&limit=2
template: |
{{ $latest := .JSON.Float "observations.0.value" }}
{{ $previous := .JSON.Float "observations.1.value" }}
{{ $lastObserve := .JSON.String "observations.0.date" }}
{{ $change := sub $latest $previous }}
<div class="flex justify-between items-center gap-15">
<div class="min-width-0">
<a class="size-h3 block color-highlight" href="https://fred.stlouisfed.org/" target="_blank" rel="noreferrer">{{ .JSON.String "observations.0.value" }}%</a>
<div class="text-truncate">St. Louis Federal Reserve</div>
</div>
<div class="shrink-0">
<div class="size-h3 text-right {{ if lt $change 0.0 }}color-positive{{ else if gt $change 0.0 }}color-negative{{ end }}">{{ printf "%+.2f" $change }}%</div>
<div class="text-right" title="As of {{ $lastObserve }}" {{ $lastObserve | parseRelativeTime "DateOnly" }}></div>
</div>
</div>