Commit Graph

139 Commits

Author SHA1 Message Date
TPTBusiness a781d003ba test: deep tests for factor_runner (look-ahead fix, IC, dedup) and strategy_builder (combinator, evaluator)
- factor_runner: shift_daily_constant (property-based, 50 inputs), multi-instrument,
  NaN handling, edge cases (2-day, all-same, all-NaN), IC import, safe_float
- strategy_builder: combinator (pairs/triplets, category filtering, empty/single),
  evaluator (cost calc, safe names), builder import
2026-05-09 22:39:22 +02:00
TPTBusiness abca9eb899 fix: add hypothesis to test deps and fix missing imports in deep tests 2026-05-09 18:06:39 +02:00
TPTBusiness cbe1c52e00 refactor: rename project from Predix to NexQuant
Rename all source files, scripts, tests, documentation, and configuration
from Predix/predix to NexQuant/nexquant across the entire codebase.
2026-05-09 17:48:22 +02:00
TPTBusiness ba7458fba5 test: deep tests for predix_parallel (RunState, env, commands) and continuous_strategies (ML model)
- predix_parallel: 20 tests — RunState elapsed formatting (property-based, 200 inputs),
  status icons, API key loading, round-robin assignment, env building (local +
  openrouter), command building, edge cases
- continuous_strategies: 11 tests — build_ml_model (sufficient/insufficient data,
  OOS rejection, never-crashes property), config validation, style cycling
2026-05-09 08:50:13 +02:00
TPTBusiness 92ddcc47c7 test: deep tests for predix_gen_strategies_real_bt (36 tests)
- _rescale_thresholds: property-based fuzzing (200 random inputs),
  RSI toward-50 logic, small-threshold scaling, syntax preservation
- Factor loading: empty dir, sort by IC, top_n, missing parquet, corrupt JSON
- OHLCV loading: file-not-found, cache reuse
- TeeFile: writes to multiple handles, fileno delegation
- Backtest runner: sandbox execution, syntax error, missing signal
- Acceptance criteria: 7-parameter combinatorial check (daytrading + swing)
- Configuration: style defaults (daytrading vs swing)
2026-05-09 08:41:08 +02:00
TPTBusiness 160ac96130 test: deep property-based + fuzzing tests for backtest, verifier, and autopilot
- test_verify_runtime_deep: hypothesis property tests, fuzzing 1000 random results,
  invariant independence checking, edge cases (NaN, inf, negative trades)
- test_vbt_backtest_deep: property tests (cost monotonicity, signal inversion,
  max_dd invariants), edge cases (1 bar, empty, NaN, inf, mismatched lengths)
- test_autopilot: mocked orchestrator tests (failure recovery, counting logic,
  ensemble building, style cycling, hypothesis property tests)
2026-05-08 23:12:33 +02:00
TPTBusiness e029120090 chore: remove accidentally committed pycache files 2026-05-08 22:47:50 +02:00
TPTBusiness 4d9459a9f9 test: add tests for RDAgentLog debug() and LiteLLMAPIBackend 2026-05-08 22:47:41 +02:00
TPTBusiness d458e39940 fix: prevent LLM retry loop from consecutive assistant message corruption 2026-05-05 18:56:12 +02:00
TPTBusiness e76d5ab9cf fix: relax WF default test (wf_oos_sharpe_mean not present when 0 windows) 2026-05-05 06:44:04 +02:00
TPTBusiness d55bd518d3 docs: add closed-source test policy; remove closed-source test imports 2026-05-04 22:31:11 +02:00
TPTBusiness f99acca6e0 test: add 9 tests (verifier edge cases, factor loader, stability, MTF, save strategy) — 641 total 2026-05-04 22:19:49 +02:00
TPTBusiness 49a2c34c5c test: add 10 tests (continuous gen, strategy builder, live trader, factor integration) — 632 total 2026-05-04 22:11:39 +02:00
TPTBusiness 71ceb9c809 fix: update WF test for new default (wf_rolling=True) 2026-05-04 22:04:05 +02:00
TPTBusiness 7f5acccfd9 test: add 15 tests (WF details, optuna, preflight, signal validation, IC bounds) — 622 total 2026-05-04 21:56:28 +02:00
TPTBusiness a459518dfa test: add 15 tests (perf bounds, chaining, multi-index, metric bounds, factor runner edges) — 607 total 2026-05-04 21:43:18 +02:00
TPTBusiness 41c231e418 test: add 16 headform tests (docker mocks, spread, rollover, regression, cross-system) — 592 total 2026-05-04 21:39:27 +02:00
TPTBusiness 5c93c786e7 test: add 7 robustness tests (slippage, latency, MC-reshuffle, OOS, weekend gaps) — 576 total 2026-05-04 21:06:53 +02:00
TPTBusiness f5e55d2dad test: add 15 deepest tests (property-based, metamorphic, fuzzing, stress) — 569 total 2026-05-04 18:31:28 +02:00
TPTBusiness b78b9dea8c test: add 14 tests for final untested modules (runtime_info, repo_utils, json_loader) — 554 total 2026-05-04 18:21:31 +02:00
TPTBusiness 02083409e0 test: add 23 open-source tests (CLI, backtest edge cases, core utils, protections, env, log) — 540 total 2026-05-03 23:13:55 +02:00
TPTBusiness 06a5d5d92d refactor: move strategy_orchestrator and optuna_optimizer to closed-source (local/) 2026-05-03 21:38:09 +02:00
TPTBusiness 6d37f8956f feat: add runtime backtest verification (10 invariant checks in <1ms) + 489 tests + README docs 2026-05-03 14:00:49 +02:00
TPTBusiness 020bc11742 test: add 8 cross-implementation validation tests (IC/Sharpe/MaxDD cross-check, buy-and-hold equality, IC invariance) — closes 5% gap, 477 total 2026-05-03 13:53:43 +02:00
TPTBusiness 0f7eb908b4 test: add 10 ground-truth verification tests (hand-computed metrics, mathematical invariants, trend directions) — 469 total 2026-05-03 13:47:35 +02:00
TPTBusiness 4d8b389b47 test: add 13 final tests (walk-forward, dedup, e2e, edge-cases, cross-check, legacy-vs-new) — 459 total, 0 failures 2026-05-03 13:37:33 +02:00
TPTBusiness 72b9a735c9 test: add 28 deep-detail tests (look-ahead shift, alignment, safe_float, trade_pnl, MC p-value) — 446 total, 0 failures 2026-05-03 12:35:39 +02:00
TPTBusiness ce4a5b7b4f fix: correct MaxDD to equity curve in strategy_builder; test: add 8 cross-validation tests for metric correctness 2026-05-03 12:28:09 +02:00
TPTBusiness 037f7ba7d2 fix: correct Sharpe/MaxDD/WinRate in direct factor eval (was computing on raw factor, now on strategy returns) 2026-05-03 12:17:27 +02:00
TPTBusiness e31963713b test: add 31 tests for remaining modules (log, loader, doc_reader, scripts, fx_validator) — 410 total, 0 failures 2026-05-03 12:00:54 +02:00
TPTBusiness dc2a1a41f4 test: add 16 tests for eurusd, rl env, and all 379 tests now pass (0 failures) 2026-05-03 11:39:24 +02:00
TPTBusiness 1a530440c1 test: add 42 tests for remaining modules (conf, kb, interactor, fmt, llm_utils, graph) 2026-05-03 11:31:28 +02:00
TPTBusiness 13dbf27457 test: add 28 tests for LLM components, RL indicators, and model evaluators 2026-05-03 11:24:28 +02:00
TPTBusiness 49ebc19fd0 test: add 39 tests for fx_config, utils, predix_full_eval, exceptions, and log 2026-05-03 11:18:27 +02:00
TPTBusiness 58eb551898 test: add 4 tests for QuantTrace and QlibQuantHypothesis 2026-05-03 11:14:33 +02:00
TPTBusiness 2e18b7c104 test: add 24 tests for factor/model scenarios and experiments 2026-05-03 11:12:23 +02:00
TPTBusiness 28743eb043 test: add 33 tests for app config, strategy builder, and quant scenario 2026-05-03 11:09:55 +02:00
TPTBusiness a4d4266295 test: add 129 tests for critical untested code (core, CoSTEER, factor_coder, model_coder, qlib pipeline) 2026-05-03 10:59:24 +02:00
TPTBusiness 8f2ed4185f fix: add missing sys import and fix undefined acc_rate in factor eval 2026-05-03 10:19:59 +02:00
TPTBusiness aba88dd090 fix: 15 bug fixes across orchestrator, runner, backtest, and infrastructure
Critical:
- strategy_orchestrator: fix IndentationError that prevented import (line 764)
- factor_runner: fix literal 'sys.executable' string → variable (line 966)

High (path bugs causing wrong directories):
- backtest_engine: fix results_path depth (3→4 .parent hops)
- results_db: fix factors_dir/failed_dir depth (3→4 .parent hops)
- factor_runner: eliminate run_id variable shadowing (parallel_run_id/db_run_id)
- model_runner: fix DB connection leak on add_backtest exception
- optuna_optimizer: fix imported logger shadowed by module-level reassignment

Medium:
- env: handle non-UTF-8 Docker build output with errors='replace'
- env: guard conda env list parsing against empty lines
- factor_runner: add check=False + stderr logging for full-data subprocess
- strategy_orchestrator: log exec() exceptions at ERROR level with traceback
- strategy_orchestrator: warn on unreplaced {{template}} variables in prompts

Low:
- factor_runner: guard IC_max.index access against scalar (AttributeError)
- predix_parallel: close log file handle on Popen failure
- predix_rebacktest_strategies: replace 4 bare except: with except Exception:
2026-05-03 09:37:00 +02:00
TPTBusiness 28766c932e test: add regression tests for background task path and env bugs
- Verify parallel runner project_root is repo root, not scripts/
- Verify .env loading from correct path
- Verify API key distribution (single key, multi-key comma-separated)
- Verify CLI project_root depth (3 .parent hops, not 4)
- Verify start_loop uses sys.executable and child_proc, not pkill
- Verify parallel_cli does not hardcode model=local
- Verify all referenced scripts exist at resolved paths
2026-05-03 08:57:56 +02:00
TPTBusiness 02ac3f7aae test: add direct unit tests for _apply_riskmgmt_mask, safe_resolve_path, import_class, and _add_column_if_not_exists 2026-05-03 00:35:57 +02:00
TPTBusiness 2de7275b8f fix(auto-fixer): replace zero \$volume with price-range proxy for FX data
EUR/USD synthetic data has \$volume=0 for all rows, causing any VWAP or
volume-weighted factor to produce all-NaN output. Insert a guard after
pd.read_hdf() that replaces zero volume with (\$high - \$low) range proxy
so volume-dependent factors produce meaningful signals.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 16:07:06 +02:00
TPTBusiness 9691b64938 fix(auto-fixer): strip spurious .reset_index() after .transform() calls
LLM sometimes copies the .reset_index(level=N, drop=True) suffix from
groupby().rolling().method() patterns and adds it after .transform(),
but transform() already preserves the original index. The extra
reset_index() drops an index level and causes ValueError: 'cannot reindex
on an axis with duplicate labels' or shape mismatch on assignment.

Detect: any line containing both .transform( and .reset_index(level=..., drop=True)
Fix: strip the .reset_index() suffix from those lines.

Adds 1 new test (test_transform_reset_index_stripped) — total 30 tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 15:57:04 +02:00
TPTBusiness d8c0d8865c fix(auto-fixer): fix two assignment-target bugs in instrument column fixers
1. _fix_instrument_column_access: var['instrument'] = EXPR was incorrectly
   converted to var.index.get_level_values(1) = EXPR, producing a SyntaxError
   ('cannot assign to function call'). Added (?!\s*=) negative lookahead to
   skip assignment targets.

2. _fix_groupby_column_on_multiindex: groupby(['instrument','date']) on a
   reset_index() variable was converted to groupby([var.index.get_level_values...])
   but reset_index() produces a plain RangeIndex, not a MultiIndex, causing
   AttributeError: 'RangeIndex' has no attribute 'normalize'. Added reset_vars
   guard to skip variables produced by reset_index().

Adds 1 new test (test_assignment_target_not_touched) — total 29 tests, all passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 15:55:01 +02:00
TPTBusiness 919a44a4b8 fix(auto-fixer): add five new factor code fixes for groupby/apply errors
1. groupby(level=['instrument','date']) → get_level_values() — string level
   names like 'date' don't exist in the (datetime, instrument) MultiIndex;
   replaced with get_level_values(0).normalize() + get_level_values(1).

2. groupby(level=['date','instrument']) — symmetric fix for reversed order.

3. groupby(level=['instrument']) → groupby(level=1) — single string level.

4. groupby(level=N)['col'].apply(lambda) → transform(lambda) — apply() on a
   grouped Series prepends an extra index level, causing index shape mismatch
   when assigned back; transform() preserves the original index.

5. df.loc[instrument] DateParseError fix (instrument_loc_multiindex) — already
   committed, adding supporting tests for groupby(level=['instrument','date']).

Adds 5 new tests (TestGroupbyLevelStringNames, TestGroupbyApplyToTransform)
— total 28 tests, all passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 15:40:53 +02:00
TPTBusiness 44f82b13d3 fix(auto-fixer): fix df.loc[instrument] DateParseError on MultiIndex frames
When LLM iterates over instruments via get_level_values('instrument').unique()
and then does df.loc[instrument], pandas tries to parse the instrument string
('EURUSD') as a datetime against level-0 of the (datetime, instrument) index,
raising DateParseError.

Fix: detect loop variables bound to get_level_values(1) or get_level_values('instrument')
and replace DF.loc[loop_var] (read) with DF.xs(loop_var, level=1). Assignment
write-backs are left untouched to avoid complex rewrites.

Adds 4 new tests (TestInstrumentLocMultiindex) — total 23 tests, all passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 15:31:35 +02:00
TPTBusiness 17a2558339 fix(auto-fixer): fix df['instrument'] KeyError on MultiIndex frames
LLM-generated code often accesses df['instrument'] as a column, but
'instrument' is an index level (level 1) in the MultiIndex DataFrame.
Replace with df.index.get_level_values(1) except when the variable
was created via reset_index() (where the column actually exists).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 21:57:35 +02:00
TPTBusiness ff1c9fc554 fix(auto-fixer): add groupby([level=N,'date']) SyntaxError fix
LLM generates invalid Python by putting keyword args inside lists:
  df.groupby([level=1, 'date'])  ← SyntaxError

Also fixes the regex for the chained groupby Pattern A/B which had
an unescaped ')' causing re.error that silently reverted the fix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 21:01:22 +02:00
TPTBusiness ba4d64b434 fix(auto-fixer): disable _fix_min_periods for intraday data
The fixer was raising min_periods to match window size, which causes
all-NaN output for intraday factors with 96 bars/day — window=240 means
zero valid bars per day, window=60 means 61% NaN per day. Critics were
consistently flagging this as incorrect for intraday factors. The LLM
now controls its own min_periods.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 18:59:58 +02:00