#!/usr/bin/env bash

echo "Needs to be wrapped in a checkinstall."

exit 0

DIST=${1:-/etc/skel}
TICKER_HOME=${DIST}/.config/ticker

conf_print_ticker_install() {
  cat <<EOF
curl -Ls https://api.github.com/repos/achannarasappa/ticker/releases/latest \
| grep -wo "https.*linux-amd64*.tar.gz" \
| wget -qi - \
  && tar -xvf ticker*.tar.gz ticker \
  && chmod +x ./ticker \
  && sudo mv ticker /usr/local/bin/
EOF
}
conf_print_ticker_install

conf_print_ticker_config() {
  cat <<EOF
# ~/.ticker.yaml
show-summary: true
show-tags: true
show-fundamentals: true
show-separator: true
show-holdings: true
interval: 5
currency: USD
currency-summary-only: false
watchlist:
  - NET
  - TEAM
  - ESTC
  - BTC-USD # Bitcoin price via Yahoo
  - SOL.X # Solana price via CoinGecko
  - SAMOYEDCOIN.CG # Samoyed price via CoinGecko
  - CARDANO.CC # Samoyed price via CoinCap
lots:
  - symbol: "ABNB"
    quantity: 35.0
    unit_cost: 146.00
  - symbol: "ARKW"
    quantity: 20.0
    unit_cost: 152.25
  - symbol: "ARKW"
    quantity: 20.0
    unit_cost: 145.35
    fixed_cost: 7.00 # e.g. brokerage commission fee
groups:
  - name: crypto
    watchlist:
      - SHIB-USD
      - VGX-USD
    holdings:
      - symbol: SOL1-USD
        quantity: 17
        unit_cost: 159.10
EOF
}
conf_print_ticker_config | tee "${TICKER_HOME}/ticker.conf"
