Skip to content

Codex/feat add by hsc 20260926 - #15

Merged
OlympusCore merged 9 commits into
mainfrom
codex/feat-add-by-hsc-20260926
Sep 26, 2026
Merged

OlympusCore merged 9 commits into
mainfrom
codex/feat-add-by-hsc-20260926

Conversation

@OlympusCore

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings September 26, 2026 18:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

A confirmed logic bug in candidate_safety_blockers uses ambiguous ternary/or precedence and can incorrectly reject valid candidates.

Review effort: Lite
Findings: 1 Medium severity · 2 Low severity

Open (3)
What changed in this PR

This PR expands AI4BINANCE’s deterministic, research-only pipeline by introducing a typed “Trading Intelligence” evidence chain (structures/levels/trend/patterns/derivatives → scenarios), binding candidates to a selected scenario, and tightening downstream risk/validation contracts (including scenario-bound sizing and futures margin projection) while keeping RESEARCH_ONLY / LIVE_ORDER_BLOCKED invariants.

Changes:

  • Add new ai4binance.intelligence contracts + engines and integrate them into the orchestrator state/candidate flow.
  • Strengthen risk + validation gates with scenario-bound checks (net R/R, sizing evidence, candidate identity safety blockers).
  • Improve market-universe + persistence boundaries (canonical universe source constant, stricter retention rules, canonical bounded JSONL tail reader), with broad new/updated tests.
File Description
tests/​test_virtual_runtime.py Adds futures projected-margin-after-costs entry test.
tests/​test_trading_intelligence.py New deterministic intelligence evidence-chain test suite.
tests/​test_research_market_universe.py Asserts universe source constant matches canonical domain contract; adds non-ASCII retention case.
tests/​test_opportunity_monitor.py Verifies monitor uses canonical universe source when reading cache.
tests/​test_oos_maturity.py Validates maturity flow with real RiskEngine assessment metadata.
tests/​test_kaizen_quality.py Updates architecture migration ledger expectations for intelligence contracts move.
tests/​test_config_reporting.py Updates default market_history_coin_m_enabled expectation.
tests/​test_cli.py Updates cached market universe monkeypatches to accept kwargs.
tests/​test_advanced_agents.py Adds test asserting derivatives context can be non-directional (supplementary).
src/​ai4binance/​storage/​jsonl.py Removes duplicated tail-reader logic; re-exports canonical bounded JSONL tail reader.
src/​ai4binance/​schemas.py Extends AnalysisState to carry TradingIntelligenceState with identity validation.
src/​ai4binance/​risk.py Adds scenario-bound safety helpers (candidate_safety_blockers, candidate_risk_distance), net R/R rules, and richer RiskAssessment.
src/​ai4binance/​research/​virtual_runtime.py Adds futures projected margin utilization checks accounting for fees/funding/mark-loss.
src/​ai4binance/​research/​virtual_runtime_risk.py Adds simulated leverage assessment contract + tighter futures entry blockers.
src/​ai4binance/​research/​virtual_runtime_request.py Adds non-finite numeric input validation and leverage type enforcement.
src/​ai4binance/​ops/​architecture_migration.py Adds migration routing for intelligence package to domain path.
src/​ai4binance/​intelligence/​trend.py New trend-geometry engine producing bounded trend-zone evidence.
src/​ai4binance/​intelligence/​trading.py New trading intelligence engine that synthesizes evidence into scenarios and binds candidates.
src/​ai4binance/​intelligence/​structure.py New confirmed-swing market structure engine (no look-ahead).
src/​ai4binance/​intelligence/​patterns.py New pattern hypothesis fabric normalizing pattern detectors into lifecycle-bound hypotheses.
src/​ai4binance/​intelligence/​levels.py New structural level-map engine producing reusable support/resistance zones.
src/​ai4binance/​intelligence/​derivatives.py New typed futures context engine with provenance/freshness/metric validation.
src/​ai4binance/​intelligence/​contracts.py New immutable evidence contracts for deterministic trading intelligence state.
src/​ai4binance/​intelligence/​__init__.py Adds side-effect-free package initializer.
src/​ai4binance/​integrations/​research_market_universe.py Uses canonical universe source constant and canonical JSONL tail reader; enables coin-m transport passthrough.
src/​ai4binance/​infrastructure/​persistence/​safe_json.py Removes duplicated tail-reader logic; re-exports canonical bounded JSONL tail reader.
src/​ai4binance/​domain/​universe.py Defines canonical RESEARCH_MARKET_UNIVERSE_SOURCE in domain contract.
src/​ai4binance/​domain.py Extends TradeCandidate with scenario/economics fields + stronger finiteness/contract validation.
src/​ai4binance/​data/​market_universe_retention.py Tightens retention to remove out-of-universe non-symbol directories/files safely.
src/​ai4binance/​data/​market_history_continuous.py Extends progress reporting to include universe source/selection/retention context.
src/​ai4binance/​core/​__init__.py Introduces canonical read_bounded_jsonl_tail implementation in core boundary.
src/​ai4binance/​config.py Enables coin-m market history by default.
src/​ai4binance/​compatibility/​opportunity_monitor.py Imports canonical universe source constant from domain.
src/​ai4binance/​agents/​validation_gate.py Tightens validation with scenario binding, candidate safety blockers, and sizing evidence checks.
src/​ai4binance/​agents/​technical.py Updates market structure agent to use confirmed-swing engine while preserving legacy metadata fields.
src/​ai4binance/​agents/​risk_gate.py Adds scenario/economics provenance into risk-agent metadata and assessments.
src/​ai4binance/​agents/​orchestrator.py Builds trading intelligence state per cycle, binds candidates, and carries state into AnalysisState.
src/​ai4binance/​agents/​advanced.py Adds source_timeframe to advanced-agent metadata; allows derivatives context to be non-directional.
docs/​compliance/​registry_compliance_matrix.md Bumps compliance matrix version and records intelligence boundary/quality closure linkage.
config/​governance/​governed_document_lock_manifest.json Adds written owner approval record + updates locked hash/version for compliance matrix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ai4binance/risk.py Outdated
Comment thread src/ai4binance/domain.py Outdated
Comment thread src/ai4binance/risk.py Outdated
hscicek
hscicek previously approved these changes Sep 26, 2026
@OlympusCore
OlympusCore merged commit c70756a into main Sep 26, 2026
2 checks passed
@OlympusCore
OlympusCore deleted the codex/feat-add-by-hsc-20260926 branch September 26, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants