Commit Graph

138 Commits

Author SHA1 Message Date
TPTBusiness 9e269dafe1 fix: add hypothesis to test deps and fix missing imports in deep tests 2026-05-09 18:06:39 +02:00
TPTBusiness 9d6c6d1d5f 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 d098a8213b 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 0407b3c53e 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 6e420e0715 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 c92530c5a8 chore: remove accidentally committed pycache files 2026-05-08 22:47:50 +02:00
TPTBusiness d924f3d142 test: add tests for RDAgentLog debug() and LiteLLMAPIBackend 2026-05-08 22:47:41 +02:00
TPTBusiness 9f93ca1374 fix: prevent LLM retry loop from consecutive assistant message corruption 2026-05-05 18:56:12 +02:00
TPTBusiness 1b93ae2c99 fix: relax WF default test (wf_oos_sharpe_mean not present when 0 windows) 2026-05-05 06:44:04 +02:00
TPTBusiness e412eb0f32 docs: add closed-source test policy; remove closed-source test imports 2026-05-04 22:31:11 +02:00
TPTBusiness 2cdedc9948 test: add 9 tests (verifier edge cases, factor loader, stability, MTF, save strategy) — 641 total 2026-05-04 22:19:49 +02:00
TPTBusiness 439bc7872a test: add 10 tests (continuous gen, strategy builder, live trader, factor integration) — 632 total 2026-05-04 22:11:39 +02:00
TPTBusiness bff706d3e1 fix: update WF test for new default (wf_rolling=True) 2026-05-04 22:04:05 +02:00
TPTBusiness 55b2f22ad0 test: add 15 tests (WF details, optuna, preflight, signal validation, IC bounds) — 622 total 2026-05-04 21:56:28 +02:00
TPTBusiness 56bd719a9c 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 4f92bbd916 test: add 16 headform tests (docker mocks, spread, rollover, regression, cross-system) — 592 total 2026-05-04 21:39:27 +02:00
TPTBusiness 7e2e28542b test: add 7 robustness tests (slippage, latency, MC-reshuffle, OOS, weekend gaps) — 576 total 2026-05-04 21:06:53 +02:00
TPTBusiness bbf127013e test: add 15 deepest tests (property-based, metamorphic, fuzzing, stress) — 569 total 2026-05-04 18:31:28 +02:00
TPTBusiness 8bf75ccfa6 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 70ad304a37 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 cc265d6045 refactor: move strategy_orchestrator and optuna_optimizer to closed-source (local/) 2026-05-03 21:38:09 +02:00
TPTBusiness 1606546496 feat: add runtime backtest verification (10 invariant checks in <1ms) + 489 tests + README docs 2026-05-03 14:00:49 +02:00
TPTBusiness 4fd43f34c0 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 4ed7023e63 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 a437191ed1 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 6ed8cb165d 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 fcd477f1d2 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 83b5ba8671 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 14eddbfe05 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 81154b882e 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 62acc6af6a test: add 42 tests for remaining modules (conf, kb, interactor, fmt, llm_utils, graph) 2026-05-03 11:31:28 +02:00
TPTBusiness 84972c3611 test: add 28 tests for LLM components, RL indicators, and model evaluators 2026-05-03 11:24:28 +02:00
TPTBusiness 39675dc197 test: add 39 tests for fx_config, utils, predix_full_eval, exceptions, and log 2026-05-03 11:18:27 +02:00
TPTBusiness 3c196c79dc test: add 4 tests for QuantTrace and QlibQuantHypothesis 2026-05-03 11:14:33 +02:00
TPTBusiness b87b965937 test: add 24 tests for factor/model scenarios and experiments 2026-05-03 11:12:23 +02:00
TPTBusiness e87f177e6b test: add 33 tests for app config, strategy builder, and quant scenario 2026-05-03 11:09:55 +02:00
TPTBusiness c6c2aab05b 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 1346cb3ccf fix: add missing sys import and fix undefined acc_rate in factor eval 2026-05-03 10:19:59 +02:00
TPTBusiness e17877c789 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 a9e65f790a 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 a26f7617fb test: add direct unit tests for _apply_ftmo_mask, safe_resolve_path, import_class, and _add_column_if_not_exists 2026-05-03 00:35:57 +02:00
TPTBusiness 09978c97ca 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 849a14185a 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 beda7eedad 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 367806e006 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 ee20c26c7d 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 7897c58290 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 6e9d4d34ff 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 7595b3c693 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
TPTBusiness c1ce6b1798 fix(auto-fixer): fix chained groupby(level=N).groupby('date') pattern
LLM learns from feedback to use groupby(level=1) for instrument, then
chains .groupby('date') to add the date dimension — but DataFrameGroupBy
has no .groupby() method, causing AttributeError at runtime.

Replace the invalid chain with a correct two-level groupby using
index.get_level_values(), consistent with the existing instrument+date fix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 15:34:10 +02:00