Skip to content

MagicMirror module that displays the stock price of a single company.

License

Notifications You must be signed in to change notification settings

Timwun/MMM-SingleStock

 
 

Repository files navigation

MMM-SingleStock

This is a module for the MagicMirror² to display a single stock price without any fancy animation.

Features

By default this module displays the symbol and the current price of the configured stock:

You can configure the module to display the full name of the company instead of the stock symbol:

If you wish, you can completely remove the prefix, and display only the price value:

You can even configure any custom prefix, for example a dollar sign:

The second line of the module displays the change of the price which can be hidden if you prefer:

This module is capable to display only a single stock price. If you would like to see the price of more stocks on your mirror, add this module multiple times.

For updates, please check the CHANGELOG.

Using the module

To use this module follow these steps:

  1. Clone this repository to the modules folder of your MagicMirror:
git clone https://github.com/balassy/MMM-SingleStock.git
  1. Add the following configuration block to the modules array in the config/config.js file:
var config = {
  modules: [
    {
      module: 'MMM-SingleStock',
      position: 'top_right',
      config: {
        stockSymbol: 'GOOG',
        apiToken: 'YOUR_TOKEN',  // Unique, private API key obtained from https://iexcloud.io/console/tokens
        updateInterval: 3600000, // 1 hour in milliseconds
        showChange: true,        // false | true
        label: 'symbol'          // 'symbol' | 'companyName' | 'none' | any string
      }
    }
  ]
}

Configuration options

Option Description
stockSymbol REQUIRED The symbol of the stock of what the value should be displayed in this module.

Type: string
Default value: GOOG
apiToken REQUIRED Your unique, private API key for the IEX Cloud you can obtain from https://iexcloud.io/console/tokens.

Type: string
Default value: "" (empty string)
updateInterval Optional The frequency of when the module should query the current price of the stock.

Type: int (milliseconds)
Default value: 3600000 milliseconds (1 hour)
showChange Optional Determines whether the price difference should be also displayed.

Type: boolean
Default value: true (yes, the price difference is displayed)
label Optional Determines what prefix should be prepended to the price.

Type: string
Possible values:
symbol: The acronym of the stock (e.g. GOOG) is displayed before the price.
companyName: The full name of the company (e.g. Alphabet Inc.) is displayed before the price.
none: Nothing is displayed before the price, only the price is shown.
Any other string is displayed as is, e.g. set $ to display a dollar sign before the price number.
Default value: symbol (the acronym of the stock is displayed before the price)

How it works

This module periodically sends requests from the browser window of the MagicMirror Electron application to the IEX Cloud Service. The IEX Cloud API has multiple tiers including a free tier which is suitable for this module. However to access the API you need a unique, private API Token.

You can sign up to IEX Cloud by visiting this URL: https://iexcloud.io/cloud-login#/register/

Localization

Currently this module supports English (en) and Hungarian (hu) languages. The language can be specified in the global language setting in the config.js file.

Want to see more languages? Please contribute!

Contribution

Although for operation this module does not depend on any other module, if you would like to contribute to the codebase, please use the preconfigured linters to analyze the source code before sending a pull request. To run the linters follow these steps:

  1. Install developer dependencies:
npm install
  1. Install Grunt:
npm install -g grunt
  1. Use Grunt to run all linters:
grunt

Got feedback?

Your feedback is more than welcome, please send your suggestions, feature requests or bug reports as Github issues.

Acknowledments

Many thanks to Michael Teeuw for creating and maintaining the MagicMirror² project fully open source.

Thanks to alexyak for calling my attention to the IEX API.

Thanks to Rodrigo Ramírez Norambuena for creating the MagicMirror-Module-Template.

About the author

This project is created and maintaned by György Balássy.

About

MagicMirror module that displays the stock price of a single company.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%