CoinCap.io Websocket

Developer
Size
2,173 Kb
Views
12,144

How do I make an coincap.io websocket?

Work in Progress.. I'm using socket.io-1.4.5.js to connect with coincap.io's websocket.. What is a coincap.io websocket? How do you make a coincap.io websocket? This script and codes were developed by Nepal Bitcoin on 08 December 2022, Thursday.

CoinCap.io Websocket Previews

CoinCap.io Websocket - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CoinCap.io Websocket</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel='stylesheet prefetch' href='http://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css'>
</head>
<body> <table width="100%" id="table"> <thead> <tr> <th>#</th> <th>Name (Symbol)</th> <th>Price (रु)</th> <th>Volume(रु/24h)</th> <th>Market Cap (रु)</th> <th>Supply</th> <th>24h</th> <th>रु.1</th> </tr> </thead> <tbody id="Crypto"> </tbody>
</table> <script src='http://code.jquery.com/jquery-1.12.4.min.js'></script>
<script src='http://cdn.socket.io/socket.io-1.4.5.js'></script>
<script src='http://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

CoinCap.io Websocket - Script Codes JS Codes

var Table;
$(document).ready(function() { var Table = $('#table').DataTable();
});
var USDNPR = 106.33;
var socket = io.connect('https://coincap.io');
function redraw (){
Table.order( [[ 1, 'asc' ]] ).draw() ;
}
socket.on('trades', function(tradeMsg) { //dataX(); var X = document.getElementById("Crypto"); //console.log(tradeMsg.message.msg); var msgx = tradeMsg.message.msg; //console.log(msgx.long); var Y = document.getElementById("TR_" + msgx.short); var Price = msgx.price * USDNPR; if (Y === null) { X.innerHTML += '<tr id="TR_' + tradeMsg.message.coin + '"><td>' + msgx.position24 + '</td><td>' + msgx.long + ' \(' + msgx.short + '\)</td><td>' + Price.toFixed(Price < 1 ? 8 : 2) + '</td><td>' + (msgx.volume * USDNPR).toFixed(0) + '</td><td>' + (msgx.mktcap * USDNPR).toFixed(0) + '</td><td>' + msgx.supply + ' ' + msgx.short + '</td><td>' + msgx.cap24hrChange + '</td><td>' + (1 / Price).toFixed((1 / Price) < 1 ? 8 : 2) + ' ' + msgx.short + '</td></tr>'; // redraw(); } else { Y.innerHTML = '<td>' + msgx.position24 + '</td><td>' + msgx.long + ' \(' + msgx.short + '\)</td><td>' + Price.toFixed(Price < 1 ? 8 : 2) + '</td><td>' + (msgx.volume * USDNPR).toFixed(0) + '</td><td>' + (msgx.mktcap * USDNPR).toFixed(0) + '</td><td>' + msgx.supply + ' ' + msgx.short + '</td><td>' + msgx.cap24hrChange + '</td><td>' + (1 / Price).toFixed((1 / Price) < 1 ? 8 : 2) + ' ' + msgx.short + '</td>'; //redraw(); }
});
CoinCap.io Websocket - Script Codes
CoinCap.io Websocket - Script Codes
Home Page Home
Developer Nepal Bitcoin
Username nepalbitcoin
Uploaded December 08, 2022
Rating 3
Size 2,173 Kb
Views 12,144
Do you need developer help for CoinCap.io Websocket?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Nepal Bitcoin (nepalbitcoin) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!