Skip to content

Instantly share code, notes, and snippets.

@mohamedhayibor
Last active August 30, 2017 23:19
Show Gist options
  • Save mohamedhayibor/03cbbfa3a3a90e057e6c4e49fba8f50f to your computer and use it in GitHub Desktop.
Save mohamedhayibor/03cbbfa3a3a90e057e6c4e49fba8f50f to your computer and use it in GitHub Desktop.
Automates the search of a security on Google finance, Yahoo Finance, Bloomberg and Morningstar.
#!/usr/bin/env node
/**
* This program automates the opening of a security's
* general description and data from:
* - Google Finance
* - Yahoo Finance
* - Bloomberg
* - Morningstar
*/
const open = require('open');
const meow = require('meow');
const cli = meow(`
Usage:
$ opall <ticker>
Exple:
$ opall aapl
Opens all ticker links on:
google, yahoo, bloomberg and morningstar
`, {
alias: {
'v': 'version',
'h': 'help'
}
});
let ticker = cli.input.join().trim().toUpperCase();
open(`https://www.google.com/finance?q=${ ticker }`);
open(`https://finance.yahoo.com/quote/${ ticker }/?p=${ ticker }`);
open(`https://www.bloomberg.com/quote/${ ticker }:US`);
open(`https://www.morningstar.com/funds/xnas/${ ticker }/quote.html`);
  1. If you don't have NodeJS already download it. You'll get npm with it.

  2. Create a new file named package.json with the following content:

{
  "name": "open-fin-links",
  "version": "0.0.0",
  "description": "",
  "main": "open-all.js",
  "bin": {
    "opall": "open-all.js"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": ""
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "bugs": {
    "url": ""
  },
  "homepage": "",
  "dependencies": {
    "meow": "^3.7.0",
    "open": "0.0.5"
  }
}

If you haven't done so already copy open-all.js to your current directory and name it as is.

  1. Execute:
> npm install
> npm link

This will allow you to run opall from any directory.

  1. Now the setup should work
> opall aapl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment