diff --git a/api/fx/ingestor/.air.toml b/api/fx/ingestor/.air.toml index f78a7e96..16f8c34b 100644 --- a/api/fx/ingestor/.air.toml +++ b/api/fx/ingestor/.air.toml @@ -1,32 +1,46 @@ -# Config file for Air in TOML format - -root = "./../.." +root = "." +testdata_dir = "testdata" tmp_dir = "tmp" [build] -cmd = "go build -o app -ldflags \"-X 'github.com/tech/sendico/fx/ingestor/internal/appversion.BuildUser=$(whoami)' -X 'github.com/tech/sendico/fx/ingestor/internal/appversion.Version=$APP_V' -X 'github.com/tech/sendico/fx/ingestor/internal/appversion.Branch=$BUILD_BRANCH' -X 'github.com/tech/sendico/fx/ingestor/internal/appversion.Revision=$GIT_REV' -X 'github.com/tech/sendico/fx/ingestor/internal/appversion.BuildDate=$(date)'\"" -bin = "./app" -full_bin = "./app --debug --config.file=config.yml" -include_ext = ["go", "yaml", "yml"] -exclude_dir = ["fx/ingestor/tmp", "pkg/.git", "fx/ingestor/env"] -exclude_regex = ["_test\\.go"] -exclude_unchanged = true -follow_symlink = true -log = "air.log" -delay = 0 -stop_on_error = true -send_interrupt = true -kill_delay = 500 -args_bin = [] - -[log] -time = false + args_bin = [] + entrypoint = "./tmp/main" + cmd = "go build -o ./tmp/main ." + delay = 1000 + exclude_dir = ["assets", "tmp", "vendor", "testdata"] + exclude_file = [] + exclude_regex = ["_test.go", "_templ.go"] + exclude_unchanged = false + follow_symlink = false + full_bin = "" + include_dir = [] + include_ext = ["go", "tpl", "tmpl", "html"] + include_file = [] + kill_delay = "0s" + log = "build-errors.log" + poll = false + poll_interval = 0 + post_cmd = [] + pre_cmd = [] + rerun = false + rerun_delay = 500 + send_interrupt = false + stop_on_error = false [color] -main = "magenta" -watcher = "cyan" -build = "yellow" -runner = "green" + app = "" + build = "yellow" + main = "magenta" + runner = "green" + watcher = "cyan" + +[log] + main_only = false + time = false [misc] -clean_on_exit = true + clean_on_exit = false + +[screen] + clear_on_rebuild = false + keep_scroll = true diff --git a/api/fx/ingestor/.gitignore b/api/fx/ingestor/.gitignore index 1abe8f4b..4f356934 100644 --- a/api/fx/ingestor/.gitignore +++ b/api/fx/ingestor/.gitignore @@ -1,3 +1,4 @@ internal/generated .gocache /app +tmp \ No newline at end of file diff --git a/api/fx/ingestor/config.dev.yml b/api/fx/ingestor/config.dev.yml new file mode 100644 index 00000000..245076bb --- /dev/null +++ b/api/fx/ingestor/config.dev.yml @@ -0,0 +1,74 @@ +poll_interval_seconds: 30 + +market: + sources: + - driver: BINANCE + settings: + base_url: "https://api.binance.com" + - driver: COINGECKO + settings: + base_url: "https://api.coingecko.com/api/v3" + - driver: CBR + settings: + base_url: "https://www.cbr.ru" + user_agent: "Mozilla/5.0 (compatible; SendicoFX/1.0; +https://app.sendico.io)" + accept_header: "application/xml,text/xml;q=0.9,*/*;q=0.8" + pairs: + BINANCE: + - base: "USDT" + quote: "EUR" + symbol: "EURUSDT" + invert: true + - base: "USD" + quote: "USDT" + symbol: "USDTUSD" + invert: true + - base: "UAH" + quote: "USDT" + symbol: "USDTUAH" + invert: true + - base: "USDC" + quote: "EUR" + symbol: "EURUSDC" + invert: true + COINGECKO: + - base: "USDT" + quote: "RUB" + symbol: "tether:rub" + CBR: + - base: "USD" + quote: "RUB" + symbol: "USD" + provider: "cbr" + - base: "EUR" + quote: "RUB" + symbol: "EUR" + provider: "cbr" + +metrics: + enabled: true + address: ":9102" + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: FX Ingestor + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +database: + driver: mongodb + settings: + host_env: FX_MONGO_HOST + port_env: FX_MONGO_PORT + database_env: FX_MONGO_DATABASE + user_env: FX_MONGO_USER + password_env: FX_MONGO_PASSWORD + auth_source_env: FX_MONGO_AUTH_SOURCE + replica_set_env: FX_MONGO_REPLICA_SET diff --git a/api/fx/ingestor/go.mod b/api/fx/ingestor/go.mod index 3eb03dba..3b29466a 100644 --- a/api/fx/ingestor/go.mod +++ b/api/fx/ingestor/go.mod @@ -1,6 +1,6 @@ module github.com/tech/sendico/fx/ingestor -go 1.25.3 +go 1.25.6 replace github.com/tech/sendico/pkg => ../../pkg @@ -49,7 +49,7 @@ require ( golang.org/x/sync v0.19.0 // indirect golang.org/x/sys v0.40.0 // indirect golang.org/x/text v0.33.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260122232226-8e98ce8d340d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect google.golang.org/grpc v1.78.0 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/api/fx/ingestor/go.sum b/api/fx/ingestor/go.sum index dacbccd6..9a1c4e0f 100644 --- a/api/fx/ingestor/go.sum +++ b/api/fx/ingestor/go.sum @@ -212,8 +212,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260122232226-8e98ce8d340d h1:xXzuihhT3gL/ntduUZwHECzAn57E8dA6l8SOtYWdD8Q= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260122232226-8e98ce8d340d/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc= google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= diff --git a/api/fx/ingestor/internal/ingestor/service.go b/api/fx/ingestor/internal/ingestor/service.go index 7ebc7ddb..8adfff9b 100644 --- a/api/fx/ingestor/internal/ingestor/service.go +++ b/api/fx/ingestor/internal/ingestor/service.go @@ -113,7 +113,7 @@ func (s *Service) pollOnce(ctx context.Context) error { if failures > 0 { s.logger.Warn("Ingestion poll completed with failures", zap.Int("failures", failures), zap.Int("total", len(s.pairs))) } else { - s.logger.Info("Ingestion poll completed", zap.Int("total", len(s.pairs))) + s.logger.Debug("Ingestion poll completed", zap.Int("total", len(s.pairs))) } return firstErr }