Currency Pulse
Exchange rates from open.er-api.com with a configurable base currency.
financefetch
Example
//
// ScriptWidget
// https://xnu.app/scriptwidget
//
// Currency Pulse (open.er-api.com)
// widget-param: base currency (optional)
//
const base = ($getenv("widget-param") || "USD").trim().toUpperCase();
const url = `https://open.er-api.com/v6/latest/${base}`;
const result = await fetch(url);
const data = JSON.parse(result);
const rates = data.rates || {};
$render(
<vstack frame="max" padding="12" background="#0f172a">
<text font="caption" color="#94a3b8">Currency Pulse</text>
<text font="title3" color="#e2e8f0">Base: {base}</text>
<hstack spacing="12">
<stat title="CNY" value={rates.CNY ? rates.CNY.toFixed(2) : "-"} subtitle="" color="#38bdf8" />
<stat title="EUR" value={rates.EUR ? rates.EUR.toFixed(2) : "-"} subtitle="" color="#22c55e" />
<stat title="JPY" value={rates.JPY ? rates.JPY.toFixed(2) : "-"} subtitle="" color="#f59e0b" />
</hstack>
</vstack>
);
Templates live in
Shared/ScriptWidgetRuntime/Resource/Script.bundle/template/ and can be imported directly into the app.