$ show TreborNamor/TradingView-Machine-Learning-GUI
HyperView is a CLI-driven toolkit for downloading TradingView market data, backtesting Python trading strategies with TradingView-parity fill assumptions, and optimizing parameters via Bayesian search (Optuna). The system is organized as a monolith with subcommands: download-data, backtest, hyperopt, pine-optimize, pine-batch-optimize, list-data, list-strategies. It features a pluggable strategy framework with auto-discovery, 20+ TA-Lib indicator wrappers, a backtester that simulates intrabar SL/TP paths, and a two-stage Pine input optimizer that exports optimized Pine scripts with injected best parameters. The codebase is well-structured with dataclasses, type hints, and a rich CLI output using the `rich` library. It includes unit tests for the Pine optimization pipeline and CLI parser. The repository is primarily an application, though it contains data engineering patterns in its downloader and caching layers.
The LLM identified 4 files worth highlighting for reuse:
Implements a TradingView-like backtester with next-bar-open entries, intrabar price path simulation (high-before-low or low-before-high based on open proximity), and SL/TP exit ordering. Computes comprehensive metrics including Sharpe ratio with timeframe-appropriate annualization, Calmar ratio, and drawdown from a combined equity curve. The engine is self-contained except for importing dataclasses from hyperview/models.py, which are generic and reusable. The intrabar path logic and metric accumulation are non-obvious and demonstrate careful engineering.
A robust configuration loader that merges defaults, primary JSON config, additional config files, and environment variable overrides (HYPERVIEW__ prefix with __ as level separator). Uses deep merge to combine nested dictionaries, coerces env values via JSON parsing, and validates the final config against a schema of allowed values and types. This pattern is reusable in any CLI tool requiring layered configuration and demonstrates clean separation of concerns.
Provides 20+ wrapped TA-Lib indicators (EMA, RSI, MACD, Stochastic, ADX, Bollinger Bands, etc.) that accept and return pandas Series, handling numpy conversion internally. Also includes pure-pandas signal helpers (crossed_above, crossed_below, barssince) and a to_unix_timestamp utility. The wrappers are clean, well-documented, and can be extracted as a standalone library for any Python trading project. The barssince implementation uses vectorized numpy operations instead of loops.
Parses Pine Script input() declarations using regex, extracts type, default, min/max, step, and options. Maps Pine input names to strategy keys via a predefined mapping (e.g., htfTf -> htf_timeframe). Resolves search dimensions for optimization, handling categorical (string, bool, timeframe, session) and numeric (int, float) types with sensible default ranges. This module is self-contained and could be reused for any Pine Script optimization tool.