URI:
       tticker - scripts - random scripts
  HTML git clone https://git.parazyd.org/scripts
   DIR Log
   DIR Files
   DIR Refs
       ---
       tticker (802B)
       ---
            1 #!/bin/sh
            2 
            3 [ -n "$TORIFY" ] && proxy="--proxy socks5://127.0.0.1:9050"
            4 
            5 jsonurl="http://api.bitcoincharts.com/v1/markets.json"
            6 jsonfile=/tmp/bitcoincharts.json
            7 
            8 [ $(stat --format=%Y $jsonfile) -gt $(( $(date +%s) - 900 )) ] || {
            9         printf "curling...\n"
           10         curl ${proxy} -s "$jsonurl" > "$jsonfile"
           11 }
           12 
           13 parse() {
           14         cat $jsonfile | jq \
           15                 '.[] | select( .symbol | contains("'$1'"))'
           16 }
           17 
           18 market="$1"
           19 case "$market" in
           20         bitstamp)
           21                 parse bitstampUSD
           22                 ;;
           23         bitkonan)
           24                 parse bitkonanUSD
           25                 ;;
           26         kraken)
           27                 parse krakenEUR
           28                 ;;
           29         localbtc)
           30                 parse localbtcUSD
           31                 ;;
           32         bitfinex)
           33                 parse bitfinexUSD
           34                 ;;
           35         coincheck)
           36                 parse coincheckJPY
           37                 ;;
           38         all)
           39                 cat $jsonfile | jq '.[]'
           40                 ;;
           41         *)
           42                 cat <<EOM
           43 supported markets:
           44         (*) bitstamp
           45         (*) bitkonan
           46         (*) kraken
           47         (*) localbtc
           48         (*) bitfinex
           49         (*) coincheck
           50 EOM
           51                 exit 1
           52                 ;;
           53 esac