Introduction to CoinTools! A Cryptocurrency Chrome Extension

in #utopian-io6 years ago (edited)

Introduction

CoinTools is A Chrome Extension that has a few useful tools and graphs for Cryptocurrency. When is a good time to convert your STEEM or SBD to BTC and then Fiat? I always ask myself this question. One easy method is to use BTC or any fiat currency of your interests, observe the exchange rate e.g. 1 BTC = ? STEEM and make a decision when the exchange rate is at satisfaction, i.e. 1 BTC = 2000 STEEM is better than 1 BTC = 1500 STEEM if you are holding STEEMs, because you need fewer STEEMs to convert to 1 BTC, which is in your favor.

Motivation

Chrome Extension is a good entry point since a lot of users use Chrome heavily every day. I need a tool that can give me a quick rate as discussed in the introduction. Therefore, I have developed CoinTools - Thee Chrome Extension of Cryptocurrency.

Technology Stacks

Javascript that runs in Chrome.

Github

https://github.com/DoctorLai/CoinTools

Chrome Webstore

It is available online at Chrome Webstore:
https://chrome.google.com/webstore/detail/coin-tools/fmglcggbdcbkpkfapngjobfeakehpcgj

v0.0.1 Feature

The first version has the following features:

  1. Global Data
  2. Ranking Table of Top 100 Coins
  3. Select your local currency
  4. Log tab

Roadmap of CoinTools

  1. Easy conversion between any two coins or currency
  2. Localisation
  3. Realtime Graphs

Screenshots

General Tab shows a few global statistics.
image.png

Top 100 coins
image.png

Select your preferred currency (FIAT)
image.png

Log tab.
image.png

Javascript code that connects the CoinMarketCap API

Ajax Javascript code that calls CoinMarketCap API.

// general data from coinmarkcap
const getGeneralData = (currency, dom) => {
    let currency_upper = currency.toUpperCase();
    let currency_lower = currency.toLowerCase();
    let api = "https://api.coinmarketcap.com/v1/global/";
    if (currency != '') {
        api += "?convert=" + currency_upper;
    }
    logit("calling " + api);
    $.ajax({
        type: "GET",
        url: api,
        success: function(result) {
            let s = '';
            s += '<table>';
            s += '<tr>';
            s += '<td>Total Market Cap USD</td>';
            s += '<td>' + result['total_market_cap_usd'] + '</td>';
            s += '</tr>';
            s += '<tr>';
            s += '<td>Total 24 Hour Volumn USD</td>';
            s += '<td>' + result['total_24h_volume_usd'] + '</td>';
            s += '</tr>';
            s += '<tr>';
            s += '<td>Bitcoin Percentage of Market Cap</td>';
            s += '<td>' + result['bitcoin_percentage_of_market_cap'] + '%</td>';
            s += '</tr>';
            s += '<tr>';
            s += '<td>Active Currencies</td>';
            s += '<td>' + result['active_currencies'] + '</td>';
            s += '</tr>';
            s += '<tr>';
            s += '<td>Active Assets</td>';
            s += '<td>' + result['active_assets'] + '</td>';
            s += '</tr>';
            s += '<tr>';
            s += '<td>Active Markets</td>';
            s += '<td>' + result['active_markets'] + '</td>';
            s += '</tr>';
            s += '<tr>';
            let key1 = "total_market_cap_" + currency_lower;
            if (key1 in result) {
                s += '<tr>';
                s += '<td>Total Market Cap ' + currency_upper + '</td>';
                s += '<td>' + result[key1] + '</td>';
                s += '</tr>';
                s += '<tr>';
            }
            let key2 = "total_24h_volume_" + currency_lower;
            if (key2 in result) {
                s += '<tr>';
                s += '<td>Total 24 Hour Volumn ' + currency_upper + '</td>';
                s += '<td>' + result[key2] + '</td>';
                s += '</tr>';
                s += '<tr>';
            }
            s += '<td>Last Updated</td>';
            s += '<td>' + timestampToString(result['last_updated']) + '</td>';
            s += '</tr>';            
            s += '</table>';
            dom.html(s);
        },
        error: function(request, status, error) {
            logit('Response: ' + request.responseText);
            logit('Error: ' + error );
            logit('Status: ' + status);
        },
        complete: function(data) {
            logit("API Finished: " + api);
        }             
    }); 
}

// get ranking table from coinmarketcap
const getRankingTable = (currency, dom, limit = 100) => {
    let currency_upper = currency.toUpperCase();
    let currency_lower = currency.toLowerCase();
    let api = "https://api.coinmarketcap.com/v1/ticker/?limit=" + limit;
    if (currency != '') {
        api += "&convert=" + currency_upper;
    }
    logit("calling " + api);
    dom.html('<img src="images/loading.gif" />');
    $.ajax({
        type: "GET",
        url: api,
        success: function(result) {
            let s = '';
            s += '<table id="ranking" class="sortable">';
            s += '<thead><tr>';
            s += '<th class=sorttable_sorted>Coin</th>';
            s += '<th>Price USD</th>';
            s += '<th>Price BTC</th>';
            s += '<th>Change 1 Hours</th>';
            s += '<th>Change 24 Hours</th>';
            s += '<th>Change 7 Days</th>';
            s += '<th>Last Updated</th>';
            s += '</tr></thead><tbody>';            
            for (let i = 0; i < result.length; i ++) {
                s += '<tr>';
                s += '<td>' + result[i]['name'] + ' (' + result[i]['symbol'] + ')</td>';
                s += '<td>' + result[i]['price_usd'] + '</td>';
                s += '<td>' + result[i]['price_btc'] + '</td>';
                s += '<td>' + result[i]['percent_change_1h'] + '</td>';
                s += '<td>' + result[i]['percent_change_24h'] + '</td>';
                s += '<td>' + result[i]['percent_change_7d'] + '</td>';
                s += '<td>' + timestampToString(result[i]['last_updated']) + '</td>';
                s += '</tr>';
            }
            s += '</tbody>';
            s += '</table>';
            dom.html(s);
            sorttable.makeSortable(document.getElementById("ranking"));
        },
        error: function(request, status, error) {
            logit('Response: ' + request.responseText);
            logit('Error: ' + error );
            logit('Status: ' + status);
        },
        complete: function(data) {
            logit("API Finished: " + api);
        }             
    }); 
}

License

MIT

Contribution Welcome

Github: https://github.com/DoctorLai/CoinTools/

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

Chrome Webstore

Install the CoinTools Now!



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

非常好用, 感谢。

多谢捧场,我会慢慢的加些更好用的功能。

amazing work. always learn something from you!

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Thank you very much!

1UP-Kayrex_tiny.png

You've got upvoted by Utopian-1UP!

You can give up to ten 1UP's to Utopian posts every day after they are accepted by a Utopian moderator and before they are upvoted by the official @utopian-io account. Install the @steem-plus browser extension to use 1UP. By following the 1UP-trail using SteemAuto you support great Utopian authors and earn high curation rewards at the same time.


1UP is neither organized nor endorsed by Utopian.io!

Coins mentioned in post:

CoinPrice (USD)📈 24h📈 7d
BTCBitcoin8870.490$7.01%28.06%
GETGET Protocol1.334$-9.52%45.93%
SBDSteem Dollars4.762$2.56%65.98%
STEEMSteem4.222$3.45%30.05%

Hey @justyy I am @utopian-io. I have just upvoted you!

Achievements

  • WOW WOW WOW People loved what you did here. GREAT JOB!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

a good post, I really like what you share. good luck brother. Steady...!!!

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 63974.07
ETH 3426.40
USDT 1.00
SBD 2.54