hubot-stock-checker
Advanced tools
Comparing version 1.5.0 to 1.6.0
{ | ||
"name": "hubot-stock-checker", | ||
"version": "1.5.0", | ||
"description": "Hubot script to interact with IEX stock exchange apis. Provides stock quotes, company stats, company info and dividend history. Allows users and channels to manage watchlists of favorite stocks. And provides quick access to IEX top movers, losers, and winners collections.", | ||
"version": "1.6.0", | ||
"description": "Hubot script to interact with IEX stock exchange apis. Provides stock quotes, company stats, company info and dividend history. Allows users and channels to manage watchlists of favorite stocks, check value of saved holdings, and provides quick access to the IEX top movers, losers, and winners collections.", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -30,3 +30,3 @@ Get quick stats on any stock by asking your hubot! | ||
* `hubot save stock (symbol)` - Saves the symbol to the current channel's watchlist. | ||
* `hubot delete stock (symbol)` - Saves the symbol to the current channel's watchlist. | ||
* `hubot delete stock (symbol)` - Deletes the symbol from the current channel's watchlist. | ||
* `hubot list (our/my) favorites` - Lists basic stock stats for each of the saved symbols. | ||
@@ -40,2 +40,9 @@ | ||
### Saved Holdings | ||
* `hubot save (number) shares of (symbol)` - Saves the symbol and shares count to the current channel's holdings. | ||
* `hubot delete shares of (symbol)` - Deletes the symbol and shares count from the current channel's holdings. | ||
* `hubot save (number) shares of (symbol)` - Lists all holdings for the current channel showing price and value (price * shares). | ||
## Installation | ||
@@ -54,2 +61,9 @@ | ||
### 1.6.0 | ||
* Added after hours price and movements when applicable. | ||
* Added saved holdings to each channel. Allows users to notate current holdings and get valuation in one simple command. | ||
* Holdings and favorites are managed separately. | ||
* Each channel, group, or direct message maintains it's own holdings list and favorites list. | ||
### 1.5.0 | ||
@@ -56,0 +70,0 @@ |
@@ -16,5 +16,11 @@ // Description: | ||
// hubot get stock (symbol) news - Returns related news articles as replies in a thread. | ||
// hubot save stock (symbol) - Saves the symbol to the current channel's watchlist. | ||
// hubot delete stock (symbol) - Deletes the symbol from the current channel's watchlist. | ||
// hubot list my/our favorites - Lists basic stock stats for each of the saved symbols. | ||
// hubot get stock top losers - Returns stocks with the most downward movement. (max 5). 'get' is optional. | ||
// hubot get stock top movers - Returns stocks with the most movement, absolute value. (max 5). 'get' is optional. | ||
// hubot get stock top winners - Returns stocks with the most upward movement. (max 5). 'get' is optional. | ||
// hubot save (number) shares of (symbol) - Saves the stock symbol and shares count to the current channel's holdings. | ||
// hubot delete shares of (symbol) - Deletes the stock symbol and shares count from the current channel's holdings. | ||
// hubot list my/our holdings - Lists all stock holdings for the current channel showing price and value (price * shares). | ||
// | ||
@@ -21,0 +27,0 @@ // Author: |
@@ -1,2 +0,2 @@ | ||
const numeral = require('numeral'); | ||
const numeral = require("numeral"); | ||
@@ -20,6 +20,19 @@ function mny(x) { | ||
function simpleStockSummary(x) { | ||
let extendedHours = ""; | ||
if (x.extendedPriceTime > x.closeTime) { | ||
let priceTime = new Date(x.extendedPriceTime); | ||
let extGraphic = x.extendedChangePercent > 0 ? "▲" : "▼"; | ||
extendedHours = `\n_${extGraphic} After Hours | Price: ${mny3(x.extendedPrice)} (${pct(x.extendedChangePercent)}) | Time: ${priceTime.toLocaleTimeString("en-US", { timeZone: "America/New_York"})} (ET)_`; | ||
} | ||
let graphic = x.changePercent > 0 ? "▲" : "▼"; | ||
return `${graphic} ${x.companyName} (${x.symbol}) | Price: ${mny3(x.latestPrice)} (${pct(x.changePercent)}) | Day: ${mny(x.low)} - ${mny(x.high)} | Year: ${mny(x.week52Low)} - ${mny(x.week52High)} | Market Cap: ${mny(x.marketCap)}`; | ||
return `${graphic} ${x.companyName} (${x.symbol}) | Price: ${mny3(x.latestPrice)} (${pct(x.changePercent)}) | Day: ${mny(x.low)} - ${mny(x.high)} | Year: ${mny(x.week52Low)} - ${mny(x.week52High)} | Market Cap: ${mny(x.marketCap)}${extendedHours}`; | ||
} | ||
function holdingsSummary(stock, shares) { | ||
let graphic = stock.changePercent > 0 ? "▲" : "▼"; | ||
let price = (stock.extendedPriceTime > stock.closeTime) ? stock.extendedPrice : stock.latestPrice; | ||
let value = shares * price; | ||
return `${graphic} ${stock.companyName} | Price: ${mny3(stock.latestPrice)} (${pct(stock.changePercent)}) | Value: ${mny3(value)}`; | ||
} | ||
module.exports = { | ||
@@ -30,3 +43,4 @@ mny, | ||
std, | ||
simpleStockSummary | ||
simpleStockSummary, | ||
holdingsSummary | ||
}; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
22577
10
324
127
0