Spaces:
Sleeping
Sleeping
Audit execution and add frozen research phases
Browse files- README.md +17 -3
- app.py +1 -1
- risk_management.py +1 -1
- tests/test_audit_regressions.py +2 -2
README.md
CHANGED
|
@@ -36,9 +36,11 @@ missing candle, and writes a data snapshot plus manifest for every completed run
|
|
| 36 |
- Walk-forward backtest uses training data only at each origin, checks the
|
| 37 |
selected candle duration, skips gap-crossing targets, reports failures and
|
| 38 |
coverage, and includes a last-close persistence baseline.
|
| 39 |
-
- Backtests use the next candle's open as the entry, keep costs explicit,
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
- Live results are blocked when the latest closed candle is stale. The MAYTHOS
|
| 43 |
heuristic and forecast metrics are shown separately.
|
| 44 |
- Actionable live signals include causal Entry, Stop Loss, Take Profit and
|
|
@@ -60,6 +62,18 @@ missing candle, and writes a data snapshot plus manifest for every completed run
|
|
| 60 |
profitable trade recommendations.
|
| 61 |
- Every result can be downloaded as a ZIP containing candles, results, config,
|
| 62 |
package versions, SHA-256 snapshot hash, and evaluation policy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
## Windows setup
|
| 65 |
|
|
|
|
| 36 |
- Walk-forward backtest uses training data only at each origin, checks the
|
| 37 |
selected candle duration, skips gap-crossing targets, reports failures and
|
| 38 |
coverage, and includes a last-close persistence baseline.
|
| 39 |
+
- Backtests use the next candle's open as the entry, keep costs explicit, prevent
|
| 40 |
+
overlapping positions, and expose separate chronological **60% TUNE / 20%
|
| 41 |
+
VALIDATE / 20% VAULT** phases. Only the requested phase is evaluated. The
|
| 42 |
+
optional, default-off random control runs 200 independent seeded executions
|
| 43 |
+
with matched trade counts and long/short proportions. Inversion is separate.
|
| 44 |
- Live results are blocked when the latest closed candle is stale. The MAYTHOS
|
| 45 |
heuristic and forecast metrics are shown separately.
|
| 46 |
- Actionable live signals include causal Entry, Stop Loss, Take Profit and
|
|
|
|
| 62 |
profitable trade recommendations.
|
| 63 |
- Every result can be downloaded as a ZIP containing candles, results, config,
|
| 64 |
package versions, SHA-256 snapshot hash, and evaluation policy.
|
| 65 |
+
- Win/loss and win-rate metrics use **net trade profit**, including profitable
|
| 66 |
+
time-stop exits and losing targets after costs. SL/TP/timeout outcome labels
|
| 67 |
+
remain separate from net-profit classification.
|
| 68 |
+
- The **Frozen research** JSON API supports explicit historical endpoints,
|
| 69 |
+
immutable snapshot hashes, TUNE-only causal meta fitting, fixed per-trade
|
| 70 |
+
cash risk in R, doubled-cost stress and downloaded naive/null comparator rows.
|
| 71 |
+
Its stored forecast endpoint files are genuine historical Space inference
|
| 72 |
+
caches with provenance and hashes; the real pretrained model still loads.
|
| 73 |
+
They contain no trade outcomes or hardcoded performance values. A requested
|
| 74 |
+
snapshot hash mismatch stops evaluation.
|
| 75 |
+
- Frozen research experiments have **not** demonstrated a winning configuration
|
| 76 |
+
under the admission gates. No profitability claim or winning default is made.
|
| 77 |
|
| 78 |
## Windows setup
|
| 79 |
|
app.py
CHANGED
|
@@ -139,7 +139,7 @@ def run_backtest_ui(*args):
|
|
| 139 |
'Targets crossing gaps/market closures are explicitly skipped. Flat prices are classified as FLAT.\n\n'
|
| 140 |
'**Accuracy denominator:** successful forecast evaluations; failures and coverage are shown separately. '
|
| 141 |
'`persistence_mae` is the last-close naive baseline on the same valid targets. '
|
| 142 |
-
'**Trade execution is selective:** forecast targets must clear volatility noise, minimum
|
| 143 |
+ metadata_text(result['metadata'])
|
| 144 |
)
|
| 145 |
artifact = export_run(result, 'backtest')
|
|
|
|
| 139 |
'Targets crossing gaps/market closures are explicitly skipped. Flat prices are classified as FLAT.\n\n'
|
| 140 |
'**Accuracy denominator:** successful forecast evaluations; failures and coverage are shown separately. '
|
| 141 |
'`persistence_mae` is the last-close naive baseline on the same valid targets. '
|
| 142 |
+
f'**Trade execution is selective:** forecast targets must clear {config.minimum_edge_atr:g} ATR of volatility noise, minimum {config.minimum_risk_reward:g}R reward/risk, and 1.25× the configured round-trip costs; otherwise the forecast remains visible but no trade is opened. Forecast stops use {config.atr_stop_multiplier:g} ATR. MAYTHOS uses only strong, unblocked signals. Candle-path resolution checks SL before TP when both touch; costs are explicit spread/fee/slippage assumptions, not provider-measured quotes.**\n\n'
|
| 143 |
+ metadata_text(result['metadata'])
|
| 144 |
)
|
| 145 |
artifact = export_run(result, 'backtest')
|
risk_management.py
CHANGED
|
@@ -220,7 +220,7 @@ def build_trade_levels(
|
|
| 220 |
except (TypeError, ValueError):
|
| 221 |
forecast_value = None
|
| 222 |
if any(isinstance(value, (bool, np.bool_)) for value in (
|
| 223 |
-
minimum_edge_atr, minimum_risk_reward, minimum_edge_bps)):
|
| 224 |
raise ValueError('minimum_edge_atr/minimum_edge_bps must be numeric and minimum_risk_reward must be numeric.')
|
| 225 |
try:
|
| 226 |
minimum_edge_atr = float(minimum_edge_atr)
|
|
|
|
| 220 |
except (TypeError, ValueError):
|
| 221 |
forecast_value = None
|
| 222 |
if any(isinstance(value, (bool, np.bool_)) for value in (
|
| 223 |
+
minimum_edge_atr, minimum_risk_reward, minimum_edge_bps, atr_stop_multiplier)):
|
| 224 |
raise ValueError('minimum_edge_atr/minimum_edge_bps must be numeric and minimum_risk_reward must be numeric.')
|
| 225 |
try:
|
| 226 |
minimum_edge_atr = float(minimum_edge_atr)
|
tests/test_audit_regressions.py
CHANGED
|
@@ -68,9 +68,9 @@ def test_win_loss_counts_reconcile_with_net_profit():
|
|
| 68 |
frame = pd.DataFrame({'trade_taken': [True]*3, 'net_r': [-0.1, 0.3, -1.0],
|
| 69 |
'outcome': ['TP', 'TIMEOUT', 'SL']})
|
| 70 |
summary = summarize_trades(frame)
|
| 71 |
-
assert summary['wins'] ==
|
| 72 |
assert summary['losses'] == 1
|
| 73 |
-
assert summary['win_rate_pct'] == pytest.approx(
|
| 74 |
|
| 75 |
|
| 76 |
def test_invalid_intermediate_forecast_is_not_scored():
|
|
|
|
| 68 |
frame = pd.DataFrame({'trade_taken': [True]*3, 'net_r': [-0.1, 0.3, -1.0],
|
| 69 |
'outcome': ['TP', 'TIMEOUT', 'SL']})
|
| 70 |
summary = summarize_trades(frame)
|
| 71 |
+
assert summary['wins'] == 2
|
| 72 |
assert summary['losses'] == 1
|
| 73 |
+
assert summary['win_rate_pct'] == pytest.approx(66.67)
|
| 74 |
|
| 75 |
|
| 76 |
def test_invalid_intermediate_forecast_is_not_scored():
|