achannarasappa / ticker Goto Github PK
View Code? Open in Web Editor NEWTerminal stock ticker with live updates and position tracking
License: GNU General Public License v3.0
Terminal stock ticker with live updates and position tracking
License: GNU General Public License v3.0
I was trying to try the app in a Windows environment when the browser started to cancel the download of the compressed file...
However, I managed to download it and execute the program, which resulted in the result:
โฏ ticker
Unhandled Exception: System.ComponentModel.Win32Exception: Operation did not complete successfully because the file contains a virus or potentially unwanted software
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at shim.CommandExecutor.execute(String process, String arguments, String working_directory, Boolean is_gui, Boolean wait_for_exit, Boolean requires_elevation)
at shim.ShimProgram.Main(String[] args)
Then I uploaded the file to VirusTotal, where seven Antivirus engines interpreted it as Malware/Malicious (including Microsoft itself). You can see the report here: https://www.virustotal.com/gui/file/6a89d65b6ffab900b0a1d66ad1b49b73d8a0aa147a6a08524c4af34c6cc4626f/detection
I want to think that this is not intended, but I don't know why this is happening...
Would like the option to be able to toggle on/off the display the my dollar balances.
I'd like to be able to press a key such as T
to toggle balance amount off, take a screen shot and toggle the balance back on. Displaying all the gains / loss and percentages are fine. I would just like a quick way to not show how much is actually invested.
In the yaml file, would like the ability to define if this feature is on or off by default at startup.
Hi
Thank you very much for this software. At the moment I use the Stocks.app from Apple, which unfortunately has a proprietary file format. YAML is much better. The first impression of your software has me excited.
Example config:
show-tags: true
show-fundamentals: true
show-separator: true
interval: 10
watchlist:
- BTC-EUR
lots:
- symbol: "BTC-EUR"
quantity: 0.24
unit_cost: 900
Let's suppose I bought 0.24 Bitcoin for 900 Euro in the past.
I now wish to see how much profit or loss I made (in percent) with today price.
I am absolutely new to the investing world, but this profit/loss percent interests me the most.
Would it be possible to edit the appearance of the quoted price for the stock? Things like font size, bold, and font color would be nice to edit to make the price stand out more I think. It would also be nice to be able to move it to a different position on the screen closer to the center of the screen imo.
Edit: I see now why the price quote is on the far right, it is to make room for the holdings column. I still think being able to adjust the appearance would be good though.
The Dark Grey is barely readable on dark terminals when there's sunlight in the room.
Edit:
This is a tricky one. ticker isn't using ANSI colors but termenv, which doesn't respect color schemes.
I patched it with fatih/color to use ANSI for most Text and it improved readability for me a lot.
I guess this is a fundamental decision everyone has to decide for themselves. I have no problem with maintaining a patch so I am fine.
diff --git a/go.mod b/go.mod
index d546e43..7b48c24 100644
--- a/go.mod
+++ b/go.mod
@@ -7,6 +7,7 @@ require (
github.com/adrg/xdg v0.3.0
github.com/charmbracelet/bubbles v0.7.5
github.com/charmbracelet/bubbletea v0.12.2
+ github.com/fatih/color v1.7.0
github.com/go-resty/resty/v2 v2.3.0
github.com/jarcoal/httpmock v1.0.7
github.com/lucasb-eyer/go-colorful v1.0.3
diff --git a/go.sum b/go.sum
index e79c0f2..d970abb 100644
--- a/go.sum
+++ b/go.sum
@@ -50,6 +50,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
+github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
@@ -145,6 +146,7 @@ github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tW
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
+github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
diff --git a/internal/ui/ui.go b/internal/ui/ui.go
index 4c03fd5..08fdb8e 100644
--- a/internal/ui/ui.go
+++ b/internal/ui/ui.go
@@ -10,19 +10,21 @@ import (
"ticker/internal/ui/component/watchlist"
"time"
- . "ticker/internal/ui/util"
+ // . "ticker/internal/ui/util"
. "ticker/internal/ui/util/text"
"github.com/charmbracelet/bubbles/viewport"
tea "github.com/charmbracelet/bubbletea"
"github.com/go-resty/resty/v2"
+ "github.com/fatih/color"
)
var (
- styleLogo = NewStyle("#ffc27d", "#f37329", true)
- styleHelp = NewStyle("#4e4e4e", "", true)
+ styleLogo = color.New(color.FgBlack, color.BgYellow).SprintFunc()
+ styleHelp = color.New(color.FgHiBlack).SprintFunc()
)
+
const (
footerHeight = 1
)
diff --git a/internal/ui/util/style.go b/internal/ui/util/style.go
index 813d84f..c0659a7 100644
--- a/internal/ui/util/style.go
+++ b/internal/ui/util/style.go
@@ -5,6 +5,7 @@ import (
"github.com/lucasb-eyer/go-colorful"
te "github.com/muesli/termenv"
+ "github.com/fatih/color"
)
const (
@@ -12,12 +13,12 @@ const (
)
var (
- StyleNeutral = NewStyle("#d4d4d4", "", false)
- StyleNeutralBold = NewStyle("#d4d4d4", "", true)
- StyleNeutralFaded = NewStyle("#616161", "", false)
- StyleLine = NewStyle("#3a3a3a", "", false)
- StyleTag = NewStyle("#d4d4d4", "#3a3a3a", false)
- StyleTagEnd = NewStyle("#3a3a3a", "#3a3a3a", false)
+ StyleNeutral = color.New(color.FgWhite).SprintFunc()
+ StyleNeutralBold = color.New(color.FgWhite, color.Bold).SprintFunc()
+ StyleNeutralFaded = color.New(color.FgHiBlack).SprintFunc()
+ StyleLine = color.New(color.FgBlack).SprintFunc()
+ StyleTag = color.New(color.FgWhite, color.BgBlack).SprintFunc()
+ StyleTagEnd = color.New(color.FgWhite, color.BgBlack).SprintFunc()
StylePricePositive = NewStyleFromGradient("#C6FF40", "#779929")
StylePriceNegative = NewStyleFromGradient("#FF7940", "#994926")
)
Hi, I was wondering if I am the only one experiencing flickering on updates of the tickers list.
I've just installed the package, and for demo purpose added AAPL,NET,TSLA tickers.
I use tmux, could be this the source of the problem?
I tested it on simple terminal, it works ok.
My os is ubuntu 20.04.
Can we get a CHANGELOG.md
appended to when new versions are released?
Describe the bug
When there is an unexpected response with making the HTTP request retrieve quotes, the UI shows blank content with no indication as to what the problem is.
To Reproduce
Steps to reproduce the behavior:
ticker -w AAPL --proxy "http://localhost:9999"
(assuming no proxy exists at this port/host)Expected behavior
UI to be populated with data or an error message indicating what the problem is
Proposed solution
When there is a HTTP error response, display message in UI or exit application with error
See #59 for more information and workaround
To follow Go conventions and to make this package go get
-able, the module path should be github.com/achannarasappa/ticker
and the package import paths should be github.com/achannarasappa/ticker/{package}
.
Currently, attempting to go get github.com/achannarasappa/ticker
(my preferred way of installing go executable programs) fails with:
package ticker/cmd: unrecognized import path "ticker/cmd": import path does not begin with hostname
quote.go
uses responseQuote.PostMarketPrice
if responseQuote.MarketState == "POST"
, however, some securities do not have a post market price. E.g. the latest price for https://query1.finance.yahoo.com/v7/finance/quote?lang=en-US®ion=US&corsDomain=finance.yahoo.com&symbols=LUS.DE
after the market has closed will still be RegularMarketPrice
. ticker
wil therefore display 0.0
as latest price.
Would be nice to be able to set a price alarm with notification ๐
Seems to be sorted by largest gain right now. Would be nice to have the option to sort alphabetically.
If visiting a Yahoo page for a ticker during the off trade hours, you can still see the growth a stock had during the day compared to the previous close (this blue rectangle).
In ticker
, however, if no trade is going on, it's equal to zeroes :(
Would it be possible to fix this somehow? :)
Does this package work natively with Apple M1 silicon?
Large position numbers would be easier to read with a thousands separator, or even better make the number format string configurable.
Problem Statement
As a user, I want to start ticker to monitor my watchlist and existing lots in the default config ~/.ticker.yml
Proposed Solution
Running ticker
without any options starts ticker
using the default ~/.ticker.yml
.
This would tie in with well with a command to add a lot.
Example usage:
ticker # starts a new ticker environment with fresh ~/.ticker.yml
# quit ticker
ticker lots add abnb --quantity 100 --unit-cost 147.00 # adds this lot to ~/.ticker.yml
ticker watch estc # add estc to watchlist
ticker # starts ticker with abnb lot and estc in the watchlist
Enhancement request: show the totals in the statusbar, aligned on the same column with the total values for each rows.
The config file is not in the default directly as mentioned here and I do not see it anywhere.
Background
Currently ticker only provides the data in a graphical user interface. To track portfolios over time or use the collected data in other ways the quotes and summaries should be printed to the stdout in a predefined format like json.
Request
In order to pipe asset and portfolio values into other tools in a CLI context, there should a command to print those values in different formats to the stdout.
Technical Details
Additional context
An example how this could look like is the "holdings" command in cointop which enables users output only the total value of a portfolio or get the current values in different format like json or csv.
Problem Statement
As a user, I want to add a lot at any time from the command line without having to edit ~/.ticker.yml
Proposed Solution
Running a command such as ticker lots add abnb --quantity 100 --unit-cost 147.00
adds this to the lots in ~/.ticker.yml
This would tie in with well with a command to start ticker without any flag.
Example usage:
ticker lots add abnb --quantity 100 --unit-cost 147.00 # adds this lot to ~/.ticker.yml
ticker # starts ticker with abnb lot
On Apple M1 running Big Sur
Problem Statement
Need to run Ticker on Docker running under Apple Silicon and Raspberry Pi
Proposed Solution
Multi-arch Docker images
delete
Problem Statement
Currently the region is hard-coded in the quote url.
Proposed Solution
It should be configurable in order to fetch the quotes from other countries.
May be displaying totals for lots (in the status line?) could be worth considering? :)
Otherwise, seems like a great app, already using it.
First of all, this is awesome! I actually wanted to write something very similar myself but did not get around to doing it. Thank you!
Additionally, it would be nice to allow an empty watchlist.
Background
Currently, data is pulled from Yahoo finance's unofficial API. Given the API is not officially supported, it could be shut down, limited, or changed in some way that makes ticker unusable which presents a serious risk.
Additionally, there are data sources that may not be covered by Yahoo finance that users may find value in using with ticker's interface.
Request
In order to add redundancy and extensibility, it would be ideal to have the option to pull from different, configurable data sources.
Technical Details
Hi,
thank you for this great useful code I will daily use but ...
Even if I used the recommended yaml file I can not display this content by using even "ticker" or "ticker -w".
Then I read back twice the explanation but did not found how to run it correctly. I even moved the yaml file from /usr/local/bin to /home or /home/ and did not get it workable.
Please tell me how to use it properly with yaml.
Have a nice day and take care.
It would be great if by default check for the configuration file in XDG_CONFIG_HOME (this is ~/.config
for 90% of people), and maybe also XDG_CONFIG_HOME/ticker as well as in ~ for a configuration file, so as not to pollute the home directory with dotfiles.
Normally I'd have just submitted a pull request but I don't know Go, but I'm happy to help with any details or clarifications about it.
Cool project!
Proposed Solution
Create Dockerfile and publish to Docker hub for easy usage without need to install the cli
Use Cases
Run Docker command to run Ticker
Additional context
Pull request already created with the solution. PR #75
Hi
thanks for ticker
please add a DONATE section in README.md
as many options as possible like crypto and classic plaforms like PayPal etc
thank yo
When storing configuration files in XDG_CONFIG_HOME, it's not typical to also have the configuration file be a hidden file.
e.g.
~/.ticker.yaml
~/.config/ticker/ticker.yaml
This issue is just a placeholder to make the config file loader a bit more robust in how it search/loads the config file to allow for a bit more leeway. The README does note the file being called .ticker.yaml
in both cases, but it would also be nice (perhaps) to allow for both styles.
Describe the solution you'd like
Automatically reload the configuration file when it changes.
Describe alternatives you've considered
Using inotifywait
or entr
.
Additional context
Using inotify on linux should be relatively easy?
It would be great to have a consumer-driven contract test run on a daily schedule with a GitHub action and a corresponding indicator badge to signal pass or failure to get ahead of any breaking API changes
As far as I can tell the interval flag and the corresponding option in the yaml configuration file is ignored thus always refreshing every 5 seconds.
Using Windows amd64 v2.2.0.
Also a version flag would be nice.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
show-fundamentals: false
show-tag: false
Expected behavior
What should happen: See the price of the last stock
What actually happens: Last stock price is covered by bottom bar
Environment (please complete the following information):
As for now, as I understand, it sorts tickers by their growth. This leads to tickers constantly changing their positions. Can sorting by name be implemented?
Or, better, sort according to the order in the configuration file if one's present (this could allow custom sorting, visually separating a group of unrelated tickers, and also other things, like putting "lots" on top, and the rest of the watchlist below).
I was thinking for Mac version to make the app send an alert when a % change occurs on a stock.
Describe the bug
I'm unable to pipe the output of ticker, for example to less
.
To Reproduce
Steps to reproduce the behavior:
ticker -w BOWL.L | less
Unable to start UI: inappropriate ioctl for device
Expected behavior
I'd expect to see output similar to top | less
Environment (please complete the following information):
Please delete.
One of my everyday routines is to update a spreadsheet with the current values of the tickers I have invested.
This system is great for that! Instead of going to a bunch of websites, I just run the terminal and it's done.
An export to JSON feature for example would be great because I could just put a script to run on the cronjob to update my spreadsheet using its data.
Thank you for the app :)
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.