npm install @mathieuc/tradingview
# Or: bun add @mathieuc/tradingviewVersion 4 is installed by default: TypeScript, ESM, Node.js 20+ or Bun. CommonJS projects can require() it on Node 20.19+ or 22.12+, or use await import(). Version 3 remains available with @mathieuc/tradingview@3.
Version 4 is a breaking rewrite, with a new API and no compatibility layer. Coming from v3? Read the migration guide. Every v3 feature is still available: see the coverage matrix and the reliability evidence.
import { getCandles } from '@mathieuc/tradingview/data';
const candles = await getCandles({ symbol: 'BINANCE:BTCUSDT', timeframe: 'D', count: 40 });
console.log(candles.at(-1)); // { time, open, high, low, close, volume }Then read the data API guide, the backtest guide, the low-level API reference or the examples.
npx @mathieuc/tradingviewRun it from your project directory with Node.js 20+. Choose a path:
- Autonomous agent (recommended) β opens the TradingView-API page on molted.studio. No local project setup.
- Claude Code CLI β starts your installed
claudeCLI here with a ready-to-use project prompt. - Codex CLI β starts your installed
codexCLI here with the same prompt. - Another local coding agent β prints the prompt to paste into your agent.
- Install the library only β runs
npm install @mathieuc/tradingviewhere, without generating files or starting an agent.
Claude Code and Codex must already be installed and authenticated. Their normal permission prompts remain enabled. If launch fails, the prompt is printed for manual use. If no browser is available, the hosted link remains visible.
Use --choice 4 to print the prompt directly, or --help for usage. Non-interactive callers must pass --choice. To try the launcher from a checkout:
npm ci && npm run build
node bin/tradingview.mjsWithout an account, TradingView serves limited data: shorter intraday history, no Pine studies, and possibly delayed or substitute feeds. With your sessionid and sessionid_sign cookies (credentials), you get what your account can access. Keep them in environment variables or a secret store; never put them in source files, issues or prompts.
Open an issue to discuss a feature or report a bug, or send a pull request. Questions and early ideas are welcome; you do not need a perfect reproduction to start a conversation. npm run check runs the type check, lint, tests, build and package smoke test.