stockwatch is a console stock informational system written in go.
stockwatch uses free data provided by IEX to obtain market data. Please read and agree to the the IEX Terms of Use prior to using this program.
- stockwatch was inspired by the goiex library written by AndrewRPorter.
- Console color output is provided by the color library written by Fatih.
stockwatch is designed to run in two modes.
When stockwatch is called without any e-mail configuration it will run in a one-shot mode. This mode quickly obtains the configured stock information and promptly terminates.
When stockwatch is run by providing a to e-mail address, from e-mail address, and mail server it will run in a monitor mode. This mode will determine the open/closed time for the NYSE and e-mail you at the close of every business day with the closing prices.
Command Line Option | Environment Variable | Default Value | Purpose |
---|---|---|---|
EMAIL_ADDR | null | Destination e-mail address that will receive the end of day summary. | |
-from | EMAIL_FROM | noreply@localhost | Address the message will be sent from. |
-host | EMAIL_HOST | null | E-Mail server host. |
-invest | null | Used for tracking current investments. Please see invest below. | |
-port | EMAIL_PORT | 25 | E-Mail server port. |
-ticker | TICKERS | null | Comma separated list of stocks to report. |
-verbose | VERBOSE | false | Display current stock values every 5 seconds when run in monitor mode. |
The invest option is a method of inputting your current investments to track an overall gain/loss based on the current price. For example, say you have purchased 30 shares of amd (Advanced Micro Devices Inc.) for $28.44, and 10 more shares of amd at $30.12, and 12 shares of googl (Alphabet Inc.) for $584.67. stockwatch will take that into consideration and display your overall gain/loss based on the most recent price.
To call stockwatch with that data you supply the -invest option with the ticker, the quantity, and the purchased price in that order, separated by a comma. Like so:
stockwatch -ticker amd,googl -invest amd,30,28.44 -invest amd,10,30.12 -invest googl,12,584.67
The output would look like this:
BSD 2-Clause License
Copyright (c) 2018, TheSp1der All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.