- collector.symbols 与 supportedSymbols 加 SOL/BNB/DOGE,env-default 与 README 同步 - entity 追加 TechnicalStructure.Intervals(每周期 Bollinger + Vegas,omitempty 不破坏既有字段)与 DerivativesBundle.Signal - 新增纯解析 usecase derivatives_signal.go:fundingBias 绝对阈值、oiSignal 用 P20 baseline + 价格方向(OI up + 价格 up/down → long/short_building,funding 不参与方向)、lsrRegime 绝对阈值;signal 数据不足走 warnings 进 DataQuality - indicator.go 加 sma/stddev/ema/bollinger/vegas + computeIntervalTechnicals;IndicatorComputer 签名收 klines map - harness 同步:G12 扩入 derivatives_signal.go(含 Makefile G12.5/6 + ADR-0002 适用范围 + project-map / harness-health 更新)
63 lines
1.9 KiB
Go
63 lines
1.9 KiB
Go
package config
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/ilyakaznacheev/cleanenv"
|
|
)
|
|
|
|
type Config struct {
|
|
App App `yaml:"app"`
|
|
HTTP HTTP `yaml:"http"`
|
|
Binance Binance `yaml:"binance"`
|
|
Postgres Postgres `yaml:"postgres"`
|
|
Collector Collector `yaml:"collector"`
|
|
}
|
|
|
|
type App struct {
|
|
Name string `yaml:"name" env:"APP_NAME" env-default:"crypto-hermes-gateway"`
|
|
Env string `yaml:"env" env:"APP_ENV" env-default:"local"`
|
|
Port int `yaml:"port" env:"APP_PORT" env-default:"8080"`
|
|
}
|
|
|
|
type HTTP struct {
|
|
ReadTimeout time.Duration `yaml:"read_timeout" env-default:"5s"`
|
|
WriteTimeout time.Duration `yaml:"write_timeout" env-default:"10s"`
|
|
IdleTimeout time.Duration `yaml:"idle_timeout" env-default:"60s"`
|
|
}
|
|
|
|
type Binance struct {
|
|
BaseURL string `yaml:"base_url" env:"BINANCE_BASE_URL" env-default:"https://fapi.binance.com"`
|
|
Timeout time.Duration `yaml:"timeout" env-default:"10s"`
|
|
RetryCount int `yaml:"retry_count" env-default:"2"`
|
|
RPS float64 `yaml:"rps" env-default:"20"`
|
|
Burst int `yaml:"burst" env-default:"40"`
|
|
}
|
|
|
|
type Postgres struct {
|
|
DSN string `yaml:"dsn" env:"POSTGRES_DSN" env-required:"true"`
|
|
MaxConns int32 `yaml:"max_conns" env-default:"10"`
|
|
MinConns int32 `yaml:"min_conns" env-default:"2"`
|
|
}
|
|
|
|
type Collector struct {
|
|
Enabled bool `yaml:"enabled" env-default:"true"`
|
|
Symbols []string `yaml:"symbols" env-default:"BTCUSDT,ETHUSDT,SOLUSDT,BNBUSDT,DOGEUSDT"`
|
|
Intervals []string `yaml:"intervals" env-default:"15m,1h,4h,1d,1w"`
|
|
DefaultLimit int `yaml:"default_limit" env-default:"500"`
|
|
}
|
|
|
|
func Load(path string) (*Config, error) {
|
|
var cfg Config
|
|
if path != "" {
|
|
if err := cleanenv.ReadConfig(path, &cfg); err != nil {
|
|
return nil, err
|
|
}
|
|
} else {
|
|
if err := cleanenv.ReadEnv(&cfg); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return &cfg, nil
|
|
}
|