{"repo":"TreborNamor/TradingView-Machine-Learning-GUI","free":true,"listed":false,"github":"https://github.com/TreborNamor/TradingView-Machine-Learning-GUI","clone":"git clone https://github.com/TreborNamor/TradingView-Machine-Learning-GUI.git","description":"HyperView is a terminal-first TradingView strategy lab for downloading market data, backtesting Python strategies with Pine-like behavior, and optimizing SL/TP parameters.","language":"Python","stars":980,"topics":["algorithmic-trading","backtesting","cli","hyperparameter-optimization","hyperparameter-tuning","market-data","optuna","python","quantitative-finance","ta-lib","trading-strategy","tradingview","websocket"],"license":"MIT","category":"quant_trading_tool","readme_excerpt":"# HyperView\n\n**Turn TradingView ideas into testable, terminal-speed trading systems.**\n\nHyperView is for the moment a TradingView strategy stops being a chart experiment and starts needing hard evidence. It pulls historical candles straight from TradingView's websocket, runs your strategy logic in Python, and backtests with fill behavior designed to closely mirror Pine Script, so the results you tune locally in python still match the results you'll see on TradingView's strategy tester.\n\nInstead of bouncing between Pine scripts, CSV exports, and improvised notebooks, HyperView gives you one clean loop: pull up to 40K bars, build on [TA-Lib](https://github.com/TA-Lib/ta-lib-python)'s 150+ indicators, simulate realistic SL/TP execution, and let Bayesian optimization (Optuna TPE) hunt for better parameter ranges. No API keys. No browser automation. No spreadsheet cleanup. Just faster iteration, sharper validation, and a workflow built for traders who want to develop strategies like engineers.\n\n## Prerequisites\n\n- **Python 3.11+**\n- **TA-Lib** — installed automatically by `pip install`. Pre-built wheels ship for Python 3.9–3.14 on Windows, macOS, and Linux.\n- **rich** — installed automatically. Powers the styled terminal output (colored tables, progress indicators, panels).\n- **Firefox** *(optional)* — If you have a TradingView paid plan, HyperView can read your Firefox session cookies to download up to **40K candles**. Without it, the websocket still downloads up to **5K candles** anonymously. To use this, just log in to [tradingview.com](https://www.tradingview.com) in Firefox before downloading data.\n\n## Quick Start\n\n```bash\n# Install in editable mode (creates the `hyperview` CLI command, installs all dependencies including TA-Lib)\npip install -e .\n\n# Download data for specific pairs\nhyperview download-data --pairs NASDAQ:NFLX NASDAQ:AAPL --timeframe 1h --session extended\n\n# Or define your pairs in config.json and download multiple timeframes at once:\nhyperview download-data --timeframe 1h 15m\n\n# Run a single backtest (uses config pairlist)\nhyperview backtest --sl 3.23 --tp 13.06 --mode long\n\n# Or target a specific symbol using values from a hyperopt preset file\nhyperview backtest --symbol NASDAQ:NFLX --preset-file results/adx_stochastic_presets.json\n\n# Hyper-optimize SL/TP across all pairs in config\nhyperview hyperopt --mode long\n\n# List cached data and registered strategies\nhyperview list-data\nhyperview list-strategies\n```\n\nYou can also run via `python -m hyperview` instead of the `hyperview` command.\n\nPython bytecode is redirected into the project-level `.pycache/` directory, so runtime imports do not create scattered `__pycache__` folders under `hyperview/` or `strategy/`.\n\n## How It Works\n\n1. **Download** — Connects to TradingView's websocket using your existing Firefox session cookies. Supports up to 40K historical bars on paid plans with automatic backfill.\n2. **Signal** — Runs a pluggable strategy (e.g. the included MACD+RSI or ADX+Stochastic) in pure Python with TA-Lib indicator parity.\n3. **Backtest** — Simulates trades bar-by-bar using TradingView-parity fill assumptions (next-bar-open entry, intrabar SL/TP exit ordering). Multi-pair runs produce a true **PORTFOLIO** aggregate row with combined equity-curve statistics.\n4. **Hyper-Optimize** — Runs Bayesian optimization (Optuna TPE) across SL/TP combinations, then updates a strategy preset file with the best result for each pair/context.\n\n## Terminal Output\n\nBoth the backtest and hyperopt commands produce styled terminal output using [rich](https://github.com/Textualize/rich):\n\n- **Backtest summary** — A bordered table with colored directional arrows (▲ green for gains, ▼ red for losses) on Return, Drawdown, Expectancy, and Worst Trade, using readable short labels that fit a normal terminal width. When multiple pairs are run, a **PORTFOLIO** row is appended with mathematically correct aggregate statistics computed from a combined equity curve (not simple averages).\n- **Hyperopt results** — A panel header showing strategy/mode/timeframe, bullet-point data and signal summaries per pair, and a top-N results table with cyan-highlighted parameter columns (SL/TP) visually separated from metric columns.\n\n## Repository Layout\n\n```\npyproject.toml              Package metadata & CLI entry point\nconfig.json                 Default configuration (timeframe, pairlist, opt ranges)\nconfig.schema.json          JSON Schema for editor validation & autocompletion\ndata/                       Cached candle CSVs (auto-generated)\nresults/                    Optimization presets & reports (auto-generated)\n```\n\n### `strategy/` — Pluggable Strategy Framework\n\n```\nstrategy/\n├── __init__.py             Plugin registry & auto-discovery\n├── base.py                 BaseStrategy ABC & prepare_candles()\n├── indicators.py           TA-Lib wrappers, conversion helpers & signal toolkit\n├── adx_stochastic.py       ADX+Stochastic strategy\n└── macd_rsi.py             MACD+RSI strategy\n```\n\n### `hyperview/` — Core Engine\n\n```\nhyperview/\n├── __main__.py             Module entry point (python -m hyperview)\n├── config.py               Config loader (JSON + CLI overrides + env vars)\n├── models.py               Shared dataclasses (CandleRequest, Trade, BacktestMetrics, …)\n├── presets.py              Preset load/save for optimized SL/TP parameters\n├── validators.py           Configuration & preset validation rules\n├── runtime.py              Bytecode cache redirection\n│\n├── cli/                    CLI router & subcommand handlers\n│   ├── __init__.py         Argument parser & main() dispatcher\n│   ├── formatting.py       Shared formatting helpers (rich tables, arrow decorators)\n│   ├── backtest.py         backtest command\n│   ├── download.py         download-data command\n│   ├── hyperopt.py         hyperopt command\n│   └── list.py             list-data & list-strategies commands\n│\n├── backtest/\n│   └── engine.py           TradingView-parity OHLC simulator\n│\n├── downloader/\n│   ├── client.py           TradingView websocket downloader & cache orchestration\n│   ├── cache.py            CSV-backed local candle cache\n│   ├── credentials.py      Firefox credential extraction\n│   ├── session.py          WebSocket chart session manager\n│   └── timeframes.py       Timeframe constants & utilities\n│\n└── hyperopt/\n    └── optimizer.py        Bayesian optimizer (Optuna TPE)\n```\n\n## Configuration\n\nHyperView loads defaults from `config.json` at the project root. CLI flags always override config values.\n\nThe sample below shows a customized setup; if a key is omitted, HyperView falls back to runtime defaults.\n\n```json\n{\n    \"timeframe\": \"1h\",\n    \"session\": \"regular\",\n    \"mode\": \"long\",\n    \"strategy\": \"adx_stochastic\",\n    \"initial_capital\": 100000,\n    \"data_dir\": \"data\",\n    \"output_dir\": \"results\",\n    \"pairlist\": [\n        \"NASDAQ:NFLX\",\n        \"NASDAQ:TSLA\",\n        \"COINBASE:BTCUSD\",\n        \"COINBASE:ETHUSD\"\n    ],\n    \"optimization\": {\n        \"n_trials\": 200,\n        \"objective\": \"net_profit_pct\",\n        \"top_n\": 10,\n        \"sl_range\": { \"min\": 1.0, \"max\": 15.0 },\n        \"tp_range\": { \"min\": 1.0, \"max\": 15.0 }\n    }\n}\n```\n\nUse `--config /path/to/custom.json` to load a different file.\n\n### Pairlist\n\nThe `pairlist` array defines the symbols you want to work with. Every entry must use the `EXCHANGE:SYMBOL` format — this lets you mix pairs from different exchanges in a single config:\n\n```json\n\"pairlist\": [\n    \"NASDAQ:NFLX\",\n    \"NASDAQ:TSLA\",\n    \"NASDAQ:AAPL\",\n    \"COINBASE:BTCUSD\"\n]\n```\n\nWhen you run a command without `--pairs` or `--symbol`, HyperView automatically uses the config pairlist — downloading, backtesting, or optimizing every pair in sequence. If you pass `--pairs` or `--symbol` on the CLI, the config pairlist is ignored for that run.\n\nYou can maintain separate config files for different asset classes:\n\n```bash\nhyperview --config stocks.json download-data\nhyperview --config crypto.json hyperopt --mode long\n```\n\n## CLI Reference\n\n### `download-data` — Fetch Candle Data\n\n```bash\n# Download all pairs from config pairlist\nhyperview download-data\n\n# Or specify pairs directly, including multiple timeframes\nhyperview download-data --pairs NASDAQ:NFLX NASDAQ:AAPL NASDAQ:TSLA --timeframe 1h 15m --start 2023-01-03\n```\n\n| Flag | Required | Default | Description |\n|------|----------|---------|-------------|\n| `--pairs` | No | config pairlist | One or more `EXCHANGE:SYMBOL` pairs (overrides pairlist) |\n| `--timeframe` | No | config | One or more bar intervals: `1m` `5m` `15m` `1h` `4h` `1d` etc. |\n| `--start` / `--end` | No | — | Date range (ISO format) |\n| `--session` | No | config | `regular` or `extended` |\n| `--adjustment` | No | `splits` | Price adjustment (`splits`, `dividends`, `none`) |\n\n### `backtest` — Single Strategy Evaluation\n\n```bash\n# Backtest all pairs from config pairlist\nhyperview backtest --sl 5.0 --tp 5.0 --mode long --start 2023-01-03\n\n# Or target a specific symbol using a preset file created by hyperopt\nhyperview backtest --symbol NASDAQ:NFLX --preset-file results/adx_stochastic_presets.json --start 2023-01-03\n```\n\nIf `--sl` and `--tp` are omitted, HyperView looks for a matching entry in the provided `--preset-file` using `pair + timeframe + session + adjustment + mode`. CLI values still override preset-file values.\n\n| Flag | Required | Default | Description |\n|------|----------|---------|-------------|\n| `--symbol` | No | config pairlist | `EXCHANGE:SYMBOL` pair (overrides pairlist) |\n| `--sl` | No* | — | Stop-loss % (*required unless a matching `--preset-file` entry exists) |\n| `--tp` | No* | — | Take-profit % (*required unless a matching `--preset-file` entry exists) |\n| `--preset-file` | No | auto-detected | Path to a strategy preset JSON (auto-detects `<strategy>_presets.json` in output dir) |\n| `--strategy` | No | config | Strategy name (e.g. `macd_rsi`, `adx_stochastic`) |\n| `--mode` | No | `long` | `long`, `short`, or `both` |\n| `--timeframe`, `--session`, `--adjustment`, ","default_branch":"master","files":37,"tree":[".copilotignore",".gitignore","LICENSE","README.md","config.json","config.schema.json","hyperview/__init__.py","hyperview/__main__.py","hyperview/backtest/__init__.py","hyperview/backtest/engine.py","hyperview/cli/__init__.py","hyperview/cli/backtest.py","hyperview/cli/download.py","hyperview/cli/formatting.py","hyperview/cli/hyperopt.py","hyperview/cli/list.py","hyperview/config.py","hyperview/downloader/__init__.py","hyperview/downloader/cache.py","hyperview/downloader/client.py","hyperview/downloader/credentials.py","hyperview/downloader/session.py","hyperview/downloader/timeframes.py","hyperview/hyperopt/__init__.py","hyperview/hyperopt/optimizer.py","hyperview/models.py","hyperview/presets.py","hyperview/runtime.py","hyperview/utils.py","hyperview/validators.py","pyproject.toml","requirements.txt","strategy/__init__.py","strategy/adx_stochastic.py","strategy/base.py","strategy/indicators.py","strategy/macd_rsi.py"],"storefront":"/r/TreborNamor","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/TreborNamor/TradingView-Machine-Learning-GUI/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}