Skip to content

AndrewJBateman/html-js-websockets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ HTML-JS-Websockets

  • HTML-Javascript app using Websockets to connect to the Binance web server and display dynamic financial data.
    • Note: to open web links in a new window use: ctrl+click on link

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

📄 Table of contents

📚 General info

  • Cryptocurrency data received from Binance

📷 Screenshots

Example screenshot.

📶 Technologies

💾 Setup

💻 Code Examples

  • extract from app.js to assign innertext to HTML elements.
// extract stock symbol
// add stock name to stockStreams array if not there already then display name, volume traded and close price
const handleStock = (stock) => {
	const stockStream = stock.s // e.g. RNDRBUSD
	const stockStreamClose = stock.c // close price

	if (stockStreams.indexOf(stockStream) === -1) {
		document.getElementById('stockStreams').innerHTML += '<br/>' + stockStream + ': <span id="stockStream_' + stockStream + '"></span>' + ': <span id="stockStreamClose' + stockStream + '"></span>';
		stockStreams.push(stockStream);
		document.getElementById('sumStreams').innerText = stockStreams.length;
	}
	document.getElementById('stockStream_' + stockStream).innerText = parseFloat(stock.v).toFixed(0);
	document.getElementById('stockStreamClose' + stockStream).innerText = parseFloat(stock.c).toFixed(2);
}

🆒 Features

  • Websockets are easy to use

📋 Status & To-do list

  • Status: Working
  • To-do: Expand data shown and convert to tqble

👏 Inspiration

📁 License

  • N/A

✉️ Contact

About

📋 Simple HTML & Javascript app using Websockets to show data from the Binance financial info. website

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published