A Go microservice that fetches the USDT exchange rate (ask/bid) from the Grinex exchange and exposes it via gRPC.
Exchange data is stored in PostgreSQL on every request.
- gRPC endpoint
GetRates
for retrieving USDT ask/bid prices - Data fetched from Grinex API
- PostgreSQL integration
- Healthcheck endpoint
- Graceful shutdown
- Configurable via
.yaml
config and environment variables - Dockerized with Docker Compose
- Linting and unit testing support
git clone https://github.com/Webblurt/garantex-usdt-rates.git
cd garantex-usdt-rates
cat <<EOF > .env
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=rates
EOF
make build
docker-compose up --build
The app will be available on localhost:50051
(gRPC port).
make test
Configuration is managed via a YAML file and environment variables.
server:
port: "50051"
postgres:
dsn: "host=postgres port=5432 user=postgres password=postgres dbname=rates sslmode=disable"
grinex:
url: "https://grinex.io/api/v2/depth"
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=rates
You can override values in the config file using environment variables or command-line flags (if implemented).
make build
- Build the Go app
make run
- Run the app locally
make test
- Run unit tests
make lint
- Run code linter (golangci-lint
)
make docker-build
- Build Docker image
A gRPC health check endpoint is available (standard grpc-health-probe compatible).
- Go 1.22+
- Docker & Docker Compose
golangci-lint
(formake lint
)
go run ./cmd/app
Ensure PostgreSQL is running locally and credentials match config/config.yaml
.
Returns current USDT ask and bid prices with timestamp.
rpc GetRates (google.protobuf.Empty) returns (RateResponse);