diff --git a/docs/widgets.md b/docs/widgets.md index 5ae64731..768d6a29 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -206,6 +206,36 @@ Shows real-time tube status of the London Underground. All options are optional. - Central ``` +### Exchange Rates + +Display current FX rates in your native currency + +

+ +##### Options + +**Field** | **Type** | **Required** | **Description** +--- | --- | --- | --- +**`apiKey`** | `string` | Required | API key for [exchangerate-api.com](https://www.exchangerate-api.com/), usually a 24-digit alpha-numeric string. You can sign up for a free account [here](https://app.exchangerate-api.com/sign-up) +**`inputCurrency`** | `string` | Required | The base currency to show results in. Specified as a 3-letter ISO-4217 code, see [here](https://www.exchangerate-api.com/docs/supported-currencies) for the full list of supported currencies, and their symbols +**`outputCurrencies`** | `array` | Required | List or currencies to show results for. Specified as a 3-letter ISO-4217 code, see [here](https://www.exchangerate-api.com/docs/supported-currencies) for the full list of supported currencies, and their symbols + +##### Example + +```yaml +- name: Exchange Rates + icon: fas fa-money-bill-wave + type: exchange-rates + options: + apiKey: xxxxxxxxxxxxxxxxxxxxxxxx + inputCurrency: GBP + outputCurrencies: + - USD + - JPY + - HKD + - KPW +``` + --- ## Dynamic Widgets diff --git a/src/components/Widgets/ExchangeRates.vue b/src/components/Widgets/ExchangeRates.vue new file mode 100644 index 00000000..e0303fef --- /dev/null +++ b/src/components/Widgets/ExchangeRates.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index d4b47836..61275373 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -17,6 +17,7 @@ + @@ -29,6 +30,7 @@ import TflStatus from '@/components/Widgets/TflStatus.vue'; import CryptoPriceChart from '@/components/Widgets/CryptoPriceChart.vue'; import CryptoWatchList from '@/components/Widgets/CryptoWatchList.vue'; import XkcdComic from '@/components/Widgets/XkcdComic.vue'; +import ExchangeRates from '@/components/Widgets/ExchangeRates.vue'; import Collapsable from '@/components/LinkItems/Collapsable.vue'; export default { @@ -42,6 +44,7 @@ export default { CryptoPriceChart, CryptoWatchList, XkcdComic, + ExchangeRates, }, props: { widget: Object, diff --git a/src/utils/defaults.js b/src/utils/defaults.js index 9e07e316..c2273693 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -211,6 +211,7 @@ module.exports = { cryptoPrices: 'https://api.coingecko.com/api/v3/coins/', cryptoWatchList: 'https://api.coingecko.com/api/v3/coins/markets/', xkcdComic: 'https://xkcd.vercel.app/', + exchangeRates: 'https://v6.exchangerate-api.com/v6/', }, /* URLs for web search engines */ searchEngineUrls: {