Skip to content

Commit a71253d

Browse files
committed
docs
1 parent e9a9f18 commit a71253d

21 files changed

Lines changed: 321 additions & 5853 deletions

docs/classes/ClientSimulator.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,26 @@ Implements `ISimulator`
1010
Parameter sweep engine over crowd trading ideas (the "Simulator").
1111

1212
Finds production strategy parameters (hard stop, trailing take,
13-
hold duration, entry consensus threshold) by simulating every idea
14-
against every point of the grid — WITHOUT re-running a backtest per
15-
point. The root iteration is over IDEAS, not candles and not grid
16-
points:
13+
hold duration, author ban rule) by simulating every idea against
14+
every point of the grid — WITHOUT re-running a backtest per point.
15+
Authors are graded STRICTLY in isolation — no interaction metrics
16+
(consensus counting, vote weighting) exist here by design; swarm
17+
ranking over long histories is userspace. The root iteration is
18+
over IDEAS, not candles and not grid points:
1719

1820
1. Each idea gets ONE asynchronous forward candle pass from the
19-
minute after its publication, capped by a static horizon
20-
(IDEA_TRIM_DAYS). The pass produces a per-candle trajectory
21-
profile (MFE/MAE extremes, whale shakeout depth, aligned-authors
22-
count). Overlapping and sparse ideas are both supported: candle
23-
chunks are fetched lazily through the Exchange (persist cache
24-
first), gaps between ideas are never requested.
21+
minute after its publication, capped by the grid's longest
22+
hold (max of the holdMinutes axis — the schema defines the
23+
horizon, not an engine constant). The pass produces a
24+
per-candle trajectory
25+
profile (MFE/MAE extremes, whale shakeout depth). Overlapping
26+
and sparse ideas are both supported: candle chunks are fetched
27+
lazily through the Exchange (persist cache first), gaps between
28+
ideas are never requested.
2529
2. The author ban list is TRAINED on the whole range (lookahead
2630
inside train is deliberate): authors with enough ideas and a hit
27-
rate worse than a coin are excluded from triggers and votes.
28-
The list is part of the result — apply it in production as-is.
31+
rate worse than a coin are excluded from entries. The list is
32+
part of the result — apply it in production as-is.
2933
3. The outcome of every grid point is derived arithmetically from
3034
the profiles with production slot semantics (one position per
3135
symbol, busy-slot ideas skipped). Honesty contracts: entry at

docs/classes/MarkdownFileBase.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,20 @@ _baseDir: string
6060

6161
Base directory for all JSONL markdown files
6262

63-
### __@WAIT_FOR_INIT_SYMBOL@5253
63+
### __@WAIT_FOR_INIT_SYMBOL@5257
6464

6565
```ts
66-
__@WAIT_FOR_INIT_SYMBOL@5253: (() => Promise<void>) & ISingleshotClearable<() => Promise<void>>
66+
__@WAIT_FOR_INIT_SYMBOL@5257: (() => Promise<void>) & ISingleshotClearable<() => Promise<void>>
6767
```
6868

6969
Singleshot initialization function that creates directory and stream.
7070
Protected by singleshot to ensure one-time execution.
7171
Sets up error handler that emits to exitEmitter.
7272

73-
### __@WRITE_SAFE_SYMBOL@5254
73+
### __@WRITE_SAFE_SYMBOL@5258
7474

7575
```ts
76-
__@WRITE_SAFE_SYMBOL@5254: (line: string) => Promise<void | unique symbol>
76+
__@WRITE_SAFE_SYMBOL@5258: (line: string) => Promise<symbol | void>
7777
```
7878

7979
Timeout-protected write function with backpressure handling.

docs/classes/PersistBase.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ _directory: string
4343

4444
Computed directory path for entity storage
4545

46-
### __@BASE_WAIT_FOR_INIT_SYMBOL@4384
46+
### __@BASE_WAIT_FOR_INIT_SYMBOL@4388
4747

4848
```ts
49-
__@BASE_WAIT_FOR_INIT_SYMBOL@4384: (() => Promise<void>) & ISingleshotClearable<() => Promise<void>>
49+
__@BASE_WAIT_FOR_INIT_SYMBOL@4388: (() => Promise<void>) & ISingleshotClearable<() => Promise<void>>
5050
```
5151

5252
## Methods

docs/classes/ReportBase.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,20 @@ _stream: WriteStream
5858

5959
WriteStream instance for append-only writes, null until initialized
6060

61-
### __@WAIT_FOR_INIT_SYMBOL@5253
61+
### __@WAIT_FOR_INIT_SYMBOL@5257
6262

6363
```ts
64-
__@WAIT_FOR_INIT_SYMBOL@5253: (() => Promise<void>) & ISingleshotClearable<() => Promise<void>>
64+
__@WAIT_FOR_INIT_SYMBOL@5257: (() => Promise<void>) & ISingleshotClearable<() => Promise<void>>
6565
```
6666

6767
Singleshot initialization function that creates directory and stream.
6868
Protected by singleshot to ensure one-time execution.
6969
Sets up error handler that emits to exitEmitter.
7070

71-
### __@WRITE_SAFE_SYMBOL@5254
71+
### __@WRITE_SAFE_SYMBOL@5258
7272

7373
```ts
74-
__@WRITE_SAFE_SYMBOL@5254: IWrappedQueuedFn<void | unique symbol, [line: string]>
74+
__@WRITE_SAFE_SYMBOL@5258: IWrappedQueuedFn<symbol | void, [line: string]>
7575
```
7676

7777
Timeout-protected write function with backpressure handling.

docs/classes/SimulatorUtils.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,36 @@ Exit axes (always active in trade simulation):
2626
- holdMinutes — slot turnover cap; a busy slot absorbs qualified
2727
ideas (absorbedIdeaIds); time_expired is the worst-case exit.
2828

29-
Entry gates (preprocessing of every candidate entry):
30-
- minIdeasAligned — unique UNBANNED aligned authors in the 4h
31-
window; banned authors are invisible to the count.
32-
- minWeightAligned — sum of Laplace weights (hits+1)/(ideas+2) of
33-
those authors; 0 disables the weighted gate.
29+
Entry gate (preprocessing of every candidate entry): any idea of
30+
an UNBANNED author triggers an entry. Authors are graded strictly
31+
in isolation — interaction metrics (consensus counting, vote
32+
weighting, Wilson bounds) do not exist here by design: swarm
33+
ranking over long histories is userspace.
3434

3535
Ban rule (author filter, trained on the whole run range):
3636
- minAuthorTrack / minAuthorHitRate — default-ban thresholds;
3737
truncated profiles prove nothing; the ban is strictly below the
3838
rate threshold.
39-
- minAuthorWilson — minimum Wilson 95% lower bound of the hit
40-
rate: proven quality that prices the track length in; 0
41-
disables (pair-only baseline), and with the pair pinned inert
42-
(track [0], rate [0]) the bound bans alone.
43-
- authorMetric — hit definition: "close" = 5-day horizon close
44-
(lock/stop do NOT affect ban training), "reach" =
45-
lock-reachability against the point's lock/stop; reach with
46-
lock = 0 falls back to close.
47-
48-
Run-level aggregation (not swept, ignored by test()):
49-
- banCriteria — which ranking winners feed result.allowedAuthors
50-
(union) / bannedAuthors (banned by all); a winner elected by a
51-
non-finite value (Infinity sortino/recovery) grants nothing.
52-
- reportOrder — ranking criterion ordering result.reports
53-
(descending, tie-guarded comparator); default "sharpe". Purely
54-
presentational: never affects winners, callbacks or ban lists.
39+
- authorMetric — hit definition, ALWAYS graded inside the point's
40+
own hold window: "close" = window close (lock/stop do NOT
41+
affect ban training), "reach" = lock-reachability against the
42+
point's lock/stop, "retain" = fixation above the point's lock
43+
(median move strictly above profitLockPercent), "pnl" = fixed
44+
+1% MFE threshold, "trail" = arming reachability of the point's
45+
trailing take; reach and retain require lock &gt; 0, trail
46+
requires trailing in (0, 100) — the inert combinations are
47+
excluded from the grid.
48+
49+
Run-level config (not swept, ignored by test()):
50+
- reportOrder — ranking criterion ordering each metric bucket's
51+
reports (descending, tie-guarded comparator); default "sharpe".
52+
Purely presentational: never affects winners or ban lists.
53+
54+
The result is a per-metric dictionary: every swept authorMetric
55+
gets its own bucket with its own reports, its own four ranking
56+
winners and its own trained ban dictionaries (bans — one entry
57+
per unique rule, threshold arithmetic only). Nothing is ever
58+
aggregated across metrics.
5559

5660
The simulator picks candidates — honest confirmation is a
5761
walk-forward test() shot, and the final arbiter for the chosen
@@ -92,11 +96,9 @@ default list; a single-value list freezes it), then every
9296
point of the cartesian product is evaluated arithmetically
9397
from the same profiles; see ISimulatorGridAxes for each axis'
9498
tune/ignore contract. Ranking winners honor the anti-fluke
95-
floor (a point below MIN_TRADES_FOR_BEST trades can win only
96-
when NO point clears the floor), and the run-level author
97-
lists aggregate ONLY the banCriteria winners with finite
98-
ranking values — an Infinity sortino/recovery winner grants
99-
no allowances.
99+
floor PER metric bucket (a point below MIN_TRADES_FOR_BEST
100+
trades can win only when NO point of its bucket clears the
101+
floor).
100102

101103
### test
102104

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,8 @@ group: docs
531531
- [ISimulatorPointReport](interfaces/ISimulatorPointReport.md)
532532
- [ISimulatorAuthorStat](interfaces/ISimulatorAuthorStat.md)
533533
- [ISimulatorBest](interfaces/ISimulatorBest.md)
534+
- [ISimulatorRuleBans](interfaces/ISimulatorRuleBans.md)
535+
- [ISimulatorMetricReport](interfaces/ISimulatorMetricReport.md)
534536
- [ISimulatorResult](interfaces/ISimulatorResult.md)
535537
- [ISimulatorTestResult](interfaces/ISimulatorTestResult.md)
536538
- [ISimulatorSchema](interfaces/ISimulatorSchema.md)

docs/interfaces/ISimulatorAuthorStat.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,5 @@ banned: boolean
5656

5757
Author is banned under the ban rule these stats were computed
5858
with. True when the track is too short to judge (ideas &lt;
59-
minAuthorTrack) OR the hit rate is below minAuthorHitRate OR the
60-
Wilson lower bound of the hit rate is below minAuthorWilson
61-
(when that bound is enabled). Unproven correctness = banned.
59+
minAuthorTrack) OR the hit rate is below minAuthorHitRate.
60+
Unproven correctness = banned.

docs/interfaces/ISimulatorBest.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ group: docs
88
Winner of one ranking criterion with its trade list and the author
99
artifact under ITS OWN ban rule. Different criteria may elect
1010
points with different ban rules — the whitelist is a property of
11-
the winning point, never a global of the run.
11+
the winning point, never a global of the run or the bucket.
1212

1313
## Properties
1414

@@ -26,7 +26,7 @@ The ranking criterion this winner belongs to.
2626
report: ISimulatorPointReport
2727
```
2828

29-
Winning point report; null when the grid produced no reports.
29+
Winning point report; null when the bucket produced no reports.
3030

3131
### trades
3232

@@ -42,12 +42,11 @@ Trades of the winning point (empty when report is null).
4242
authorStats: ISimulatorAuthorStat[]
4343
```
4444

45-
Per-author track records under THIS winner's rule — the ONLY
46-
source of the author artifact in a run result. Hits are counted
47-
by the rule's metric (authorMetric + the lock/stop levels the
48-
"reach" metric grades against), so even the raw numbers differ
49-
between winners with different rules — a single run-level list
50-
cannot represent them. Empty when report is null.
45+
Per-author track records under THIS winner's rule. Hits are
46+
counted by the rule's metric and levels, so even the raw
47+
numbers differ between winners with different rules. Empty when
48+
report is null. The same dictionary sits in the bucket's bans
49+
entry carrying the same thresholds/levels.
5150

5251
### allowedAuthors
5352

docs/interfaces/ISimulatorCallbacks.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ One grid point evaluated.
6262
onRanking: (symbol: string, criterion: SimulatorRankingCriterion, sorted: ISimulatorPointReport[], best: ISimulatorBest) => void
6363
```
6464

65-
Ranking computed: reports sorted by the criterion (descending)
66-
and the eligible winner (minimum-trades filter applied).
65+
Ranking computed WITHIN one metric bucket: the bucket's reports
66+
sorted by the criterion (descending) and the eligible winner
67+
(minimum-trades floor applied per bucket). Fires once per
68+
(swept metric x criterion).
6769

6870
### onDone
6971

0 commit comments

Comments
 (0)