diff --git a/docs/widgets.md b/docs/widgets.md index 86465ca8..180d10a1 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -86,6 +86,36 @@ Displays the weather (temperature and conditions) for the next few days for a gi units: imperial ``` +### Crypto Watch List + +Keep track of price changes of your favorite crypto assets. Data is fetched from [CoinGecko](https://www.coingecko.com/) + +##### Options + +**Field** | **Type** | **Required** | **Description** +--- | --- | --- | --- +**`assets`** | `string` | Required | An array of cryptocurrencies, coins and tokens. See [list of supported assets](https://api.coingecko.com/api/v3/asset_platforms) +**`currency`** | `string` | _Optional_ | The fiat currency to display price in, expressed as an ISO-4217 alpha code (see [list of currencies](https://www.iban.com/currency-codes)). Defaults to `USD` +**`sortBy`** | `number` | _Optional_ | The method of sorting results. Can be `marketCap`, `volume` or `alphabetical`. Defaults to `marketCap`. + +##### Example + +```yaml + - name: Crypto Prices + icon: fas fa-rocket + type: crypto-watch-list + options: + currency: GBP + sortBy: marketCap + assets: + - bitcoin + - ethereum + - monero + - cosmos + - polkadot + - dogecoin +``` + ### Crypto Token Price History Shows recent price history for a given crypto asset, using price data fetched from [CoinGecko](https://www.coingecko.com/) @@ -94,7 +124,7 @@ Shows recent price history for a given crypto asset, using price data fetched fr **Field** | **Type** | **Required** | **Description** --- | --- | --- | --- -**`asset`** | `string` | Required | Name of a crypto asset, coin or token to fetch price data for +**`asset`** | `string` | Required | Name of a crypto asset, coin or token to fetch price data for, see [list of supported assets](https://api.coingecko.com/api/v3/asset_platforms) **`currency`** | `string` | _Optional_ | The fiat currency to display results in, expressed as an ISO-4217 alpha code (see [list of currencies](https://www.iban.com/currency-codes)). Defaults to `USD` **`numDays`** | `number` | _Optional_ | The number of days of price history to render. Defaults to `7`, min: `1`, max: `30` days diff --git a/src/components/Widgets/CryptoWatchList.vue b/src/components/Widgets/CryptoWatchList.vue new file mode 100644 index 00000000..56d6fced --- /dev/null +++ b/src/components/Widgets/CryptoWatchList.vue @@ -0,0 +1,154 @@ + + + + + diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index ad55984e..fe4b0a9c 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -15,6 +15,7 @@ + @@ -25,6 +26,7 @@ import Weather from '@/components/Widgets/Weather.vue'; import WeatherForecast from '@/components/Widgets/WeatherForecast.vue'; import TflStatus from '@/components/Widgets/TflStatus.vue'; import CryptoPriceChart from '@/components/Widgets/CryptoPriceChart.vue'; +import CryptoWatchList from '@/components/Widgets/CryptoWatchList.vue'; import Collapsable from '@/components/LinkItems/Collapsable.vue'; export default { @@ -36,6 +38,7 @@ export default { WeatherForecast, TflStatus, CryptoPriceChart, + CryptoWatchList, }, props: { widget: Object, diff --git a/src/utils/defaults.js b/src/utils/defaults.js index 92baa584..cbc567d2 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -209,6 +209,7 @@ module.exports = { weatherForecast: 'https://api.openweathermap.org/data/2.5/forecast/daily', tflStatus: 'https://api.tfl.gov.uk/line/mode/tube/status', cryptoPrices: 'https://api.coingecko.com/api/v3/coins/', + cryptoWatchList: 'https://api.coingecko.com/api/v3/coins/markets/', }, /* URLs for web search engines */ searchEngineUrls: {