/MMM-Jast

A minimalistic stock ticker based on Yahoo's finance API for the MagicMirror² platform.

Primary LanguageTypeScriptMIT LicenseMIT

MMM-JaST - Just another Stock Ticker

version Known Vulnerabilities

This is a minimalistic stock ticker based on Yahoo's finance API for the MagicMirror² platform.
Click here for MagicMirror² Forum Thread.

Contribution welcome.

Support

I put a lot of time and effort into the creation and maintenance for this module and I'm glad so many people like it.
If you also like this module and want to thank, please rate this repository with a star or donate a small amount that is worth it to you.

Features

  • Uses Yahoo Finance API to collect current
    • stock values
    • indexes
    • cryptocurrencies
  • No API Key required
  • Multiple display modes
    • Static
    • Vertical scroll
    • Horizontal scroll
    • Table
  • Share Portfolio value and growth summary
  • Very customizable
  • Easy to use

Display modes

Horizontal

Vertical

Static

Table

Installing the Module

  1. Navigate to the MagicMirror/modules directory and execute the following command

    git clone https://github.com/jalibu/MMM-Jast
  2. Change into the MMM-Jast module folder and install runtime dependencies with

    cd MMM-Jast
    npm install
  3. Add the module configuration into the MagicMirror/config/config.js file (sample configuration):

{
  module: "MMM-Jast",
  position: "top_left",
  config: {
    currencyStyle: "code", // One of ["code", "symbol", "name"]
    fadeSpeedInSeconds: 3.5,
    lastUpdateFormat: "HH:mm",
    maxChangeAge: 1 * 24 * 60 * 60 * 1000,
    maxWidth: "100%",
    numberDecimalsPercentages: 1,
    numberDecimalsValues: 2,
    displayMode: "vertical", // One of ["none", "vertical", "horizontal", "table"]
    showColors: true,
    showCurrency: true,
    showChangePercent: true,
    showChangeValue: false,
    showChangeValueCurrency: false,
    showHiddenStocks: false,
    showLastUpdate: false,
    showPortfolioValue: false,
    showPortfolioGrowthPercent: false,
    showPortfolioGrowth: false,
    showPortfolioPerformanceValue: false,
    showPortfolioPerformancePercent: false,
    showStockPerformanceValue: false,
    showStockPerformanceValueSum: false,
    showStockPerformancePercent: false,
    stocksPerPage: 2, // Only relevant for display mode "table"
    updateIntervalInSeconds: 300,
    useGrouping: false,
    virtualHorizontalMultiplier: 2,
    stocks: [
      { name: 'BASF', symbol: 'BAS.DE', quantity: 10, purchasePrice: 70.4 },
      { name: 'SAP', symbol: 'SAP.DE', quantity: 15, purchasePrice: 90.3 },
      { name: 'Henkel', symbol: 'HEN3.DE', hidden: true },
      { name: 'Bitcoin', symbol: 'BTC-EUR' }
    ]
  }
}

Options

Option Description
currencyStyle Style of currency.

Type: String
Allowed values: "code" (EUR), "symbol" (€) or "name" (Euro)
Default value: code
displayMode Display mode for ticker.

Type: String
Allowed Values: "none", "vertical", "horizontal" or "table"
Default value: "vertical"
fadeSpeedInSeconds Animation speed for ticker.

Type: Number
Default value: 3.5
lastUpdateFormat Define dateformat, if the last update should be displayed.

Type: String
Default value: "HH:mm"
locale Option to override the global/system locale for value formatting.

Type: String
Default value: undefined (system locale)
maxChangeAge Maximum age of the last change to be recognized as current in milliseconds. Set to 0 to disable.

Type: Number
Default value: 1 * 24 * 60 * 60 * 1000 (24h)
maxWidth CSS style to limit ticker width for vertical styles.

Type: String
Default value: "100%"
numberDecimalsPercentages Number of decimals for percentages.

Type: Number
Default value: 1
numberDecimalsValues Number of decimals for stock values.

Type: Number
Default value: 2
showColors Colorize positive numbers in green, negatives in red.

Type: Boolean
Default value: true
showCurrency Show stock`s currency.

Type: Boolean
Default value: true
showChangePercent Show stocks change against last close in percent.

Type: Boolean
Default value: true
showChangeValue Show stocks change against last close in absolute value.

Type: Boolean
Default value: false
showChangeValueCurrency Show currency for change value.

Type: Boolean
Default value: false
showHiddenStocks Ignore the hidden property for each stock. This can be useful when you use the same set of stocks with multiple module instances.

Type: Boolean
Default value: false
showLastUpdate Show when the data was updated.

Type: Boolean
Default value: false
showPortfolioGrowth Show portfolio value growth summary.

Type: Boolean
Default value: false
showPortfolioGrowthPercent Show portfolio value growth summary in percent.

Type: Boolean
Default value: false
showPortfolioValue Show portfolio value.

Type: Boolean
Default value: false
showPortfolioPerformanceValue Show performance against purchase price value.

Type: Boolean
Default value: false
showPortfolioPerformancePercent Show performance against purchase price in percent.

Type: Boolean
Default value: false
showStockPerformanceValue Show performance against purchase price value.

Type: Boolean
Default value: false
showStockPerformanceValueSum Show performance against purchase price value in total.

Type: Boolean
Default value: false
showStockPerformancePercent Show performance against purchase price in percent.

Type: Boolean
Default value: false
stocksPerPage Specifies how many stocks are displayed per page on table display mode.

Type: number
Default value: 2
updateIntervalInSeconds Interval to refresh stock data from server. (min. 120)

Type: Number
Default value: 600 (10 min)
useGrouping Add grouping to high value numbers (i.e. BTC 60,000.00 EUR).

Type: Boolean
Default value: false
virtualHorizontalMultiplier Virtually repeats the stocklist in horizontal display mode to avoid whitespaces.

Type: Number
Default value: 2
stocks Array of stocks to be displayed.

Type: Array<Stock> (see below)
Default value: Sample set

Stock Object

Field Description
symbol Stock's symbol/key

Type: String
Example value: "SAP.DE"
name Optional: Stock's display name

Type: String
Example value: "SAP"
hidden Experimental! Optional: If set to true, this stock is not shown in the ticker but it is still used for portfolio calculation.

Type: Boolean
Default value: false
quantity Optional: To calculate portfolio value and growth

Type: Number
Example value: 500
purchasePrice Optional: To calculate the stock and portfolio performance

Type: Number
Example value: 500

Where the hack do I get the symbol for my favorite stocks?

The easiest way to get the symbol for your stock is to open finance.yahoo.com and use the search field on the top. You'll find the symbol either in the search preview or in the result page's URL (i.e. https://finance.yahoo.com/quote/BMW.DE?p=BMW.DE where BMW.DE would be the symbol).

Contribution and Development

This module is written in TypeScript and compiled with Rollup.
The source files are located in the /src folder. Compile target files with npm run build.

Contribution for this module is welcome!