From a6c978bf958e5af88a8920eb8f722fecd0e7f73b Mon Sep 17 00:00:00 2001 From: gravermistakes Date: Mon, 19 Oct 2026 19:37:17 -0700 Subject: [PATCH] M3c: wire AMM runner into stomach --- core/src/economy/stomach.tcl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/economy/stomach.tcl b/core/src/economy/stomach.tcl index 6ed425c..6e02811 100644 --- a/core/src/economy/stomach.tcl +++ b/core/src/economy/stomach.tcl @@ -7,14 +7,14 @@ set ::stomach::root $__stomach_dir foreach __stomach_file { traders.tcl wallets.tcl sae.tcl conductor.tcl feeds.tcl sims/registry.tcl sims/scheduler.tcl sims/hub.tcl - sims/statistical/runner.tcl marketplace.tcl + sims/statistical/runner.tcl sims/amm/runner.tcl marketplace.tcl } { source [file join $__stomach_dir $__stomach_file] } unset __stomach_file oo::class create ::stomach::Economy { - variable traders wallets sae conductor feeds sims registry clock statistical_runner market taxes + variable traders wallets sae conductor feeds sims registry clock statistical_runner amm_runner market taxes constructor {args} { set cap 256 if {[llength $args] % 2 != 0} { error "options must be key/value pairs" } @@ -34,11 +34,12 @@ oo::class create ::stomach::Economy { set clock [::stomach::HorizonClock new] $clock start set statistical_runner [::stomach::StatisticalRunner new [file join $::stomach::root sims statistical engine.R]] + set amm_runner [::stomach::AMMRunner new] set market [::stomach::Marketplace new $traders $wallets $conductor $sae $sims] set taxes {} } destructor { - foreach obj [list $market $statistical_runner $clock $registry $sims $feeds $conductor $sae $wallets $traders] { + foreach obj [list $market $amm_runner $statistical_runner $clock $registry $sims $feeds $conductor $sae $wallets $traders] { catch {$obj destroy} } } @@ -59,6 +60,12 @@ oo::class create ::stomach::Economy { method feed_history {feed_type} { return [$feeds history $feed_type] } method sim_publish {sim_type prediction} { return [$sims publish $sim_type $prediction] } method statistical_runner_available {} { return [$statistical_runner available] } + method amm_runner_available {} { return [$amm_runner available] } + method amm_from_feed {ticker prediction_type horizon} { + set p [$amm_runner query_history $ticker $prediction_type $horizon [$feeds history price_tick] [$feeds history dex_pool_state]] + $sims publish amm_liquidity $p + return $p + } method statistical_query_type { prices ticker prediction_type horizon {paths 4000} {seed 1} {dt 0.0027397260273972603}