New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rpsinrprice

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rpsinrprice - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

38

dist/index.js

@@ -7,3 +7,5 @@ "use strict";

const WebSocket = require("ws");
const jsdom_1 = require("jsdom");
const InrPriceEmiter1 = new stream_1.EventEmitter();
InrPriceEmiter1.addListener('rate', console.log);
const url = process.env.inr_url || 'wss://stream123.forexpros.com/echo';

@@ -33,7 +35,33 @@ function getRandomArbitrary(min, max) {

const heartbeat = JSON.stringify({ _event: 'heartbeat', data: 'h' });
function Init() {
async function GetInrFromUrl() {
const a = await jsdom_1.JSDOM.fromURL('https://in.widgets.investing.com/live-currency-cross-rates?theme=darkTheme&roundedCorners=true&pairs=160&cols=bid,ask,last,prev,high,low');
const ele = a.window.document.getElementById('pair_160');
if (ele.children.length > 6) {
const rate = {
symbol: ele.children.item(0).textContent,
bid: ele.children.item(1).textContent,
ask: ele.children.item(2).textContent,
last: ele.children.item(3).textContent,
open: ele.children.item(4).textContent,
high: ele.children.item(5).textContent,
low: ele.children.item(6).textContent,
};
const rate1 = {
'bid-price': rate['bid'],
'bid-high-price': rate['high'],
'bid-low-price': rate['low'],
'ask-price': rate['ask'],
'last-high': rate['high'],
'last-low': rate['low'],
'ask-high-price': rate['high'],
'ask-low-price': rate['low'],
};
InrPriceEmiter1.emit('rate', rate1);
}
Init();
}
async function Init() {
const ws = new WebSocket(`${url}/${GetRandom3Digits()}/${crypto_1.randomBytes(4).toString('hex')}/websocket`);
let Interval = null;
ws.on('open', () => {
});
ws.on('open', () => { });
ws.on('message', (data) => {

@@ -91,7 +119,7 @@ if (data === 'o') {

});
ws.on('unexpected-response', a => {
ws.on('unexpected-response', (a) => {
console.log(a);
});
}
Init();
GetInrFromUrl();
exports.InrPriceEmiter = InrPriceEmiter1;

12

package.json
{
"name": "rpsinrprice",
"version": "1.3.0",
"version": "1.4.0",
"description": "",

@@ -17,14 +17,20 @@ "main": "dist/index.js",

"license": "ISC",
"peerDependencies": {
"jsdom": "^16.6.0",
"ws": "^7.4.4"
},
"dependencies": {
"jsdom": "^16.6.0",
"ws": "^7.4.4"
},
"devDependencies": {
"@types/jsdom": "^16.2.13",
"@types/node": "^14.14.41",
"@types/validator": "^13.1.3",
"@types/ws": "^7.4.1",
"@vercel/ncc": "^0.26.2",
"nodemon": "^2.0.7",
"ts-node": "^8.10.1",
"typescript": "^3.9.3",
"@types/ws": "^7.4.1"
"typescript": "^3.9.3"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc