Introduction to CoinTools! A Cryptocurrency Chrome Extension

Words
282
Reading
2 min
9y
Listen to this post
~2 min

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 += ''
; s += ''; s += 'Total Market Cap USD'; s += '' + result['total_market_cap_usd'] + ''; s += ''; s += ''; s += 'Total 24 Hour Volumn USD'; s += '' + result['total_24h_volume_usd'] + ''; s += ''; s += ''; s += 'Bitcoin Percentage of Market Cap'; s += '' + result['bitcoin_percentage_of_market_cap'] + '%'; s += ''; s += ''; s += 'Active Currencies'; s += '' + result['active_currencies'] + ''; s += ''; s += ''; s += 'Active Assets'; s += '' + result['active_assets'] + ''; s += ''; s += ''; s += 'Active Markets'; s += '' + result['active_markets'] + ''; s += ''; s += ''; let key1 = "total_market_cap_" + currency_lower; if (key1 in result) { s += ''; s += 'Total Market Cap ' + currency_upper + ''; s += '' + result[key1] + ''; s += ''; s += ''; } let key2 = "total_24h_volume_" + currency_lower; if (key2 in result) { s += ''; s += 'Total 24 Hour Volumn ' + currency_upper + ''; s += '' + result[key2] + ''; s += ''; s += ''; } s += 'Last Updated'; s += '' + timestampToString(result['last_updated']) + ''; s += ''; s += ''; 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(''); $.ajax({ type: "GET", url: api, success: function(result) { let s = ''; s += ''
; s += ''; s += 'Coin'; s += 'Price USD'; s += 'Price BTC'; s += 'Change 1 Hours'; s += 'Change 24 Hours'; s += 'Change 7 Days'; s += 'Last Updated'; s += ''; for (let i = 0; i < result.length; i ++) { s += ''; s += '' + result[i]['name'] + ' (' + result[i]['symbol'] + ')'; s += '' + result[i]['price_usd'] + ''; s += '' + result[i]['price_btc'] + ''; s += '' + result[i]['percent_change_1h'] + ''; s += '' + result[i]['percent_change_24h'] + ''; s += '' + result[i]['percent_change_7d'] + ''; s += '' + timestampToString(result[i]['last_updated']) + ''; s += ''; } s += ''; s += ''; 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

Introduction to CoinTools! A Cryptocurrency Chrome Extension | Ecency