Crypto Trading

Real-Time Crypto Prices using the Binance API with JavaScript & Websockets

Real-Time Crypto Prices using the Binance API with JavaScript & Websockets

Real-Time Crypto Prices using the Binance API with JavaScript & Websockets

In this quick tutorial I’m going to show you how to display a live feed of a Cryptocurrency price like Ethereum on a webpage.
All you need is Visual Studio Code & your web browser!

🦊Whitelist Giveaway🦊

Rogue Fox Guild is a post-apocalyptic themed NFT collection.

Only 5 invites and 1 RT gets you involved! Don’t miss it!

Join our discord server here:
https://discord.gg/ZjAzdfDTTE

#NFT #NFTlaunch #NFTCommunity #NFTcollection #NFTdrops #NFTartist #NFTGiveaway

Video for Crypto Trading Api
Crypto Trading Api youtube video content

12 Comments

  1. Awesome video – Boss, I have a question on how to be able to monitor the price feed – example like the price you extracted
    1- if you want to compare when the price goes up multiple times simultaneously – example if price was 12000, then 12,030 then 12,050 etc like multiple numbers of times
    I saw the code for the color matching but how does one put this when , the price gets greater or less number of times consecutively?

    Will appreciate your response or a video on such – where u can monitor live changing prices for desired actions!

    Thank you Boss!

  2. i am using websocket in trading bot on yobit platform

    So i just want to know

    if i place a limit order or limit price

    is this order will show up in orderbook of the basic yobit platform or not

  3. Thanks Morgan, your script and html were the basis for my script and html to check multiple cryptocurrencies, I let code if someone need it:
    HTML:
    <!DOCTYPE html>

    <html lang="es">

    <head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE-<edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Stock ticker</title>

    </head>

    <body>

    <div>

    <b>BTCUSDT:</b>

    <b id="BTCUSDT"></b>

    <br>

    <b>ETHUSDT:</b>

    <b id="ETHUSDT">—</b>

    <br>

    <b>ADAUSDT:</b>

    <b id="ADAUSDT"></b>

    <br>

    <b>GALAUSDT:</b>

    <b id="GALAUSDT"></b>

    <br>

    <script src="app.js"></script>

    </div>

    </body>

    </html>

    JAVASCRIPT:
    let ws= new WebSocket('wss://stream.binance.com/ws/btcusdt@trade/ethusdt@trade/adausdt@trade/galausdt@trade');

    const symbols = {

    "BTCUSDT" : 2,

    "ETHUSDT" : 2,

    "ADAUSDT" : 4,

    "GALAUSDT" : 5,

    }

    ws.onmessage = (event) => {

    let stockObject = JSON.parse(event.data);

    let symbol = stockObject.s

    let price = stockObject.p

    price = parseFloat(price).toFixed(symbols[symbol])

    document.getElementById(symbol).innerText = price.replace("." ,",")

    }

  4. How can we do this with other exchanges like coinbase pro or kraken? Would love to discuss this further using JavaScript.

  5. Dude… Ternay has a limit of be able to get it while reading. I was feeling that you are learning about coding when you casually just add script things without any code structure like index and your JavaScript. Seriously if you are an old developer I would be worry about my life in general 👍

  6. @Morgan Page How can I extract the messages to use in another file or outside the function ws.onmessage = (event)=>{}. ?

  7. Hello, is there a chance toI access the number of online visitors of binance? and if we can how can i found article or tutorial, how should i search, what is the title of this topic sir?

  8. what's the difference between aggregated trade stream and normal trade stream , which one to use show the current price of a ticker

Leave a Reply

Your email address will not be published.