KA Pattern Evaluation Overview
Quick Summary
- Take a recent slice of candles for one trading pair and test a simple synthetic pattern on that slice.
- Compare that pattern result with two baselines: buy-and-hold long, buy-and-hold short, and the raw price move.
- Walk forward through equally sized slices to see how the asset behaved next and store all metrics for review.
1. Data Scope
- Uses the same candle history as the legacy evaluator (
ticker_data_binance
). - Runs per trading pair and interval, honouring
primary_ticker_limit
fromconfig.yaml
. - Each evaluation pulls the latest configured packet count and sorts candles chronologically.
2. Pattern Window
- Select a random window length between
pattern_window_min
andpattern_window_max
. - Choose a starting index that keeps the window fully inside the dataset.
- Compute the short-term synthetic return by blending baseline returns plus a configurable margin (placeholder until the real pattern logic lands).
Stored values:
- short_term_return – synthetic pattern performance.
- long_return / short_return – baseline buy-and-hold results after fees.
- base_start_price / base_end_price – raw asset price for the window.
3. Projection Windows
After the short-term window we advance by the same window length and capture:
- Long baseline return.
- Short baseline return.
- Raw price change percentage.
These feed the trajectory chart on the KA detail page.
4. Scoring
- score equals the short-term synthetic return (rounded to 6 decimals).
- Metadata tracks counts/averages of positive windows for long, short, and price projections.
5. Persistence Contract
KaEvaluationStorage
writes:
candidate_id
,trading_pair
,interval_name
,packets
score
,reference_price
metadata_json
,reasoning_json
,simulation_json
created_at
,updated_at
simulation_json
contains the short-term window, baselines, price anchors, and the projection array.
6. UI Notes
- Performance summary shows short-term vs. long/short baselines and raw price move.
- Performance trajectory plots projection windows alongside the short-term point.
- Metadata mirrors DB fields so you can cross-check stored values.
7. Future Hooks
- Replace the placeholder margin with real anomaly/pattern detection.
- Add templated trade decisions (e.g., enter long when pattern beats long baseline by X%).
- Allow per-interval projection horizons.
If you need to trace a candidate end-to-end, start with the candidate_id
in ka_pattern_candidates
, open the KA detail view, and refer back to this summary.