Posts

Showing posts from January, 2023

nodejs program to fetch bitcoin price and send message in telegram when bitcoin price is dropped by 0.5% or increase by 0.5%

 same  as the last blogspot just some function is added const express = require ( 'express' ); const app = express (); const ccxt = require ( 'ccxt' ) const http = require ( 'http' ); const server = http . createServer ( app ); const { Server } = require ( "socket.io" ); const { Console } = require ( 'console' ); const { BroadcastChannel } = require ( 'worker_threads' ); const io = new Server ( server ); const TelegramBot = require ( 'node-telegram-bot-api' ); const bot = new TelegramBot ( 'your telegram token' , { polling : true }); app . use ( express . static ( 'public' )); app . use ( express . urlencoded ({ extended : false })) app . use ( express . json ()); app . get ( '/sa' , ( req , res ) => {   res . send ( "sd" ); }); io . on ( 'connection' , async ( fun ) => {     i = 1 ;     s = 2000 ;     console . log ( 'started' )   ...

Node JS program to fetch bitcoin price and showing it in real time using socker.io

Image
 File structure -  package install -  Server.js  const express = require ( 'express' ); const app = express (); const ccxt = require ( 'ccxt' ) const http = require ( 'http' ); const server = http . createServer ( app ); const { Server } = require ( "socket.io" ); const { Console } = require ( 'console' ); const { BroadcastChannel } = require ( 'worker_threads' ); const io = new Server ( server ); app . use ( express . static ( 'public' )); app . use ( express . urlencoded ({ extended : false })) app . use ( express . json ()); app . get ( '/sa' , ( req , res ) => {   res . send ( "sd" ); }); io . on ( 'connection' , async ( fun ) => {     i = 1 ;     s = 2000 ;     console . log ( 'started' )       console . log ( fun . id )       const exchange = new ccxt . binance ()       // Load the markets       let   real = 1 ...