Skip to content

Commit 55ace1a

Browse files
Merge branch 'streaming-prices'
2 parents 6c31496 + a4bcdb2 commit 55ace1a

File tree

100 files changed

+10287
-4746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+10287
-4746
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- uses: actions/checkout@v4
1010
- uses: actions/setup-go@v5
1111
with:
12-
go-version: '1.22'
12+
go-version: '1.23'
1313
- name: lint
1414
uses: golangci/golangci-lint-action@v5
1515
with:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
name: Set up Go
4242
uses: actions/setup-go@v5
4343
with:
44-
go-version: 1.22
44+
go-version: 1.23
4545
-
4646
name: Run GoReleaser
4747
uses: goreleaser/goreleaser-action@v5

.github/workflows/test-contract.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
test:
1010
strategy:
1111
matrix:
12-
go-version: [1.22.x]
12+
go-version: [1.23.x]
1313
platform: [ubuntu-latest]
1414
runs-on: ${{ matrix.platform }}
1515
steps:
@@ -19,5 +19,5 @@ jobs:
1919
uses: actions/setup-go@v5
2020
with:
2121
go-version: ${{ matrix.go-version }}
22-
- name: Test
23-
run: go run github.com/onsi/ginkgo/[email protected] -r -v ./internal/quote/yahoo/ -focus "GetQuotes Response"
22+
- name: Test Quote API
23+
run: go run github.com/onsi/ginkgo/[email protected] -r -v ./test/contract/yahoo/ -focus "GetAssetQuotes Response"

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
test:
66
strategy:
77
matrix:
8-
go-version: [1.22.x]
8+
go-version: [1.23.x]
99
platform: [ubuntu-latest, macos-latest]
1010
runs-on: ${{ matrix.platform }}
1111
env:
@@ -26,7 +26,7 @@ jobs:
2626
if: success()
2727
uses: actions/setup-go@v5
2828
with:
29-
go-version: 1.22.x
29+
go-version: 1.23.x
3030
- name: Checkout code
3131
uses: actions/checkout@v4
3232
- name: Generate coverage

.golangci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ linters:
1414
- godot
1515
- lll
1616
- funlen
17-
- gomnd
1817
- gofumpt
1918
- unparam
2019
- tagliatelle
@@ -26,6 +25,17 @@ linters:
2625
- nolintlint
2726
- mnd
2827
- copyloopvar
28+
- revive
29+
- gocognit
30+
- nestif
31+
- stylecheck
32+
- godox
33+
- cyclop
34+
- nonamedreturns
35+
- ireturn
36+
- noctx
37+
- containedctx
38+
- err113
2939
run:
3040
tests: false
3141
issues:

README.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
<h1 align="center">Ticker</h2>
99
<p align="center">
10-
Terminal stock watcher and stock position tracker
10+
Terminal stock & crypto price watcher and position tracker
1111
</p>
1212
<p align="center">
1313
<img align="center" src="./docs/ticker.gif" />
1414
</p>
1515

1616
## Features
1717

18-
* Live stock price quotes
18+
* Live stock & crypto price quotes
1919
* Track value of your stock positions
2020
* Support for multiple cost basis lots
2121
* Support for pre and post market price quotes
@@ -85,8 +85,8 @@ ticker -w NET,AAPL,TSLA
8585
|`show-summary` | |--show-summary | |show total day change, total value, and total value change|
8686
|`show-holdings` | |--show-holdings | |show holdings including weight, average cost, and quantity|
8787
|`sort` | |--sort | |sort quotes on the UI - options are change percent (default), `alpha`, `value`, and `user`|
88-
|`proxy` | |--proxy | |proxy URL for requests (default is none)|
8988
|`version` | |--version | |print the current version number|
89+
|`debug` | | | |enable debug logging to `./ticker-log-<date>.log`|
9090

9191
## Configuration
9292

@@ -107,9 +107,8 @@ watchlist:
107107
- TEAM
108108
- ESTC
109109
- BTC-USD # Bitcoin price via Yahoo
110-
- SOL.X # Solana price via CoinGecko
111-
- SAMOYEDCOIN.CG # Samoyed price via CoinGecko
112-
- CARDANO.CC # Samoyed price via CoinCap
110+
- SOL.X # Solana price via Coinbase
111+
- BIT-30MAY25-CDE.CB # Bitcoin futures contract price via Coinbase
113112
lots:
114113
- symbol: "ABNB"
115114
quantity: 35.0
@@ -132,9 +131,9 @@ groups:
132131
unit_cost: 159.10
133132
```
134133
135-
* Symbols not on the watchlist that exists in `lots` will automatically be watched
136-
* To add multiple (`quantity`, `unit_cost`) to the same `symbol`, write two `symbol` entries - see `ARKW` example above
137134
* All properties in `.ticker.yaml` are optional
135+
* Symbols not on the watchlist that exists in `lots` are implicitly added to the watchlist
136+
* To add multiple cost basis lots (`quantity`, `unit_cost`) for the same `symbol`, include two ore more entries - see `ARKW` example above
138137
* `.ticker.yaml` can be set in user home directory, the current directory, or [XDG config home](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
139138

140139
### Display Options
@@ -154,22 +153,22 @@ It's possible to set a custom sort order with the `--sort` flag or `sort:` confi
154153

155154
### Groups
156155

157-
Watchlists and holdings can be grouped in `.ticker.yml` under the `groups` property. While running `ticker`, press <kbd>TAB</kbd> to cycle forward through groups.
156+
Watchlists and holdings can be grouped in `.ticker.yml` under the `groups` property. While running `ticker`, press <kbd>TAB</kbd> to cycle forward through groups or <kbd>SHIFT+TAB</kbd> to cycle backward.
158157

159158
* If top level `watchlist` or `lots` properties are defined in the configuration file, the entries there will be added to a group named `default` which will always be shown first
160159
* Ordering is defined by order in the configuration file
161160
* The `holdings` property replaces `lots` under `groups` but serves the same purpose
162161

163162
### Data Sources & Symbols
164163

165-
`ticker` pulls price quotes from Yahoo Finance by default but also supports pulling quotes from CoinGecko which supports price quotes for most cryptocurrencies. In order to pull from a specific data source, use a source suffix:
164+
`ticker` pulls market data from a few different sources with Yahoo Finance as the default. Symbols for non default data sources follow the format `<symbol>.<source>` where `<symbol>` is the canonical symbol within that data source and `<source>` is the data source specifier. Below is a list of the supported data sources and their specifiers:
166165

167166
* *none* - symbols with no suffix will default to Yahoo Finance as the data source
168167
* `.X` - symbols with this suffix are shorthand symbols that are specific to ticker and intended to provide more concise and familiar symbols for popular assets (e.g. using `SOL.X` rather than `SOLANA.CG`)
169-
* The full list of ticker symbols can be found [here](https://github.com/achannarasappa/ticker-static/blob/master/symbols.csv). Initial values are populated with the top 250 cryptocurrencies from CoinGecko at time of release
170-
* `.CG` - symbols with this suffix will use CoinGecko as the data source. The proper coin name can be found on the CoinGecko page in the *API id* field (e.g. for `SOL` go to the coin's [page on CoinGecko](https://www.coingecko.com/en/coins/solana), find the value is `solana`, and use the symbol `SOLANA.CG` in ticker)
171-
* `.CC` - symbols with this suffix will use CoinCap as the data source. The coin name can be found on [CoinCap](https://coincap.io/) by searching for the asset by name. The name of the asset in the URL bar is the name (e.g. for `EGLD` search for "MultiversX" and on the asset page the url will have the name of the coin: `elrond-egld`)
172-
* `.CB` - symbols with this suffix will use Coinbase as the data source. The symbol can be found by searching for the asset on [Coinbase](https://www.coinbase.com/explore/s/listed) and finding the symbol for the asset. (e.g. for Starknet check the [asset page](https://www.coinbase.com/price/starknet-token) to find the symbol `STRK` and set the symbol to `STRK.CB` in ticker).
168+
* The full list of ticker symbols can be found [here](https://github.com/achannarasappa/ticker-static/blob/master/symbols.csv). Initial values are populated with the top cryptocurrencies by volume on Coinbase at the time of update
169+
* `.CB` - symbols with this suffix will use Coinbase as the data source. The symbol can be found by searching for the asset on [Coinbase](https://www.coinbase.com/explore/s/listed) and finding the symbol for the asset. (e.g. for Starknet check the [market page](https://www.coinbase.com/advanced-trade/spot/STRK-USD) to find the symbol `STRK` and set the symbol to `STRK.CB` in ticker).
170+
171+
Note: Coincap (`.CC`) and CoinGecko (`.CG`) are no longer supported after v5.0.0
173172

174173
### Currency Conversion
175174

@@ -182,7 +181,7 @@ Watchlists and holdings can be grouped in `.ticker.yml` under the `groups` prope
182181
* If a `currency` is not set (default behavior) and the `show-summary` option is enabled, the summary will be calculated in USD regardless of the exchange currency to avoid mixing currencies
183182
* Currencies are retrieved only once at start time - currency exchange rates do fluctuate over time and thus converted values may vary depending on when ticker is started
184183
* If the `currency-summary-only` is set to `true` and a value is set for `currency`, only the summary values will be converted
185-
* If `currency-disable-unit-cost-conversion` flag to `true`, currency conversion will not be done when calculating the cost basis. This can be useful for users that purchase a foreign security and want to use the currency exchange rate at the time of purchase by inputting the unit cost in their local currency (set in `currency`) rather than using the most recent currency exchange rate.
184+
* If `currency-disable-unit-cost-conversion` flag to `true`, currency conversion will not be done when calculating the cost basis. This can be useful for users that purchase a non-US asset and want to use the currency exchange rate at the time of purchase by inputting the unit cost in their local currency (set in `currency`) rather than using the most recent currency exchange rate.
186185

187186
### Custom Color Schemes
188187

@@ -221,7 +220,9 @@ $ ticker --config=./.ticker.yaml print
221220

222221
## Notes
223222

224-
* **Real-time quotes** - Quotes are pulled from Yahoo finance which may provide delayed stock quotes depending on the exchange. The major US exchanges (NYSE, NASDAQ) have real-time quotes however other exchanges may not. Consult the [help article](https://help.yahoo.com/kb/SLN2310.html) on exchange delays to determine which exchanges you can expect delays for or use the `--show-tags` flag to include timeliness of data alongside quotes in `ticker`.
223+
* **Market data delay**
224+
* _Yahoo Finance_ - Market data pulled from Yahoo finance will have some lag (<~30s) introduced by intermediary systems and certain exchanges will impose intentional delays on data. NYSE and NASDAQ offer real-time market data but other exchanges may not. Consult the [help article](https://help.yahoo.com/kb/SLN2310.html) on exchange delays to determine which exchanges you can expect delays for or use the `--show-tags` flag to include timeliness of data alongside quotes in `ticker`. Yahoo Finance also relies on polling which introduces some delay (>=5s). `refresh-interval` determines the polling frequency.
225+
* _Coinbase_ - Market data for spot assets on Coinbase is directly streamed from the exchange through a WebSocket connection and is available in near real-time. Derivatives assets (i.e. symbols with `-CDE` suffix) are polling based however Basis is updated in near real-time based on spot market data changes
225226
* **Non-US Symbols, Forex, ETFs** - The names for there may differ from their common name/symbols. Try searching the native name in [Yahoo finance](https://finance.yahoo.com/) to determine the symbol to use in `ticker`
226227
* **Terminal fonts** - Font with support for the [`HORIZONTAL LINE SEPARATOR` unicode character](https://www.fileformat.info/info/unicode/char/23af/fontsupport.htm) is required to properly render separators (`--show-separator` option)
227228

cmd/root.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ func init() { //nolint: gochecknoinits
6666
rootCmd.Flags().BoolVar(&options.ExtraInfoFundamentals, "show-fundamentals", false, "display open price, high, low, and volume for each quote")
6767
rootCmd.Flags().BoolVar(&options.ShowSummary, "show-summary", false, "display summary of total gain and loss for positions")
6868
rootCmd.Flags().BoolVar(&options.ShowHoldings, "show-holdings", false, "display average unit cost, quantity, portfolio weight")
69-
rootCmd.Flags().StringVar(&options.Proxy, "proxy", "", "proxy URL for requests (default is none)")
7069
rootCmd.Flags().StringVar(&options.Sort, "sort", "", "sort quotes on the UI. Set \"alpha\" to sort by ticker name. Set \"value\" to sort by position value. Keep empty to sort according to change percent")
7170

7271
printCmd.PersistentFlags().StringVar(&optionsPrint.Format, "format", "", "output format for printing holdings. Set \"csv\" to print as a CSV or \"json\" for JSON. Defaults to JSON.")

go.mod

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
module github.com/achannarasappa/ticker/v4
22

3-
go 1.22.0
3+
go 1.23.5
44

5-
toolchain go1.22.10
5+
toolchain go1.24rc2
66

77
require (
88
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
99
github.com/achannarasappa/term-grid v0.2.4
1010
github.com/adrg/xdg v0.4.0
1111
github.com/charmbracelet/bubbles v0.10.3
12-
github.com/charmbracelet/bubbletea v0.26.4
13-
github.com/go-resty/resty/v2 v2.7.0
14-
github.com/jarcoal/httpmock v1.0.7
12+
github.com/charmbracelet/bubbletea v1.3.3
13+
github.com/gorilla/websocket v1.5.3
1514
github.com/lucasb-eyer/go-colorful v1.2.0
1615
github.com/mitchellh/go-homedir v1.1.0
1716
github.com/muesli/reflow v0.3.0
18-
github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739
17+
github.com/muesli/termenv v0.15.2
1918
github.com/onsi/ginkgo/v2 v2.22.1
2019
github.com/onsi/gomega v1.36.2
2120
github.com/spf13/afero v1.8.1
2221
github.com/spf13/cobra v1.3.0
2322
github.com/spf13/viper v1.10.1
24-
github.com/xeipuuv/gojsonschema v1.2.0
2523
gopkg.in/yaml.v2 v2.4.0
2624
)
2725

2826
require (
29-
github.com/charmbracelet/lipgloss v0.5.0 // indirect
30-
github.com/charmbracelet/x/ansi v0.1.2 // indirect
31-
github.com/charmbracelet/x/input v0.1.0 // indirect
32-
github.com/charmbracelet/x/term v0.1.1 // indirect
33-
github.com/charmbracelet/x/windows v0.1.0 // indirect
27+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
28+
github.com/charmbracelet/lipgloss v1.0.0 // indirect
29+
github.com/charmbracelet/x/ansi v0.8.0 // indirect
30+
github.com/charmbracelet/x/term v0.2.1 // indirect
3431
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
3532
github.com/fsnotify/fsnotify v1.5.1 // indirect
3633
github.com/go-logr/logr v1.4.2 // indirect
@@ -40,9 +37,9 @@ require (
4037
github.com/hashicorp/hcl v1.0.0 // indirect
4138
github.com/inconshreveable/mousetrap v1.0.0 // indirect
4239
github.com/magiconair/properties v1.8.5 // indirect
43-
github.com/mattn/go-isatty v0.0.14 // indirect
40+
github.com/mattn/go-isatty v0.0.20 // indirect
4441
github.com/mattn/go-localereader v0.0.1 // indirect
45-
github.com/mattn/go-runewidth v0.0.15 // indirect
42+
github.com/mattn/go-runewidth v0.0.16 // indirect
4643
github.com/mitchellh/mapstructure v1.4.3 // indirect
4744
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
4845
github.com/muesli/cancelreader v0.2.2 // indirect
@@ -53,14 +50,12 @@ require (
5350
github.com/spf13/jwalterweatherman v1.1.0 // indirect
5451
github.com/spf13/pflag v1.0.5 // indirect
5552
github.com/subosito/gotenv v1.2.0 // indirect
56-
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
57-
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
58-
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
5953
golang.org/x/net v0.33.0 // indirect
60-
golang.org/x/sync v0.10.0 // indirect
61-
golang.org/x/sys v0.28.0 // indirect
54+
golang.org/x/sync v0.11.0 // indirect
55+
golang.org/x/sys v0.30.0 // indirect
6256
golang.org/x/text v0.21.0 // indirect
6357
golang.org/x/tools v0.28.0 // indirect
58+
google.golang.org/protobuf v1.36.1 // indirect
6459
gopkg.in/ini.v1 v1.66.4 // indirect
6560
gopkg.in/yaml.v3 v3.0.1 // indirect
6661
)

0 commit comments

Comments
 (0)