diff --git a/docs/widgets.md b/docs/widgets.md index 768d6a29..109bdf2a 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -236,6 +236,31 @@ Display current FX rates in your native currency - KPW ``` +### Stock Price History + +Shows recent price history for a given publicly-traded stock or share + +

+ +##### Options + +**Field** | **Type** | **Required** | **Description** +--- | --- | --- | --- +**`apiKey`** | `string` | Required | API key for [Alpha Vantage](https://www.alphavantage.co/), you can get a free API key [here](https://www.alphavantage.co/support/#api-key) +**`stock`** | `string` | Required | The stock symbol for the asset to fetch data for +**`priceTime`** | `string` | _Optional_ | The time to fetch price for. Can be `high`, `low`, `open` or `close`. Defaults to `high` + +##### Example + +```yaml +- name: CloudFlare Stock Price + icon: fas fa-analytics + type: stock-price-chart + options: + stock: NET + apiKey: PGUWSWD6CZTXMT8N +``` + --- ## Dynamic Widgets diff --git a/src/components/Widgets/StockPriceChart.vue b/src/components/Widgets/StockPriceChart.vue new file mode 100644 index 00000000..c4dcbf94 --- /dev/null +++ b/src/components/Widgets/StockPriceChart.vue @@ -0,0 +1,176 @@ + + + + + diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index 61275373..ba78aae4 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -18,6 +18,7 @@ + @@ -31,6 +32,7 @@ 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 StockPriceChart from '@/components/Widgets/StockPriceChart.vue'; import Collapsable from '@/components/LinkItems/Collapsable.vue'; export default { @@ -45,6 +47,7 @@ export default { CryptoWatchList, XkcdComic, ExchangeRates, + StockPriceChart, }, props: { widget: Object, diff --git a/src/utils/defaults.js b/src/utils/defaults.js index c2273693..8f978675 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -212,6 +212,7 @@ module.exports = { cryptoWatchList: 'https://api.coingecko.com/api/v3/coins/markets/', xkcdComic: 'https://xkcd.vercel.app/', exchangeRates: 'https://v6.exchangerate-api.com/v6/', + stockPriceChart: 'https://www.alphavantage.co/query', }, /* URLs for web search engines */ searchEngineUrls: {