100 Commits
Author SHA1 Message Date
Emerson Gomes e4aa2fa14b fix(stress-test): add uniform --shock-pct flag 2026-09-02 21:00:05 -05:00
Emerson Gomes a839af8553 fix(screener): add formatted market-cap beside the raw value 2026-09-02 21:00:05 -05:00
Emerson Gomes 47958be8db fix(market-status): report closed session instead of stale quote 2026-09-02 20:59:59 -05:00
Emerson Gomes f91047af13 fix(market): pass quote point and radar rank_order 2026-09-02 20:59:59 -05:00
Emerson Gomes 5ffa42814f fix(confluence): add side filter for support vs resistance 2026-09-02 20:59:59 -05:00
Emerson Gomes 3d99201815 fix(barriers): infer grid_style=preset from --preset 2026-09-02 20:59:50 -05:00
Emerson Gomes ef44bd1681 fix(output): keep spread completeness and standard model rows 2026-09-02 20:59:50 -05:00
Emerson Gomes 2644bd7b27 fix(snapshot): project labeled HMM regime fields 2026-09-02 20:59:46 -05:00
Emerson Gomes 1885dce709 fix(calendar): accept comma-separated impact levels 2026-09-02 20:49:30 -05:00
Emerson Gomes 74e27841e7 fix(calendar): warn when non-US filters match no Finviz events 2026-09-02 20:48:11 -05:00
Emerson Gomes b009dec8ef fix(trade-history): convert open-position timestamps to UTC 2026-09-02 20:47:12 -05:00
Emerson Gomes bd50cc2e63 fix(output): disclose stale tickets, skip reasons, and compact trust cues
Map stale position quotes to tickets, warn on null tick spreads, and surface scan skip reasons plus bar-vs-live direction divergence so compact output can be acted on without a second full-detail call.
2026-09-02 20:05:01 -05:00
Emerson Gomes 86c1266e23 fix(forecast): break tune/optimize import cycle 2026-09-02 19:20:51 -05:00
Emerson Gomes a67b2e3bf3 fix(barriers): use shared Monte Carlo method set 2026-09-02 19:20:49 -05:00
Emerson Gomes 4f8486ce5a fix(mcp): stop swallowing tool-call coercion errors 2026-09-02 19:20:47 -05:00
Emerson Gomes 007767c226 fix(schema): reject overflowing minutes_back at request boundary 2026-09-02 19:20:44 -05:00
Emerson Gomes 8cddcd4195 fix(market-status): render exact hours as readable words 2026-09-02 19:20:42 -05:00
Emerson Gomes 1f29ec0d8c fix(wait): ignore replayed position_opened history deals
Only match position_opened from DEAL_ENTRY_IN when the ticket is still open and was not already in the wait baseline, so closed fills cannot wake the watcher.
2026-09-02 14:07:15 -05:00
Emerson Gomes f7698a19f5 fix(mcp): anchor JSON Schema patterns for llama.cpp
llama.cpp drops unanchored pattern constraints and PCRE shorthands such
as \S, which produced incomplete grammar conversion warnings. Use
anchored, hex-escaped whitespace classes instead.
2026-09-02 07:38:25 -05:00
Emerson Gomes 0f709cb94e fix(wait): splice live quotes instead of aborting on history lag
Wait-event market watchers now keep tick history for the window and attach the executable quote when the archive lags, using a spread/tick/relative agreement band that works for FX, crypto, and stocks.
2026-09-01 21:13:59 -05:00
Emerson GomesandCursor 70b53189b9 fix(patterns): stop silent degradation and untrue availability claims
Pattern detection had two recurring defects: a fallback that quietly
substituted different data than the caller asked for, and metadata that
asserted a point-in-time or guarantee the computation could not support.

Data substitution:

- Denoising on the classic/harmonic/elliott/fractal path smoothed only
  `close`, so the smoothed close routinely fell outside its own raw candle
  and ~68% of rows were reverted to raw -- preferentially at the local
  extremes pivot detection keys on. Require the full OHLC set, matching the
  candlestick path, and reject an explicitly partial column list.
- A failed denoise still echoed the requested spec with
  `preprocessing_causality: "causal"`. Report `denoise_applied: false`,
  `denoise_error` and `preprocessing_causality: "raw_prices"` instead.
- One non-finite OHLC value makes the aggregate candlestick dispatcher
  throw, leaving only the few directly-attached detectors. The failure was
  unrecorded because `dispatch_names` is the string "all", not a list. Add a
  `detector_coverage` block plus a warning, and surface names the installed
  backend does not provide (`outside` is absent from pandas-ta-classic).

Untrue claims:

- Elliott `available_at_index` was 67% irreproducible when re-running over a
  window truncated at that index, because pivot spacing and (under the
  default `scale_mode="auto"`) the swing scale are whole-window statistics.
  Report the right edge as the guarantee and demote the confirmation-derived
  figure to `earliest_possible_index_estimate` with a caveat, matching the
  harmonic contract. Also track when a min-distance choice was settled so a
  pivot surviving a later challenge is not claimed knowable at its own bar.
- The "no patterns detected in N bars" note omitted `observed_bars` outside
  candlestick mode, asserting absence over bars never fetched.
- `df.attrs["pattern_ohlc_fallback"]` was written for the API layer to
  disclose and never read, and was written after a slice so it could not
  reach the caller. Wire it into warnings and report `analyzed_bars` when a
  detector caps its own input window.
- `data_freshness` emitted the literal string "None", which is truthy and
  then broke the year parse that would have raised a staleness warning.

Silent no-ops and misattribution:

- The documented `mode="all"` namespacing (`{"harmonic": {...}}`) reported
  the section name as an invalid key and failed the fractal and harmonic
  sections. Validate a section's contents against that detector, and
  attribute an unknown top-level key to every detector that could own it
  rather than only fractal and harmonic.
- `detail="summary"` dropped `warnings`, `data_quality`, `candles` and
  `effective_window` -- exactly the fields that say not to trust a result.
- `min_strength`, `min_gap` and `robust_only` were accepted and ignored
  outside candlestick mode; reject a non-default value like the adjacent
  `engine` and `whitelist` guards do.
- Fractal `include_stale_levels` was discarded by the visibility allowlist
  unless `include_completed` was also set, and stale rows were hidden
  without being counted.
- Six Elliott config knobs were unread: the four rule/classifier blend
  weights (no blend exists; an existing test pinned that) and two additive
  unconfirmed-pattern penalties superseded by the confidence cap. Remove
  them so they become explicit unknown-key errors.

Scoring correctness:

- Candlestick geometry keyed its body-size expectation off the deprioritize
  set, so hammers, shooting stars and harami were scored as if a large body
  confirmed them, while marubozu was scored as if a small one did. Classify
  the expectation per pattern.
- A zero-range bar scored `body_ratio = 0.5` ("unknown"), making a perfect
  doji rank below an imperfect one; it has a zero body by construction.
- `min_gap` spaced candidates selected at threshold 0.0, so a weak hit could
  consume the slot and erase a qualifying signal one bar away. Space among
  rows that meet `min_strength`.
- `inside` was signed by candle colour, contradicting the harami detected on
  the identical bars and defeating the dedupe that exists to replace it.
  Report it as non-directional and let the specific form suppress it.
- A hikkake confirmation bar (magnitude 200) was given the three-bar setup
  span, putting `start_index` inside the setup.
- Candlestick `recency` used the reported bar count while `end_index` indexes
  the warmup-inclusive frame, clamping `bars_ago` to 0 for every pattern in
  the warmup span and biasing the cross-detector ranking.
- Volume-confirmation warmup ignored pattern span, so a multi-bar pattern on
  the first visible bar had a short baseline.

Verified: ruff clean, 10115 backend tests pass, schemas 83/83.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-01 13:54:32 -05:00
Emerson GomesandCursor 818c918143 fix(barriers): detect t=0 breaches and correct simulation statistics
TP/SL distances are measured from the entry quote while simulated paths are
scored from the exit quote, so a barrier inside the spread was already crossed
before the first simulated bar. Neither close comparisons nor the Brownian
bridge could observe it, and both tools reported ordinary-looking probabilities
for a position that would resolve instantly.

The minimum barrier distance used the payoff deduction, which excludes spread
when live quotes embed it in path geometry, so the round-trip cost floor
silently dropped spread exactly when it mattered most.

Antithetic paths are mirrored pairs, so p(1-p)/n misstated sampling error in
both directions: too narrow for prob_no_hit, too wide for monotone first-hit
probabilities. Each Wilson interval is now sized by its own design effect.
Independent-seed and walk-forward evidence can close the trade gate instead of
only reporting optimism, and cross-seed stability now separates estimator noise
from selection churn rather than blaming simulation size for a missing edge.

Also disclose the implicit min_prob_resolve floor and the realized-payoff
profit_factor basis, reject mode-mismatched min_barrier_* keys instead of
ignoring them, and fix the labeling history guard, the silent high_low fallback
to close-only detection, and the inert same_bar_policy in close-only mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-01 12:03:23 -05:00
Emerson Gomes 7b4348574a test(web): align history timestamp default 2026-09-01 11:06:40 -05:00
Emerson Gomes f696e34aab fix(mt5): detect unloaded timezone settings 2026-09-01 11:06:20 -05:00
Emerson Gomes 9e7c16da22 fix(wait): default omitted watchers to empty list 2026-09-01 10:49:40 -05:00
Emerson Gomes e4a6aea9cb fix(data): simplify wait event timing 2026-09-01 09:24:32 -05:00
Emerson Gomes 08b3e6bfb6 fix(forecast): correct barrier calculations 2026-09-01 08:08:48 -05:00
Emerson Gomes 6534c4696b fix(barriers): accept pips in probability forecast 2026-08-31 21:47:49 -05:00
Emerson Gomes 76f5f0c432 fix(forecast): accept prevalidated barrier specs 2026-08-31 19:50:22 -05:00
Emerson Gomes 8309e3131e feat(barriers): add pips unit, rename --barrier, and align defaults
Add unit=pips via forex_pip_size while keeping ticks as broker tick/point. Rename labels_triple_barrier --barriers to --barrier with no alias, and default forecast_barrier_optimize to mc_gbm_bb to match forecast_barrier_prob.
2026-08-31 15:45:54 -05:00
Emerson Gomes 24f019920b fix(volatility): note decimal vol vs percent-point barriers
Keep compact unit on volatility_term_structure and explain that 0.0465 decimal times 100 is percent-points for labels_triple_barrier and forecast_barrier_prob.
2026-08-31 15:45:45 -05:00
Emerson Gomes 42cf5a37d4 fix(forecast): stop claiming stored models after artifact removal
When forecast_task_status finds model_store_status other than present, rewrite the completion message and set model_reusable false so expired or deleted artifacts are not advertised as reusable.
2026-08-31 15:45:45 -05:00
Emerson Gomes e60b41010b fix(options): stop labeling delayed Yahoo chains as unusable
Key option_chain_quality on missing quote timestamps even when last-trade contract_as_of exists, point remediation at Tradier configuration, and name MTDATA_OPTIONS_PROVIDER/MTDATA_OPTIONS_API_KEY in Heston rejection copy. Anonymous Yahoo status stays ready_degraded.
2026-08-31 15:45:29 -05:00
Emerson Gomes 43ba46caba fix(data): suffix indicator columns computed from denoised prices
Close-only pre-TI denoise was feeding smoothed close into RSI while leaving the column named rsi_14. Rename those columns whenever the indicator input was denoised, emit indicator_column_suffix only after a rename, and keep indicator_input on compact output.
2026-08-31 15:45:24 -05:00
Emerson Gomes bf8e7dafb1 docs(help): disclose options limits, BSM r/q, and top-markets time
Document compact options_expirations default of 12 and has_more, map barrier risk_free_rate/dividend_yield to r/q (FX q as foreign/base), and say top-markets time follows data_source.
2026-08-31 15:35:07 -05:00
Emerson Gomes b8f30196f4 fix(output): split live-quote warnings from non-viable execution
Emit execution_not_ready or optimizer_non_viable instead of quote_not_live when the quote is live, and skip freshness_unverified when stress-test marks are not_applicable.
2026-08-31 15:34:54 -05:00
Emerson Gomes d640ee79f1 fix(trade): keep preview quote gate, protection errors, and risk units
Pass compacted quote_context, sl_tp_error, and validation_error through compact TOON, keep lookback_bars on support_resistance, and label candidate risk_currency as account_currency.
2026-08-31 15:34:49 -05:00
Emerson Gomes bf91c0d5ff fix(calendar): disclose that mt5 is not a calendar provider
Update the source Field and help so auto uses Finviz and source=mt5 is documented as a capability error.
2026-08-31 15:34:42 -05:00
Emerson Gomes a3434ecd64 fix(diagnostics): null dominant period when seasonality is not detected
Avoid promoting a noise-floor ACF period to dominant_period_bars when detection_status is not_detected.
2026-08-31 15:34:28 -05:00
Emerson Gomes 8fbaff76ea fix(finviz): add recom 1-5 analyst consensus units
Disclose equity_profile and screener recom as analyst_consensus_1_strong_buy_to_5_sell so the Finviz 1-5 scale is visible in units.
2026-08-31 15:34:28 -05:00
Emerson Gomes 8809e8e1f3 docs: align causal, indicator, and confluence output shapes
Rewrite Granger output to the TOON/JSON items payload, use tick_volume in indicator examples, and document that confluence sources appear only at standard/full detail.
2026-08-31 15:34:08 -05:00
Emerson Gomes 0e93288f85 docs: document forming-bar horizon and candle timestamp bounds
Horizon counts from the open of the current forming bar unless as-of or a historical range is set. Candle timestamp ranges keep fully contained bars (open >= start, close <= end). Candle summary detail replaces rows with summary_statistics.
2026-08-31 15:26:40 -05:00
Emerson Gomes 54ad9a52af fix(data): correct empty closed-range tick warning
Empty weekend tick ranges warned that the latest completed data is shown even though no ticks were returned. Mirror the candle empty-closed message.
2026-08-31 15:26:40 -05:00
Emerson Gomes 7373a72f81 fix(data): do not mark live forming bars as stale
include_incomplete measured the market tick but then always set data_stale. Leave data_stale false when the tick is within the live freshness window, and emit forming_bar_unverified instead.
2026-08-31 15:26:40 -05:00
Emerson Gomes 3c5dcaf619 fix(data): return latest-N D1 bars across weekend session gaps
Unbounded latest-N freshness used a fixed bar lattice, so Monday D1 queries hard-failed as stale even when the hole was a weekend/session break. Keep the closed-market H1 relaxation, warn for calendar-explained gaps, and still fail unexplained weekday holes.
2026-08-31 15:26:34 -05:00
Emerson Gomes da98bf14ba docs(output): describe remaining TOON vs JSON presentation deltas 2026-08-31 15:22:37 -05:00
Emerson Gomes 652e4a3b1f fix(output): compact strategy_validate and keep catalog pagination totals 2026-08-31 15:22:35 -05:00
Emerson Gomes 46b734b77a fix(output): keep TOON money cents, empty collections, and quote timestamps 2026-08-31 15:22:32 -05:00
Emerson Gomes 11c5f2807c fix(cli): keep partial projections successful and ignore broken pipes
Mixed --output-fields now keep success=true with output_fields_status=partial.
Closed-pipe stdout writes exit 0. Library FutureWarnings no longer leak into
the public warnings array. wait_event help uses a valid price_touch_level example.
2026-08-31 15:11:11 -05:00
Emerson Gomes f188c9e431 fix(cli): parse wait_event JSON and accept side/shock aliases
Replace the invalid wait_event help example with price_touch_level, keep
brace-delimited JSON as one token, and hint when PowerShell strips quotes.
Accept LONG/SHORT for trade_close side filters, strip optional % on stress
shocks, and describe cointegration's canonical pair orientation.
2026-08-31 15:11:01 -05:00
Emerson Gomes a0820257fe fix(options): distinguish missing quote timestamps from unusable chains 2026-08-31 12:17:28 -05:00
Emerson Gomes 89ec3373f2 fix(trading): keep idea timestamps, guardrail caps, and server-clock conversion 2026-08-31 12:16:17 -05:00
Emerson Gomes 161ef9beb6 fix(forecast): reject undersampled GARCH and drop misleading 1-bar vol default 2026-08-31 12:16:14 -05:00
Emerson Gomes 3693629b82 fix(data): default timestamps to UTC and disclose volume, gaps, and tick quality 2026-08-31 12:16:14 -05:00
Emerson Gomes 13bfe96ef3 fix(market): keep tradability flags consistent and accept live ranking 2026-08-31 12:16:08 -05:00
Emerson Gomes 9567f03d68 fix(output): fail unknown fields, stabilize TOON columns, keep catalog pagination 2026-08-31 12:16:08 -05:00
Emerson Gomes f4ffdced19 fix(web-api): honor supports/resistances instead of a false 404 2026-08-31 12:16:00 -05:00
Emerson Gomes 63783ca63b test(data): expect compact time trust metadata 2026-08-30 19:20:17 -05:00
Emerson Gomes 25f5ee9147 test(output): expect structured error warnings 2026-08-30 19:20:17 -05:00
Emerson Gomes a27ef33748 fix(output): recognize verified fresh history 2026-08-30 19:13:35 -05:00
Emerson Gomes 7090eb1361 fix(data): surface invalid compact spread samples 2026-08-30 19:13:35 -05:00
Emerson Gomes 288d514570 fix(output): compact trading error diagnostics 2026-08-30 19:13:06 -05:00
Emerson Gomes b7821c3de3 fix(volatility): exclude returns across missing bars 2026-08-30 19:12:30 -05:00
Emerson Gomes 7a6ef18542 fix(forecast): qualify unsafe tuning winners 2026-08-30 19:12:04 -05:00
Emerson Gomes d6549c6133 fix(analytics): align ensemble and replay trust metadata 2026-08-30 19:11:50 -05:00
Emerson Gomes 1d8bb5b208 fix(analytics): rebuild capped levels and sparse profiles 2026-08-30 19:11:45 -05:00
Emerson Gomes 43040a68f7 fix(patterns): preserve candlestick geometry under denoising 2026-08-30 19:11:38 -05:00
Emerson Gomes 578b969086 fix(analytics): preserve compact analysis semantics 2026-08-30 19:11:23 -05:00
Emerson Gomes 39f1e912e2 fix(web): honor dedicated workflow contracts 2026-08-30 19:09:51 -05:00
Emerson Gomes 69e2eeb0e8 fix(forecast): preserve analog search semantics 2026-08-30 19:09:19 -05:00
Emerson Gomes 3fbbf6df51 fix(trading): align explicit ideas with point forecasts 2026-08-30 19:08:08 -05:00
Emerson Gomes 1451551296 fix(forecast): enforce forecasting contracts 2026-08-30 19:07:17 -05:00
Emerson Gomes 968357f848 fix(trading): block unfundable risk recommendations 2026-08-30 19:05:21 -05:00
Emerson Gomes 47f6c50ad9 feat(trading): filter bulk closes by side 2026-08-30 19:02:25 -05:00
Emerson Gomes 23ce8718f3 fix(trading): reconcile account and history contracts 2026-08-30 18:59:40 -05:00
Emerson Gomes 3006535b12 fix(analytics): decouple partial fills from row limits 2026-08-30 18:58:56 -05:00
Emerson Gomes 97ff1c756d fix(risk): preserve portfolio scenario semantics 2026-08-30 18:57:33 -05:00
Emerson Gomes cd1f865061 fix(symbols): label broker sizing units 2026-08-30 18:55:33 -05:00
Emerson Gomes 811e2800b2 fix(market): resolve aliases for depth requests 2026-08-30 18:54:49 -05:00
Emerson Gomes 731def9bb2 fix(output): classify unusable quote warnings accurately 2026-08-30 18:53:58 -05:00
Emerson Gomes 25d48153e3 fix(market): use England holidays for LSE 2026-08-30 18:52:09 -05:00
Emerson Gomes eeead844ee fix(webui): preserve forecast contract evidence 2026-08-30 18:51:03 -05:00
Emerson Gomes 6d6fe57878 fix(time): fail closed across DST transitions 2026-08-30 18:49:33 -05:00
Emerson Gomes 88cd6d9a11 fix(trading): make idempotency exception-safe 2026-08-30 18:45:44 -05:00
Emerson Gomes d048c7ee81 fix(data): validate tick range semantics 2026-08-30 18:45:15 -05:00
Emerson Gomes c962a044a4 fix(trading): report local modify no-ops accurately 2026-08-30 18:40:35 -05:00
Emerson Gomes 979611cb18 fix(config): reject invalid trading timezones 2026-08-30 18:40:07 -05:00
Emerson Gomes 4202312ddd fix(webui): make live chart state trustworthy 2026-08-30 18:38:54 -05:00
Emerson Gomes 30ce90a0a3 fix(trading): reconcile quote readiness 2026-08-30 18:38:26 -05:00
Emerson Gomes 8589b4f2d6 fix(trading): preserve injected guardrail configs 2026-08-30 18:36:47 -05:00
Emerson Gomes 2a2d436db6 fix(forecast): enforce explicit feature contracts 2026-08-30 18:35:12 -05:00
Emerson Gomes d842403eff fix(trading): load guardrails atomically 2026-08-30 18:35:01 -05:00
Emerson Gomes 4a63db107c fix(mt5): enforce configured connection identity 2026-08-30 18:30:34 -05:00
Emerson Gomes cc2d45d1c1 fix(webui): bind auth and tool results to active state 2026-08-30 18:28:43 -05:00
Emerson Gomes 97a6aaba20 fix(risk): compute exact holding-period tail loss 2026-08-30 18:26:54 -05:00
Emerson Gomes e84c5d8f46 fix(indicators): reject malformed explicit parameters 2026-08-30 18:24:52 -05:00
Emerson Gomes 7141f4a855 fix(output): retain compact snapshot trust metadata 2026-08-30 18:21:54 -05:00
Emerson Gomes c81126f274 fix(report): reject diagnostic-only sections 2026-08-30 18:14:46 -05:00
Emerson Gomes d44c6eda7e fix(output): normalize warnings in error responses 2026-08-30 18:13:50 -05:00
Emerson Gomes 55d19f4b09 fix(denoise): accept pagination offsets 2026-08-30 18:13:14 -05:00