feat: 接入 CoinGlass 清算热力图隔离链路
Some checks failed
ci / build + vet + guard + race (push) Has been cancelled

This commit is contained in:
dela
2026-05-25 16:57:22 +08:00
parent e5fb54cb72
commit 1b61541ff5
32 changed files with 2550 additions and 70 deletions

View File

@@ -10,6 +10,7 @@ type Config struct {
App App `yaml:"app"`
HTTP HTTP `yaml:"http"`
Binance Binance `yaml:"binance"`
Coinglass Coinglass `yaml:"coinglass"`
Postgres Postgres `yaml:"postgres"`
Collector Collector `yaml:"collector"`
}
@@ -34,6 +35,22 @@ type Binance struct {
Burst int `yaml:"burst" env-default:"40"`
}
type Coinglass struct {
Enabled bool `yaml:"enabled" env:"COINGLASS_ENABLED" env-default:"false"`
BaseURL string `yaml:"base_url" env:"COINGLASS_BASE_URL" env-default:"https://capi.coinglass.com"`
TOTPSecret string `yaml:"totp_secret" env:"COINGLASS_TOTP_SECRET"`
DataAESKey string `yaml:"data_aes_key" env:"COINGLASS_DATA_AES_KEY" env-default:"1f68efd73f8d4921acc0dead41dd39bc"`
Timeout time.Duration `yaml:"timeout" env:"COINGLASS_TIMEOUT" env-default:"15s"`
FakeSuccessRetry int `yaml:"fake_success_retry" env:"COINGLASS_FAKE_SUCCESS_RETRY" env-default:"1"`
FakeSuccessRetryWait time.Duration `yaml:"fake_success_retry_wait" env:"COINGLASS_FAKE_SUCCESS_RETRY_WAIT" env-default:"2s"`
LiqHeatMapCron string `yaml:"liq_heatmap_cron" env:"COINGLASS_LIQ_HEATMAP_CRON" env-default:"*/5 * * * *"`
LiqHeatMapInterval string `yaml:"liq_heatmap_interval" env:"COINGLASS_LIQ_HEATMAP_INTERVAL" env-default:"5"`
LiqHeatMapLimit int `yaml:"liq_heatmap_limit" env:"COINGLASS_LIQ_HEATMAP_LIMIT" env-default:"288"`
StartupJitterMax time.Duration `yaml:"startup_jitter_max" env:"COINGLASS_STARTUP_JITTER_MAX" env-default:"30s"`
BackoffInitial time.Duration `yaml:"backoff_initial" env:"COINGLASS_BACKOFF_INITIAL" env-default:"30s"`
BackoffMax time.Duration `yaml:"backoff_max" env:"COINGLASS_BACKOFF_MAX" env-default:"10m"`
}
type Postgres struct {
DSN string `yaml:"dsn" env:"POSTGRES_DSN" env-required:"true"`
MaxConns int32 `yaml:"max_conns" env-default:"10"`

View File

@@ -15,6 +15,21 @@ binance:
rps: 20
burst: 40
coinglass:
enabled: false
base_url: https://capi.coinglass.com
totp_secret: ""
data_aes_key: 1f68efd73f8d4921acc0dead41dd39bc
timeout: 15s
fake_success_retry: 1
fake_success_retry_wait: 2s
liq_heatmap_cron: "*/5 * * * *"
liq_heatmap_interval: "5"
liq_heatmap_limit: 288
startup_jitter_max: 30s
backoff_initial: 30s
backoff_max: 10m
postgres:
dsn: postgres://postgres:postgres@localhost:5432/hermes_market?sslmode=disable
max_conns: 10