mop-tracker / mop Goto Github PK
View Code? Open in Web Editor NEWStock market tracker for hackers.
License: MIT License
Stock market tracker for hackers.
License: MIT License
Several places wtill showing 0.2.0
as the current version in the code. I created PR #94 to address the situation. However, accepting the changes might make the actual the version 1.0.1
. Feel free to ignore my PR and fix on your own.
If one enters a invalid filter, the program terminates, AFTER writing the bad filter to the config file. Thus, any attempt to restart the program will fail until the config file is manually edited.
More fundamentally, a keyboard user-error shouldn't panic the program to crash.
And an invalid setting should not be save to disk.
I'm not a go
programmer and don't have development set up, but eyeballing the code, I wonder if the fix is to alter line 137 in file profile.go
from:
panic(err)
to:
profile.SetFilter("")
In other words, recursively call the function with a reset value, similar to what would happen when a user enters 'F'
The terminal scrollbar does not work.
.moprc has more tickers than the 'screen' can handle.
Therefore, 36/45 are visible at anytime and cannot scroll the visualise the remaining.
The correct local time is displayed, but the displayed time zone is different (and does not match the output of "date" on local computer). For instance, it is currently 2:24 EST but the time displayed is 2:24 PST. I looked for a configuration file, but didn't see anything in .moprc.
Followed the instructions about setting up go workspace etc...
go get github.com/mop-tracker/mop/cmd/mop
results in
go get: module github.com/mop-tracker/mop@upgrade found (v0.2.0), but does not contain package github.com/mop-tracker/mop/cmd/mop
Hi,
I'm running mop on a raspberry Pi B+.
Don't know if this is a real isssue or not, but mop is using about 100% of the cpu when running on raspberry.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1071 root 20 0 848888 11256 5496 S 97,1 2,3 32:12.37 mop
Ps : I've added all the PA(PARIS) stock tickets in mop (about +200)
Have someone reproduced this issue ?
Thanks in advance
It seems like the filter only works for the Ticker column, where you can match a string: ticker=="IBM"
If you filter on a numerical column, like in the example in the readme (last <= 5
), the filter fails and is cleared in the next cycle. An example is below, where I try to filter on the "last" value.
Here is the filter expression being entered:
No results are returned. The display goes blank for a cycle, and then the filter is cleared by one of my earlier patches.
Note that filtering on a string works, e.g. filtering on ticker=="C"
:
buy mistake i added wrong filter. how can i clear that filter and run it.
not able to find '.moprc'
Version: Master as of 4-6-2020
Overview of Issue: I was sorting the change column with screen shot attached. As you can see "TSLA" at the time is 29.48 and is greater than "KMX" which is at 3.32. "TSLA" is higher and it appears is being evaluated by the the decimal from left to right and not the whole value.
This program would be excellent to use in scripts; if the output could be piped into other commands. As-is, I cannot find a way to save the output.
If you modify the .moprc
file by and and mistakenly leave a wrong coma somewhere, the whole file will get wiped.
If the .moprc file is malformed, I would expect the program to let me know and leave the .moprc file untouched.
Entering, for example SHO{
(instead of SHOP
), will result in mop displaying no ticker values at all.
The values entered by the user should be sanitized before being treated. I think something like [A-Z][A-Z_\-\.]*
or something similar (maybe limiting the number of special characters too) should work.
Running macOS 10.13.6 and doing go get
errors with:
go get github.com/mop-tracker/mop/cmd/mop
# github.com/mop-tracker/mop
go/src/github.com/mop-tracker/mop/yahoo_quotes.go:77:5: undefined: market
"1" is added to current time for every quote-refresh.
It at least seem to occur every 5s. I couldn't immediately find the cause in the code.
EDIT:
... and, the timezone seems to flip between "PST" (when 1 is added) and "CEST". The actual timestamp does however not seem to flip between CEST and PST timezone.
EDIT2:
It seems that it's not the value "1" that is added to the time string - as it's also happening now (at 3 o' clock) with a leading "3". Maybe it's because the string is one character shorter (PST vs CEST) and is written "on top" of the other string - without removing it?
Maybe you have another idea?
Love this program. Just started using it. I always check this program to verify the prices I see online, because sometimes web pages stick and need to be refreshed. Works great for the main trading session of the day, but there are actually three trading session, the pre hours, regular hours and after hours sessions. I know we have the change % -which incidentally would be nice to be able to move that to the left rather then have to set a 13 font size on the terminal which is too small for anyone who's farsighted to see without strain-, we have the change %, but it would be great to see the actual values during all three trading sessions, not just the main session. Maybe I'll give the program a go myself. :)
Thanks! Bill
It would be nice if we could get a single snapshot of output by something like
mop --single > output.txt
This would be really handy for scripting alerts and actions based on the output.
Hello,
I would like to configure a market in europe, e.g. Frankfurt in Germany, and use EUR currency.
How can I do it?
Thank you
Looks like they've updated their HTML. Do the developers have a good engineering estimate for this? I'd be interested in submitting a fix if this is something a relative Go-newbie could figure out.
Is it possible to put up/down color settings in the .moprc profile, so that we can change colors to suit our schemes?
Error fetching stock quotes...
Get http://download.finance.yahoo.com/d/quotes.csv?s=AAPL+ALXN+AMZN
Any fixes or alternative sources?
version: 2021.05.18-1 (arch current)
filter: open <= 5
panic: Value '20.99' cannot be used with the comparator '<=', it is not a number
goroutine 1 [running]:
github.com/mop-tracker/mop.(*Filter).Apply(0xc0001fa018, {0xc000310a00, 0x1a, 0xc00036dcc0})
github.com/mop-tracker/mop/filter.go:53 +0xbf6
github.com/mop-tracker/mop.(*Layout).prettify(0xc000094000, 0xc000094c40)
github.com/mop-tracker/mop/layout.go:172 +0x132
github.com/mop-tracker/mop.(*Layout).Quotes(0xc000094000, 0xc000094c40)
github.com/mop-tracker/mop/layout.go:106 +0x197
github.com/mop-tracker/mop.(*Screen).Draw(0xc000092000, {0xc0001afdd0, 0x1, 0x0})
github.com/mop-tracker/mop/screen.go:100 +0x314
main.mainLoop(0xc000092000, 0xc0000ce1c0)
github.com/mop-tracker/mop/cmd/mop/main.go:120 +0x39b
main.main()
github.com/mop-tracker/mop/cmd/mop/main.go:145 +0x15a
I might take this on.
Maybe some candle sticks, RSI/MACD? Is it not possible and that's why nobody has done it yet? I guess I'll soon find out.
$ brew install --build-from-source ./mop/homebrew/mop.rb
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from 0546d90e3 to 0d33aba0b.
No changes to formulae.
Error: undefined method `sha1' for Formulary::FormulaNamespace52726188351773fc098e4d5f1fa11500::Mop:Class
Please report this bug:
https://docs.brew.sh/Troubleshooting
/Users/keshi/Documents/Projects/GO/mop/homebrew/mop.rb:7:in `<class:Mop>'
/Users/keshi/Documents/Projects/GO/mop/homebrew/mop.rb:3:in `load_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:26:in `module_eval'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:26:in `load_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:46:in `load_formula_from_path'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:101:in `load_file'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:92:in `klass'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:88:in `get_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:281:in `factory'
/usr/local/Homebrew/Library/Homebrew/extend/ARGV.rb:46:in `block in formulae'
/usr/local/Homebrew/Library/Homebrew/extend/ARGV.rb:44:in `map'
/usr/local/Homebrew/Library/Homebrew/extend/ARGV.rb:44:in `formulae'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:118:in `install'
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'
"Error fetching market data... 10:10:02pm PST
Unable to parse http://money.cnn.com/data/markets/"
Hie, when I execute mop, I cannot see the upper banner...
Thanks you.
Quite often (as in, several times a day) I get the following (or similar?!) error:
"Get https://query1.finance.yahoo.com/v7/finance/quote\?symbols\=DANSKE.CO,ERIC-B.ST,FPKPEN.CO,SSO.OL,VWS.CO\&range\=1d\&interval\=5m\&indicators\=close\&includeTimestamps\=false\&includePrePost\=false\&corsDomain\=finance.yahoo.com\&.tsrc\=finance: read tcp 172.21.140.214:61687->87.248.1"
It seems like the ending of the error has been cropped off. But it was as much as I could retrieve.
The top left corner says: "Error fetching market data..."
Just below, it says:
"Get https://money.cnn.com/data/markets/: read tcp 172.21.140.214:62979->199.232.41.67:443: read: network is downt"
It overlays/replaces the first line of the stocks in my portfolio.
Mop doesn't update the quotes/info when this error is present.
The clock in top right corner of mop still runs (as far as I remember).
It can be "circumvented" by just closing mop, and starting it again. It immediately works when restarted.
Could one add a "try: / except:" (or whatever that would be in the go-language) statement around the retrieval of information from yahoo, so the program doesn't break when there is an error?
Let me thank you for MOP. It is awesome that I can track the stock market form the command line. Superb. 🍻
I am wondering if you are planning to add some portfolio tracker to it? Let's say I buy X mount of stock at certain price and I want to track how much I am loosing or winning.
Issue Description:
I downloaded mop by cloning this git repository. Then I issued the make
command from the root folder of this repo. I see the following error after trying to make:
go run ./cmd/mop/main.go
cmd/mop/main.go:9:2: cannot find package "github.com/michaeldv/termbox-go" in any of:
/usr/local/Cellar/go/1.11.4/libexec/src/github.com/michaeldv/termbox-go (from $GOROOT)
/Users/og-dab/go/src/github.com/michaeldv/termbox-go (from $GOPATH)
cmd/mop/main.go:8:2: cannot find package "github.com/mop-tracker/mop" in any of:
/usr/local/Cellar/go/1.11.4/libexec/src/github.com/mop-tracker/mop (from $GOROOT)
/Users/og-dab/go/src/github.com/mop-tracker/mop (from $GOPATH)
make: *** [run] Error 1
I installed go from the homebrew package manager so all my symlinks are in /usr/local/Cellar/go/1.11.4/bin
.
My path environment variable is:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
.
What can I do to remedy this error? Thank you.
This shall be the home for revamping the homebrew code to install on Mac. All other old and new issues relating to this subject will be closed and referenced here. Their conversation will also be continued here.
BREW
Error when installing using brew:
#47
Date of issue: 27.07.2018
MAKE
Error after cloning and installing through make:
#48
Date of issue: 21.01.2019
First, hats off to you for providing such a great lightweight program!
Just wondering if it's easy to provide a feature to read in multiple .moprc files? For example, if I create a one .moprc file for high-tech stocks, and create another .moprc for finance stocks, then if I just want to check all the financial stocks, I just need to open the corresponding .moprc file.
Thanks!!
http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sl1c1p2oghjkva2r2rdyj3j1 is no longer serving quote data. The following message is displayed:
It has come to our attention that this service is being used in violation of the Yahoo Terms of Service. As such, the service is being discontinued. For all future markets and equities data research, please refer to finance.yahoo.com.
In short, a new source for ticker data is needed to replace yahoo. There will likely be additional changes required to support any new data source.
I would like to use mop as it looks really good.
I installed the go language and added export GOPATH="$HOME/workspace"
to my .bashrc
I then ran source ~/.bashrc
I followed the instructions on the mop-tracker github page and get as far as:
cd $GOPATH/src/github.com/michaeldv/mop
When I run make
make build
or make install
I get a couple of error messages:
~/workspace/src/github.com/michaeldv/mop $ make make: *** No targets specified and no makefile found. Stop.
~/workspace/src/github.com/michaeldv/mop $ make build make: *** No rule to make target 'build'. Stop.
~/workspace/src/github.com/michaeldv/mop $ make install make: *** No rule to make target 'install'. Stop.
Any idea what is wrong or how I can fix it?
Thank you
`
The two hues used in the default colors are difficult to distinguish by people with red/green colorblindness (1 in 12 males). I love this terminal app concept, but consider defaulting to magenta and green or something more accessible for people with color vision deficiencies.
typical vision | red/green colorblindness |
---|---|
unable to parse http://money.cnn.com/data/market
$ sudo go get github.com/michaeldv/mop
/usr/lib/go/src/pkg/github.com/michaeldv/termbox-go/api.go:271: function ends without a return statement
installing mop will install the binary as "cmd" into $GOPATH/bin/cmd
Here is my default view, snipped to two columns for clarity:
↑Ticker Last
AMZN $2736.12
FFIV $139.11
GOOG $1397.52
ORCL $54.95
ZM $255.19
IBM $119.47
When I apply a filter such as last < 150
Amazon and Google are filtered out, but I still see Zoom ($255.19):
↑Ticker Last
FFIV $139.14
ORCL $54.92
IBM $119.41
ORCL $54.92
ZM $255.08
IBM $119.41
Am I misunderstanding the usage of filter, and the value that is represented?
EDIT: After applying a filter, if I quit from mop-tracker and reopen, then the filter appears to be applied correctly. My first thought was some sort of refresh issue, but I waited for a few minutes before stopping mop-tracker.
Here is my .moprc:
{
"Tickers": [
"AMZN",
"FFIV",
"GOOG",
"IBM",
"ORCL",
"RHT",
"ZM"
],
"MarketRefresh": 0,
"QuotesRefresh": 0,
"SortColumn": 0,
"Ascending": true,
"Grouped": true,
"Filter": "last < 150"
}
Tried to change the sort column to the PreMktChg% column. Program quit with this error:
panic: runtime error: index out of range [15] with length 15
goroutine 1 [running]:
github.com/mop-tracker/mop.(*Sorter).SortByCurrentColumn(0xc00015e030, 0xc0004bec00, 0x1d, 0x1d, 0xd)
src/github.com/mop-tracker/mop/sorter.go:195 +0x929
github.com/mop-tracker/mop.(*Layout).prettify(0xc000064600, 0xc000198980, 0xc000166e40, 0xc0, 0xd)
src/github.com/mop-tracker/mop/layout.go:177 +0x20f
github.com/mop-tracker/mop.(*Layout).Quotes(0xc000064600, 0xc000198980, 0xb162e0, 0xc00018ef2b)
src/github.com/mop-tracker/mop/layout.go:105 +0x218
github.com/mop-tracker/mop.(*Screen).Draw(0xc000023140, 0xc000145c60, 0x1, 0x1, 0x0)
src/github.com/mop-tracker/mop/screen.go:100 +0x1f3
github.com/mop-tracker/mop.(*ColumnEditor).execute(0xc0004123e0, 0x0)
src/github.com/mop-tracker/mop/column_editor.go:84 +0xad
github.com/mop-tracker/mop.(*ColumnEditor).Handle(0xc0004123e0, 0xd0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xc000145d00)
src/github.com/mop-tracker/mop/column_editor.go:44 +0xc7
main.mainLoop(0xc000023140, 0xc0001b9dc0)
src/github.com/mop-tracker/mop/cmd/mop/main.go:97 +0x43a
main.main()
src/github.com/mop-tracker/mop/cmd/mop/main.go:145 +0x1b5
Program wouldn't start again with the .moprc
SortColumn set to 15. Set it back to 1 and program started up OK again.
When adding tickers from non-US exchanges, the stock price is incorrectly shown as $
For example, AZN.L (listed on the FTSE) should be shown with a price in £ not $.
Tried installing mop this morning:
$ go get github.com/michaeldv/mop
# github.com/michaeldv/mop
go/src/github.com/michaeldv/mop/line_editor.go:204: editor.regex.Split undefined (type *regexp.Regexp has no field or method Split)
Should this variable be type *regexp instead of *regexp.Regexp?
I was wondering whether a custom option can be in implemented maybe by using an external textfile with the stocks displaced chronologically as one would wish to view them in terminal.
Would this be possible?
Thank you.
Is it possible to pull analyst ratings for tracked stocks? Most stocks on Yahoo have:
https://finance.yahoo.com/quote/SQ/analysis
Excuse me ! I wonder how can i know china stock market ?
After the changes in go.sum
introduced in bb3c408, cannot build:
go: github.com/mattn/go-runewidth@v0.0.3: missing go.sum entry; to add it:
go mod download github.com/mattn/go-runewidth
go: downloading github.com/nsf/termbox-go v0.0.0-20201124104050-ed494de23a00
go: downloading github.com/Knetic/govaluate v3.0.0+incompatible
go: github.com/mattn/go-runewidth@v0.0.3: missing go.sum entry; to add it:
go mod download github.com/mattn/go-runewidth
To fix it you can run:
rm go.sum
go get -u # <-- This can be ommited
go mod tidy
And push the changes
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.