Merge pull request 'fix: feat: LLM seed — Momentum Follower optimizer (#674)' (#695) from fix/issue-674 into master

This commit is contained in:
johba 2026-03-13 19:39:50 +01:00
commit 382b7ec9b3
3 changed files with 75 additions and 0 deletions

View file

@ -20,3 +20,4 @@
- [2026-03-12] Three-position strategy: Floor, Anchor, Discovery
- [2026-03-12] VWAPTracker for price oracle
- [2026-03-12] Harberger tax staking mechanism
- [2026-03-13] LLM seed — Momentum Follower optimizer (#695)

View file

@ -0,0 +1,73 @@
;; llm_momentum.push3 — Momentum Follower Optimizer
;;
;; Strategy: "follow the crowd, but keep a safety net."
;;
;; Philosophy:
;; High staking % → bull: wide discovery, high anchor share
;; Low staking % → bear: floor-heavy, narrow anchor, minimal discovery
;;
;; Uses smooth transitions (no hard if/else): percentageStaked directly
;; scales all output parameters via multiplication.
;;
;; Floor always gets at least 20% of ETH (safety net):
;; anchorShare is capped at 0.8e18 (= percentageStaked * 0.8).
;;
;; AnchorWidth is proportional to tax rate spread:
;; high tax rate → volatile market → wider anchor bands.
;;
;; Inputs on DYADIC stack (slot 0 on top, slot 7 at bottom):
;; [0] percentageStaked (0..1e18, where 1e18 = 100%)
;; [1] averageTaxRate (0..1e18)
;; [2-7] unused (normalized indicators, future use)
;;
;; Outputs (DYADIC stack at termination, bottom to top):
;; discoveryDepth = percentageStaked (0..1e18, direct scaling)
;; anchorWidth = 20 + taxRate * 80 / 1e18 (20..100 ticks)
;; anchorShare = percentageStaked * 0.8 (0..0.8e18, safety net)
;; ci = 0
;;
;; At 0% staked: DD=0, AW=20, AS=0, CI=0 (full floor, minimal discovery)
;; At 50% staked: DD=0.5e18, AW=*, AS=0.4e18, CI=0
;; At 100% staked: DD=1e18, AW=100, AS=0.8e18, CI=0 (anchor-heavy, full discovery)
(
;; Step 1: Bind slot 0 (percentageStaked) and slot 1 (averageTaxRate).
PERCENTAGESTAKED DYADIC.DEFINE
;; Stack: [slot7, slot6, slot5, slot4, slot3, slot2, slot1]
TAXRATE DYADIC.DEFINE
;; Stack: [slot7, slot6, slot5, slot4, slot3, slot2]
;; Step 2: Discard unused inputs (slots 2-7) — 6 pops.
DYADIC.POP
DYADIC.POP
DYADIC.POP
DYADIC.POP
DYADIC.POP
DYADIC.POP
;; Stack: []
;; Step 3: Push discoveryDepth = percentageStaked (0..1e18)
;; Momentum: high staking → full discovery; low staking → no discovery.
PERCENTAGESTAKED
;; Stack: [discoveryDepth]
;; Step 4: Push anchorWidth = 20 + averageTaxRate * 80 / 1e18 (ticks: 20..100)
;; High tax spread → volatile market → wider anchor bands (bear-like).
;; Low tax spread → stable market → narrow anchor bands (bull-like).
TAXRATE
80 DYADIC.*
1000000000000000000 DYADIC./
20 DYADIC.+
;; Stack: [discoveryDepth, anchorWidth]
;; Step 5: Push anchorShare = percentageStaked * 800000000000000000 / 1e18 (0..0.8e18)
;; Safety net: tops out at 80%, so floor always receives >=20% of ETH.
PERCENTAGESTAKED
800000000000000000 DYADIC.*
1000000000000000000 DYADIC./
;; Stack: [discoveryDepth, anchorWidth, anchorShare]
;; Step 6: Push ci = 0 (capital inefficiency — optimizer output, fixed at 0).
0
;; Stack: [discoveryDepth, anchorWidth, anchorShare, ci=0]
)

View file

@ -1,2 +1,3 @@
{"file":"optimizer_v3.push3","fitness":8259844243839650390792,"origin":"hand-written","run":null,"generation":null,"date":"2026-03-10","note":"Original seed optimizer"}
{"file":"evo_run004_champion.push3","fitness":2307549972110081697617459,"origin":"evolved","run":"004","generation":3,"date":"2026-03-13","note":"First evolution champion. Fitness inflated by token value (#670). Always-bull strategy."}
{"file":"llm_momentum.push3","fitness":null,"origin":"llm","run":null,"generation":null,"date":"2026-03-13","note":"Momentum Follower: smooth sentiment-tracking via direct percentageStaked multiplication. Safety net: floor always >=20%. AnchorWidth scales with tax volatility."}