not a bird avatar

STEEM-Bash: Fixed ticker values from CryptoCompare, balances ticker, graphing, etc.

not-a-bird

Published: 23 May 2018 › Updated: 23 May 2018STEEM-Bash: Fixed ticker values from CryptoCompare, balances ticker, graphing, etc.

STEEM-Bash: Fixed ticker values from CryptoCompare, balances ticker, graphing, etc.

Repository

https://github.com/not-a-bird/steem-bash

All of the changes in this update were applied in commit 05f2da

Bug Fixes

  • What was the issue(s)?
    • Fixed quoting around requested crypto coin tickers (made necessary by weird values used by third parties)
    • Fixed strings used in fetching SBD (it's SBD* now, broken by third party (cryptocompare))

Apparently CryptoCompare added an asterisk to some of their supported currencies, for example, SBD. As a result, the single price fetch function get_price would still fetch the price of SBD via get_price SBD*, but attempts to fetch multiple feeds would fail, as was the case with balances.sh for fetching user balance information, and graphprices.sh which graphs a set of specified crypto currency values. The result is that both of these scripts broke. This actually revealed that there was another bug in functions.sh, namely, the fetched crypo price names were not being properly quoted when they were extracted from the JSON result.

  • What was the solution?
    The solution was to update functions.sh, graphprices.sh, and balances.sh in the following ways:
  1. Add variables for SBD_TICKER and STEEM_TICKER (with values SBD* and STEEM respectively,) to account for any future arbitrary changes to the tickers as used by CryptoCompare and replace all naked references to "SBD" with ${SBD_TICKER}, and all naked references to "STEEM" with ${STEEM_TIKER}.

  2. Ensure all invocations of jq for extracting ticker values from the results JSON made use of proper quoting around the respective variables. For example, graphprices.sh, for fetching the and graphing arbitrary crypto currencies used to have code like the following:

         echo -n "   $(jq -r ".${COIN}.${CURRENCY}" <<< $PRICES)"
    

This function (and others) now includes code like the following:

        echo -n "   $(jq -r ".\"${COIN}\".\"${CURRENCY}\"" <<< $PRICES)"

New Features

New feature additions were interrupted by the seemingly innocuous bug fixes, but this commit did include the addition of the following APIs:

  • rpc_get_miner_queue()
  • rpc_get_next_scheduled_hardfork()
  • rpc_get_open_orders()
  • rpc_get_ops_in_block()
  • rpc_get_state()
  • rpc_get_tags_used_by_author()

These functions were generally added by wrapping the rpc_invoke method, calling the appropriate back-end method, and preparing any arguments (which weren't very well documented at the time the implementation was completed, so it required quite a bit of trial and error.)

GitHub Account

https://github.com/not-a-bird

Leave STEEM-Bash: Fixed ticker values from CryptoCompare, balances ticker, graphing, etc. to:

Written by

I really am not.

Read more #utopian-io posts


Best Posts From not a bird

We have not curated any of not-a-bird's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From not a bird