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

in #utopian-io6 years ago

Repository

<p dir="auto"><span><a href="https://github.com/not-a-bird/steem-bash" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/not-a-bird/steem-bash <p dir="auto">All of the changes in this update were applied in commit <a href="https://github.com/not-a-bird/steem-bash/commit/05f2daaa40d5ee7ac7f8fb9cb0674f2994d107f1" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">05f2da <h3>Bug Fixes <ul> <li>What was the issue(s)? <ul> <li>Fixed quoting around requested crypto coin tickers (made necessary by weird values used by third parties) <li>Fixed strings used in fetching SBD (it's SBD* now, broken by third party (cryptocompare)) <p dir="auto">Apparently CryptoCompare added an asterisk to some of their supported currencies, for example, SBD. As a result, the single price fetch function <code>get_price would still fetch the price of SBD via <code>get_price SBD*, but attempts to fetch multiple feeds would fail, as was the case with <code>balances.sh for fetching user balance information, and <code>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 <code>functions.sh, namely, the fetched crypo price names were not being properly quoted when they were extracted from the JSON result. <ul> <li>What was the solution?<br /> The solution was to update <code>functions.sh, <code>graphprices.sh, and <code>balances.sh in the following ways: <ol> <li><p dir="auto">Add variables for <code>SBD_TICKER and <code>STEEM_TICKER (with values <code>SBD* and <code>STEEM respectively,) to account for any future arbitrary changes to the tickers as used by CryptoCompare and replace all naked references to "SBD" with <code>${SBD_TICKER}, and all naked references to "STEEM" with <code>${STEEM_TIKER}. <li><p dir="auto">Ensure all invocations of <code>jq for extracting ticker values from the results JSON made use of proper quoting around the respective variables. For example, <code>graphprices.sh, for fetching the and graphing arbitrary crypto currencies used to have code like the following: <pre><code> echo -n " $(jq -r ".${COIN}.${CURRENCY}" <<< $PRICES)" <p dir="auto">This function (and others) now includes code like the following: <pre><code> echo -n " $(jq -r ".\"${COIN}\".\"${CURRENCY}\"" <<< $PRICES)" <h3>New Features <p dir="auto">New feature additions were interrupted by the seemingly innocuous bug fixes, but this commit did include the addition of the following APIs: <ul> <li><code>rpc_get_miner_queue() <li><code>rpc_get_next_scheduled_hardfork() <li><code>rpc_get_open_orders() <li><code>rpc_get_ops_in_block() <li><code>rpc_get_state() <li><code>rpc_get_tags_used_by_author() <p dir="auto">These functions were generally added by wrapping the <code>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.) <h4>GitHub Account <p dir="auto"><span><a href="https://github.com/not-a-bird" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/not-a-bird
Sort:  

Thanks for the contribution!

It would be great if you could add some more features when submitting future contributions. Other than that it's great, everything is nicely commented, the commit message is detailed and you clearly explain everything in the post itself.



Chat with us on Discord.
[utopian-moderator]Need help? Write a ticket on https://support.utopian.io/.

Yeah, as I mentioned in the post, I was in the middle of making feature changes when I discovered that cryptocompare had changed the ticker symbols, so I had to do a bug fix commit immediately so everything would be working again. Otherwise I could end up passing the window on claiming the bug fixes and these few features by the time I was done with the next bigger batch of features.