feat: simplify Claw402 autopilot trading flow

This commit is contained in:
tinkle-community
2026-06-27 00:37:59 +08:00
parent 961e016d33
commit 24f6421a73
151 changed files with 7453 additions and 41117 deletions

View File

@@ -122,3 +122,62 @@ func TestStrategyConfigNormalizeProductSchemaForLLMLabels(t *testing.T) {
}
}
}
func TestStrategyConfigNormalizeProductSchemaForVergexSignal(t *testing.T) {
cfg := GetDefaultStrategyConfig("zh")
cfg.CoinSource = CoinSourceConfig{
SourceType: "Claw402 Vergex 信号榜",
}
cfg.NormalizeProductSchema()
if cfg.CoinSource.SourceType != "vergex_signal" {
t.Fatalf("source_type = %q, want vergex_signal", cfg.CoinSource.SourceType)
}
if cfg.CoinSource.VergexLimit != 10 {
t.Fatalf("vergex_limit = %d, want 10", cfg.CoinSource.VergexLimit)
}
if cfg.CoinSource.VergexMarketType != "all" {
t.Fatalf("vergex_market_type = %q, want all", cfg.CoinSource.VergexMarketType)
}
if cfg.CoinSource.VergexChain != "hyperliquid" {
t.Fatalf("vergex_chain = %q, want hyperliquid", cfg.CoinSource.VergexChain)
}
}
func TestStrategyConfigNormalizeProductSchemaForVergexSignalLimits(t *testing.T) {
t.Run("dynamic board keeps the one built-in strategy candidate depth", func(t *testing.T) {
cfg := GetDefaultStrategyConfig("zh")
cfg.CoinSource = CoinSourceConfig{
SourceType: "vergex_signal",
VergexLimit: 1,
StaticCoins: nil,
VergexChain: "hyperliquid",
VergexLiqBand: "",
}
cfg.NormalizeProductSchema()
if cfg.CoinSource.VergexLimit != 10 {
t.Fatalf("vergex_limit = %d, want 10", cfg.CoinSource.VergexLimit)
}
})
t.Run("manual picks keep selected count", func(t *testing.T) {
cfg := GetDefaultStrategyConfig("zh")
cfg.CoinSource = CoinSourceConfig{
SourceType: "vergex_signal",
VergexLimit: 1,
StaticCoins: []string{"xyz:nvda", "XYZ:AAPL"},
}
cfg.NormalizeProductSchema()
if cfg.CoinSource.VergexLimit != 2 {
t.Fatalf("vergex_limit = %d, want 2", cfg.CoinSource.VergexLimit)
}
if got := cfg.CoinSource.StaticCoins; len(got) != 2 || got[0] != "XYZ:NVDA" || got[1] != "XYZ:AAPL" {
t.Fatalf("static_coins = %+v, want normalized xyz symbols", got)
}
})
}