Socket
Socket
Sign inDemoInstall

tensorchart-api

Package Overview
Dependencies
68
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

9

controllers/socket.js
const WebSocket = require('ws')
const ws = new WebSocket('wss://ws-ny.tensorcharts.com/tensorWS');
const socket = (type, channel) => {
const socket = (type, channel, callback) => {
ws.on('open', function open() {
console.log('aberto.')
//console.log('aberto.')
ws.send(JSON.stringify({ "type": type, "channel": channel }), (err) => {
if (err) {
console.log('um erro ocorreu')
return err
callback(err)
} else {
ws.on('message', async (data) => {
//callback
callback(data)
})

@@ -15,0 +14,0 @@ }

@@ -9,2 +9,3 @@ const {

} = require("./controllers/requests");
const { socket } = require("./controllers/socket");

@@ -17,2 +18,8 @@ class tensorChart {

liveChart(settings = {type: 'reg', exchangeAndPair: 'binanceBTCUSDT'}, callback){
socket(settings.type, settings.exchangeAndPair, call => {
callback(JSON.parse(call))
})
}
chart(candleTime) {

@@ -19,0 +26,0 @@ return new Promise((resolve, reject) => {

{
"name": "tensorchart-api",
"version": "1.0.3",
"version": "1.0.4",
"description": "api for https://www.tensorcharts.com/",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -169,2 +169,14 @@ ![logo](https://github.com/victorratts13/tensorChart-api/blob/main/asset/logo.jpg?raw=true)

## real time connection
to realtime conncetion with websockets. use this:
```js
//type is reg for default
//exchangeAndPair is binance-BTCUSDT default
tensor.liveChart({type: 'reg', exchangeAndPair: 'binanceBTCUSDT'}, call => {
console.log(call)
})
```
## format tradingview export

@@ -171,0 +183,0 @@

@@ -5,6 +5,6 @@ const { settings, trades, markets, orderBook, volumeCounters, heatmapCandles } = require("./controllers/requests");

const tensor = new tensorChart('binance', 'BNBBTC')
//const {socket} = require("./controllers/socket");
//tensor.chart('5min').then(data => {
const {socket} = require("./controllers/socket");
// tensor.chart('5min').then(data => {
// console.log(data)
//})
// })

@@ -15,6 +15,11 @@ //tensor.tradingViewChart('5min').then(data => {

tensor.tradingViewSymbols(null).then(data => {
console.log(data)
// tensor.tradingViewSymbols(null).then(data => {
// console.log(data)
// })
tensor.liveChart({type: 'reg', exchangeAndPair: 'binanceBTCUSDT'}, call => {
console.log(call)
})
//socket('reg', 'binanceBTCUSDT')
// socket('reg', 'binanceBTCUSDT', call => {
// console.log(JSON.parse(call))
// })

@@ -21,0 +26,0 @@ //settings('binance', 'BNBBTC').then(data => {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc