{"id":24967264,"url":"https://github.com/anvk/google-stocks-watch","last_synced_at":"2026-05-15T08:31:34.396Z","repository":{"id":31488642,"uuid":"35052805","full_name":"anvk/google-stocks-watch","owner":"anvk","description":"Stock ticker to pull the latest stock data and calculate gain or loss based on the purchase","archived":false,"fork":false,"pushed_at":"2017-01-04T04:38:58.000Z","size":13,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-11T00:06:49.555Z","etag":null,"topics":["google","nodejs","npm-module","stock-market","stocks"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anvk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-04T18:46:45.000Z","updated_at":"2018-01-22T22:08:24.000Z","dependencies_parsed_at":"2022-08-31T22:20:59.663Z","dependency_job_id":null,"html_url":"https://github.com/anvk/google-stocks-watch","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anvk%2Fgoogle-stocks-watch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anvk%2Fgoogle-stocks-watch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anvk%2Fgoogle-stocks-watch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anvk%2Fgoogle-stocks-watch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anvk","download_url":"https://codeload.github.com/anvk/google-stocks-watch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246131244,"owners_count":20728299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google","nodejs","npm-module","stock-market","stocks"],"created_at":"2025-02-03T12:39:35.127Z","updated_at":"2025-10-23T23:10:58.476Z","avatar_url":"https://github.com/anvk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# google-stocks-watch [![Build Status](https://travis-ci.org/anvk/google-stocks-watch.svg?branch=master)](https://travis-ci.org/anvk/google-stocks-watch)\n\n\u003e Stock ticker to pull the latest stock data and calculate gain or loss based on the purchase. Based on [google-stocks NPM](https://github.com/anvk/google-stocks)\n\n\n## Install\n\n```\n$ npm install google-stocks-watch --save\n```\n\n## API\n\n#### GoogleStocksWatch(options, callback)\n\n\u003e constructor to initialize Google Stocks Watch\n\n\u003e `options` - options for the module  \n\u003e `options.timerInterval` - (optional) how often ticker callback will be executed (in milliseconds) (default 10000)  \n\u003e `options.stocks` - object containing initial stock purchase  \n\u003e `stock.amount` - amount of purchased stocks  \n\u003e `stock.price` - initial price  \n\u003e `callback` - function callback to be executed every `timerInterval` milliseconds. Has 2 arguments: `error` and `data`  \n\n\n#### start()\n\n\u003e function to start time ticker\n\n#### stop()\n\n\u003e function to stop time ticker\n\n#### stocks\n\n\u003e property which contains initial `stocks` object\n\n## Usage\n\n```js\nvar GoogleStocksWatch = require('google-stocks-watch'),\n    googleStocksWatch;\n\nvar config = {\n  timerInterval: 8000, // milliseconds\n  stocks: {\n    'AAPL': {\n      amount: '2',\n      price: '130.10'\n    },\n    'GOOG': {\n      amount: '10',\n      price: '520.55'\n    }\n  }\n};\n\ngoogleStocksWatch = new GoogleStocksWatch(config, function(err, data) {\n  console.log(data);\n});\n\ngoogleStocksWatch.start();\n```\n\nreturned format looks like this:\n\n```js\n/**\n[ { code: 'AAPL',\n    amount: '2',\n    current_time: 'May 4, 4:47PM EDT',\n    current_price: '128.77',\n    current_total_price: '257.54',\n    purchased_price: '130.10',\n    purchased_total_price: '260.20',\n    diff: '-2.66',\n    percentage: '-1.02%' },\n  { code: 'GOOG',\n    amount: '10',\n    current_time: 'May 4, 4:46PM EDT',\n    current_price: '540.97',\n    current_total_price: '5409.70',\n    purchased_price: '520.55',\n    purchased_total_price: '5205.50',\n    diff: '204.20',\n    percentage: '3.92%' } ]\n**/\n```\n\n## Example\n\n```\nnpm run example\n```\n\n## License\n\nMIT license; see [LICENSE](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanvk%2Fgoogle-stocks-watch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanvk%2Fgoogle-stocks-watch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanvk%2Fgoogle-stocks-watch/lists"}