Open-source project
Mathieu2301/TradingView-API avatar
Mathieu2301/TradingView-API

TradingView-API: unofficial market data over the charting socket

📈 Get real-time stocks from TradingView

5,945 stars1,035 forksJavaScriptLicense varies

At a glance

What is it?
A Node.js library that connects to TradingView's own websocket and quote endpoints to pull prices, indicator values and chart drawings. Powerful, unofficial, and able to use session cookies from your account.
Who is it for?
The library is genuinely good at the two things free data sources are bad at, real-time values for indicators nobody publishes source for, and reading back the drawings you already made on a chart. What it cannot be is a stable contract with a vendor, since it re-implements a private protocol and every authentication change breaks it.
Can I use it commercially?
The repository metadata does not identify a licence. Check the project’s published terms and any component-specific licences before reuse.
Is it still maintained?
Yes. The repository last received commits 12 days ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • Mathieu2301/TradingView-API5,945 ★ · +400
Star history
Repository2026-10-072026-11-25
Mathieu2301/TradingView-API5.5k5.9k

400 Stars in the last 49 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

A client for a private protocol, published as an npm package

The repository description is one line: get real-time stocks from TradingView. Everything else in this project follows from that. There is no TradingView endpoint being documented here, no official key, no quota table. The library speaks the same websocket and HTTP calls the charting front end makes, which is why it can return data for symbols and indicators that have no public API.

The published package is `@mathieuc/tradingview`, version 4.1.0, an ESM package with TypeScript declarations and `./dist/index.js` as its entry point.

A licensing wrinkle worth knowing before you build on it: GitHub reports no license value for the repository and the tree has no LICENSE file at the root. If you intend to redistribute it or ship it inside a product, clarify the licensing terms before you rely on it.

Installing from npm or straight from the branch

The README's manual install uses the npm registry, with bun add @mathieuc/tradingview as an alternative:

bash
npm i @mathieuc/tradingview

V4 is installed by default and V3 remains available with `@mathieuc/tradingview@3`. The README also offers an interactive launcher, run with Node.js 20+:

bash
npx @mathieuc/tradingview

Version 4 is a breaking rewrite in TypeScript with no compatibility layer, so read the migration guide before upgrading existing V3 projects.

Cookies in an env file are the whole authentication model

Account access uses two cookies taken from a signed-in TradingView session, and the repository ships a sample file that says exactly which:

bash
SESSION=... # Your sessionid cookie
SIGNATURE=... # Your signature cookie

The file is named `.env.sample`. So the intended workflow is to copy the sample, paste your two cookie values in, and run an example file.

This is the design decision with the longest consequences. Those two values are equivalent to being logged in. They are read from the browser's cookie store for a session you authenticated yourself, which means they carry the full authority of that account, including anything your subscription unlocks. Keep the real `.env` out of version control.

It also means what you can reach depends on the account: the data API's websocket functions accept account `credentials`, and account watchlists are read-only. Anything your account cannot access, the library cannot give you.

What the checkbox list admits and denies

The README's data API table lists what the library covers: candles (latest bars, deep history, date ranges, Heikin Ashi/Renko), quotes, indicator values, drawings and strategy reports, symbol metadata, stock/crypto screening and ranked lists, read-only account watchlists, and search and ratings.

The README says the data API suits scripts, servers, dashboards, bots or agents, and a separate backtest API handles frozen candles, look-ahead rejection, fees and slippage. The picture is of a charting-library companion for people who want to compute on data they can already see, not a market data provider.

One caveat belongs here rather than in a footnote: the accuracy of a value returned here is TradingView's accuracy, and the reliability of an indicator reading depends on a subscription and a session that can expire at any time.

The examples folder is the actual documentation

The README links to an examples folder and to guides under docs/, including the data API guide (docs/data-api.md) and the v4 migration guide (docs/migration-v4.md).

Twenty-five entries are present in examples/. The ones a new user should read in order are `simple-chart.js` for the minimum working case, `builtin-indicator.js` for indicator values, `replay.js` and `fake-replay.js` for replay, `search.js` for symbol resolution, and `errors.js`, which given the nature of this project is probably the most valuable of the set.

The remainder are more specialised and still runnable: `private-indicators.js`, `custom-chart-types.js`, `custom-timeframe.js`, `from-to.js`, `drawings.js`, `graphic-indicator.js`, `multiple-indicators.js`, `pine-permissions.js` and `user-login.js`.

Copying a file out of `examples/` and editing it is the intended development loop. The README invites questions and early ideas through issues, and 77 issues are open.

Release notes that read like a bug tracker

Three GitHub releases are visible: v3.5.2 published 2025-10-05, v3.5.1 published 2025-02-22, and v3.5.0 published 2024-12-17.

GitHub reports the last push on 2026-10-30, with 5808 stars and 1011 forks. The last GitHub release is v3.5.2 from October 2025, while package.json is at 4.1.0 and the README says V4 is the default npm release, so pinning to 3.5.2 means staying on the previous `Client` API.

Editorial conclusion

The library is genuinely good at the two things free data sources are bad at, real-time values for indicators nobody publishes source for, and reading back the drawings you already made on a chart. What it cannot be is a stable contract with a vendor, since it re-implements a private protocol and every authentication change breaks it. Read `examples/replay.js` and `examples/simple-chart.js` first, keep your `.env` out of version control, and treat any strategy you build on it as one that needs a data source you control.

Frequently asked questions

Is the TradingView API free?

This library is free to install from npm, though GitHub reports no license for the repository. Account access uses a sessionid and signature cookie from a signed-in TradingView account. The repository documents no pricing of its own.

Can I get API from TradingView?

TradingView does not publish an API for this, and this repository is not one. The README calls it an independent community project, not an official TradingView API; it installs from npm as @mathieuc/tradingview, and its websocket data functions can take your own account credentials.

Can I pull data from TradingView?

Yes, that is the point of the library. It retrieves real-time prices, indicator values, TradingView's technical analysis, values for a chosen date range, and drawings you made on your own chart. The data API also covers stock/crypto screening and ranked lists through getScreener and getHotlist, and read-only account watchlists.

Can you automate TradingView?

Partly. The README offers a backtest API (@mathieuc/tradingview/backtest), watchers that keep streaming until stopped, and says the data API suits scripts, servers, dashboards, bots or agents. Account watchlists are read-only.

Official sources

  1. Issues
  2. Mathieu2301/TradingView-API on GitHub
  3. README
  4. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/mathieu2301-tradingview-api.svg)](https://hysenlabs.com/projects/mathieu2301-tradingview-api)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/mathieu2301-tradingview-api.svg)](https://hysenlabs.com/projects/mathieu2301-tradingview-api)

Was this useful?