This commit is contained in:
2024-01-09 18:27:02 +01:00
parent 14ac62e43f
commit ab75694176
3 changed files with 118 additions and 70 deletions

View File

@@ -6,13 +6,11 @@
Based from [ticker.sh](https://github.com/pstadler/ticker.sh)
![ticker.sh](https://raw.githubusercontent.com/pstadler/ticker.sh/master/screenshot.png)
![stocks.sh](https://gitea.maboiteverte.fr/shell/stocks_mbv/raw/branch/master/screenshot.jpg)
![stocks.sh](https://gitea.maboiteverte.fr/shell/stocks_mbv/src/commit/c8e904fa4e3594ab8f878565faf61062d6401e6f/screenshot.jpg)
## Install
@@ -22,11 +20,41 @@ $ curl -o ticker.sh https://raw.githubusercontent.com/pstadler/ticker.sh/master/
## Requirements
- [jq](https://stedolan.github.io/jq/), a versatile command-line JSON processor.
- [yq](https://github.com/kislyuk/yq), a versatile command-line YAML processor (Python version).
- [jq](https://stedolan.github.io/jq/), a versatile command-line JSON processor.
- [yq](https://github.com/mikefarah/yq/), a versatile command-line YAML processor.
## Usage
#### Preferences:
```bash
# Preference file:
$ nano ~/.stocks.yaml
watchlist:
- ^FCHI
- AC.PA
- ALCLS.PA
- ATO.PA
- AUB.PA
- CS.PA
- DG.PA
- ORA.PA
- VIRP.PA
- WLN.PA
lots:
- symbol: "AUB.PA"
quantity: 600
unit_cost: 32.164
- symbol: "ORA.PA"
quantity: 700
unit_cost: 9.426
```
#### Running:
```sh
# Single symbol:
$ ./ticker.sh AAPL
@@ -34,23 +62,16 @@ $ ./ticker.sh AAPL
# Multiple symbols:
$ ./ticker.sh AAPL MSFT GOOG BTC-USD
# Read from file:
$ echo "AAPL MSFT GOOG BTC-USD" > ~/.ticker.conf
$ ./ticker.sh $(cat ~/.ticker.conf)
# Run stocks.sh:
$ ./stocks.sh
# Use different colors:
$ COLOR_BOLD="\e[38;5;248m" \
COLOR_GREEN="\e[38;5;154m" \
COLOR_RED="\e[38;5;202m" \
./ticker.sh AAPL
# Disable colors:
$ NO_COLOR=1 ./ticker.sh AAPL
# Update every five seconds:
$ watch -n 5 -t -c ./ticker.sh AAPL MSFT GOOG BTC-USD
# Or if `watch` is not available:
$ while true; do clear; ./ticker.sh AAPL MSFT GOOG BTC-USD; sleep 5; done
$ while true; do clear; ./ticker.sh; sleep 5; done
# Or
./run_stocks.sh
```