mirror of
https://github.com/SHOGGOTH-SECTOR/sica-fondt.git
synced 2026-11-29 08:25:10 +00:00
M3c: wire AMM runner into stomach
This commit is contained in:
@@ -7,14 +7,14 @@ set ::stomach::root $__stomach_dir
|
|||||||
foreach __stomach_file {
|
foreach __stomach_file {
|
||||||
traders.tcl wallets.tcl sae.tcl conductor.tcl feeds.tcl
|
traders.tcl wallets.tcl sae.tcl conductor.tcl feeds.tcl
|
||||||
sims/registry.tcl sims/scheduler.tcl sims/hub.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]
|
source [file join $__stomach_dir $__stomach_file]
|
||||||
}
|
}
|
||||||
unset __stomach_file
|
unset __stomach_file
|
||||||
|
|
||||||
oo::class create ::stomach::Economy {
|
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} {
|
constructor {args} {
|
||||||
set cap 256
|
set cap 256
|
||||||
if {[llength $args] % 2 != 0} { error "options must be key/value pairs" }
|
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]
|
set clock [::stomach::HorizonClock new]
|
||||||
$clock start
|
$clock start
|
||||||
set statistical_runner [::stomach::StatisticalRunner new [file join $::stomach::root sims statistical engine.R]]
|
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 market [::stomach::Marketplace new $traders $wallets $conductor $sae $sims]
|
||||||
set taxes {}
|
set taxes {}
|
||||||
}
|
}
|
||||||
destructor {
|
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}
|
catch {$obj destroy}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,6 +60,12 @@ oo::class create ::stomach::Economy {
|
|||||||
method feed_history {feed_type} { return [$feeds history $feed_type] }
|
method feed_history {feed_type} { return [$feeds history $feed_type] }
|
||||||
method sim_publish {sim_type prediction} { return [$sims publish $sim_type $prediction] }
|
method sim_publish {sim_type prediction} { return [$sims publish $sim_type $prediction] }
|
||||||
method statistical_runner_available {} { return [$statistical_runner available] }
|
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 {
|
method statistical_query_type {
|
||||||
prices ticker prediction_type horizon
|
prices ticker prediction_type horizon
|
||||||
{paths 4000} {seed 1} {dt 0.0027397260273972603}
|
{paths 4000} {seed 1} {dt 0.0027397260273972603}
|
||||||
|
|||||||
Reference in New Issue
Block a user