Giter VIP home page Giter VIP logo

tradingview-scraper's Introduction

TradingView Scraper for Node.js

npm version types license

Really basic TradingView data scraper for Node.js.
warning: the implementation is a little bit dirty, but hey, it works!

Installation

# npm
npm install tradingview-scraper
# yarn
yarn add tradingview-scraper
# pnpm
pnpm add tradingview-scraper

Featuring

  • brand-shiny-new typescript typings
  • real-time data freshly stolen borrowed from TradingView's socket.io interface
  • almost 100% success rate of stealing borrowing data
  • 1:1 accuracy of stolen borrowed data #confirmed
  • HTTP Origin header spoofing so nobody will notice anything suspicious
  • okay, let's finally go into the serious mode, shall we?

Usage

Coming soon, for now just check Examples.

License

ISC License

Copyright (c) 2018-2022, Piotr Adamczyk

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

tradingview-scraper's People

Contributors

imxeno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tradingview-scraper's Issues

example run fails

Hi,

I just created an example to run this but it is stuck at Promise { <pending> }--do you know what I do wrong?

Here is the example:

const TradingViewAPI = require('.');
const tv = new TradingViewAPI();

console.log(tv.getTicker("FX_IDC:GBPUSD"))

Cheers

paid account authentication?

Hi thanks for this. Do you think it might be possible to authenticate as a pro/premium user? Do you know where it would make a difference? (eg I think an account with exchange subscriptions can get non-delayed data)

Delayed data

Ticker for 'MOEX:MOEX' returns update_mode: 'delayed_streaming_900'.
For real-time data need to be logined user.
Is there method to set my auth_token or session_id?

Can I set any options?

I want to set Trading time unit(1s, 1m, 3m, 5m ...).

But i cannot find what is default unit in your code and how to set it.

Is it unsupported function?

WS Connection always connecting

Hello, thanks for this project, I have implemented a simple code for TradingViewWebSocket, but the connection cannot be established:

//@ts-nocheck
import { TradingViewWebSocket } from '../src/TradingViewWebSocket';

const tv = new TradingViewWebSocket();

tv.connect().then(() => {
  tv.registerSymbol('CRYPTO:BTCUSD');
});
console.log('before register')
tv.on('data', data => {
  console.log('data received');
  console.log(data);
});
console.log('after register')

Does anyone has a minimal working example?

is setInterval to listen to the ticker mandatory?

Hi,

Thanks for this great tool.
I was just wandering if I need to listen to the ticker changes with new setInterval like:

const TradingViewAPI = require('tradingview-scraper');
const tv = new TradingViewAPI();

setInterval(() => tv.getTicker('EURUSD').then(result => {
  console.log(result)
}), 1000);

Or I'm doing it wrong? because firing the tv.getTicker(ticker) is returning only one response.

How to listen to a list of symbols?

Hello

For example, there are 300 symbols, but when I put them in the for loop to set the getTicker for all of them, it only listens to the first 50 of the list

What is the best solution for this problem?

Thanks

scrapping historical data with time frame

With the create_series, can we get historical data with a specific timeframe?

{"m":"resolve_symbol","p":["cs_f4rJLVoHtf7g","symbol_1","={\"symbol\":\"BITFINEX:ETHUSD\",\"adjustment\":\"splits\"}"]}

~m~75~m~{"m":"create_series","p":["cs_f4rJLVoHtf7g","s1","s1","symbol_1","45",300]}

TypeError: tv.setup is not a function

Hello :)
Are you still maintaining this library?
I would love to contribute.

After recent update, I'm getting:
TypeError: tv.setup is not a function

const { TradingViewAPI } = require("tradingview-scraper");

const bitcoinSymbol = "BTCUSD";
const tv = new TradingViewAPI();

process.stdout.write("Loading...");

tv.setup().then(() => {
  tv.getTicker(bitcoinSymbol).then(ticker => {
    let last = 0;
    ticker.on("update", data => {
      if (data.lp && data.lp !== last) {
        process.stdout.clearLine();
        process.stdout.cursorTo(0);
        process.stdout.write(
          "[" +
            bitcoinSymbol +
            "] " +
            (last > data.lp ? "-" : "+") +
            " " +
            data.lp.toFixed(2) +
            " "
        );
        last = data.lp;
      }
    });
  });
});

Connection issue in package.

Loading...node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Timed out.".] {
code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.16.0

Please update this issue. API is very useful to store the history but now I am getting this error

Reconnect

Hi
Can you implement auto reconnect on connection lost ?

Feature Request : get candles data

Hello

The data scraped is really useful, but creating candles from it (or even with exchange websockets) are not reliable... A really nice improvement, for me, could be to get candles (or the last closing candle for a specific timeframe).

Thanks anyway

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.