CoinTools: Historical Conversion between Any Two Cryptocurrency

Words
215
Reading
1 min
Listen
Play
9y

Introduction

CoinTools is a handy gadget to Chrome browser that you can launch easily to view the information of cryptocurrency.

Previous Contributions

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.7 Feature

Along with some added language translation, this version adds the tab of History Data so that you can view 30 days historical conversion between any two cryptocurrency or fiat currency.

History conversion between cryptocurrency and cryptocurrency
image.png

History conversion between fiat and fiat
image.png

History conversion between cryptocurrency and fiat
image.png

Commits

Here

Roadmap of CoinTools

  1. real-time graphs
  2. search cryptocurrency
  3. historical data

Javascript to handle conversion

// get history
const getHistory = (a, b, dom) => {
    let api = "https://min-api.cryptocompare.com/data/histoday?fsym=" + a + "&tsym=" + b + "&limit=30&e=CCCAGG";
    logit("calling " + api);
    dom.html('');
    $.ajax({
        type: "GET",
        url: api,
        success: function(data) {
            if (data && data.Data && data.Response == 'Success') {
                let data_open = [];
                let data_close = [];
                let data_high = [];
                let data_low = [];
                let arr = data.Data;
                let datalen = arr.length;
                for (let i = 0; i < datalen; ++ i) {
                    let date = new Date(arr[i].time * 1000);
                    data_open.push({x: date, y: arr[i].open});
                    data_close.push({x: date, y: arr[i].close});
                    data_high.push({x: date, y: arr[i].high});
                    data_low.push({x: date, y: arr[i].low});
                }
                let chart = new CanvasJS.Chart("chartContainer", {
                    title:{
                        text: a + " => " + b
                    },
                    axisY:[{
                        title: b,
                        lineColor: "#C24642",
                        tickColor: "#C24642",
                        labelFontColor: "#C24642",
                        titleFontColor: "#C24642",
                        suffix: ""
                    }],
                    toolTip: {
                        shared: true
                    },
                    legend: {
                        cursor: "pointer",
                        itemclick: function(e) {
                            if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
                                e.dataSeries.visible = false;
                            } else {
                                e.dataSeries.visible = true;
                            }
                            e.chart.render();
                        }           
                    },
                    data: [{
                        type: "line",
                        name: "Open",
                        color: "#369EAD",
                        showInLegend: true,
                        axisYIndex: 1,
                        dataPoints: data_open
                    },
                    {
                        type: "line",
                        name: "Close",
                        color: "#C24642",
                        axisYIndex: 0,
                        showInLegend: true,
                        dataPoints: data_close
                    },
                    {
                        type: "line",
                        name: "Low",
                        color: "blue",
                        axisYIndex: 0,
                        showInLegend: true,
                        dataPoints: data_low
                    },                    
                    {
                        type: "line",
                        name: "High",
                        color: "#7F6084",
                        axisYType: "secondary",
                        showInLegend: true,
                        dataPoints: data_high
                    }]
                });
                chart.render();
            }
        },
        error: function(request, status, error) {
            logit('Response: ' + request.responseText);
            logit('Error: ' + error );
            logit('Status: ' + status);
            dom.html("");
        },
        complete: function(data) {
            logit(get_text("api_finished", "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

CoinTools: Historical Conversion between Any Two Cryptocurrency | Ecency