CoinCap.io Websocket
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 - 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(); }
});
Developer | Nepal Bitcoin |
Username | nepalbitcoin |
Uploaded | December 08, 2022 |
Rating | 3 |
Size | 2,173 Kb |
Views | 12,144 |
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!
Name | Size |
Nepali Number Word format | 2,746 Kb |
CoinCap.io Websocket | 4,654 Kb |
A Pen by Nepal Bitcoin | 2,568 Kb |
Converter | 1,832 Kb |
Super Fast Nepali Date Converter | 15,174 Kb |
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!
Name | Username | Size |
Delete Hover | Chungman93 | 2,557 Kb |
Day 11 - Calendar Card | Arnellebalane | 6,984 Kb |
Flat buttons for Eliassen.com | Kdooley89 | 1,737 Kb |
Scroll Arrow | Robooneus | 4,437 Kb |
SVG Icons Template | Legofsalmon | 2,618 Kb |
Menubar compass mixin | Michaelparenteau | 4,925 Kb |
Clock with full screen background | Owebboy | 2,415 Kb |
Weather Icons | Gtalin | 2,519 Kb |
Weather App | OmranAbazid | 2,596 Kb |
Perspective Origin Demo | Agelber | 3,614 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!