feat: Sentinela v0.2.0 — Brazilian Financial Data API in Go
- 20 Go source files, single 16MB binary - SQLite + FTS5 full-text search (pure Go, no CGO) - BCB integration: Selic, CDI, IPCA, USD/BRL, EUR/BRL - CVM integration: 2,524 companies from registry - Fiber v2 REST API with 42 handlers - Auto-seeds on first run (~5s for BCB + CVM) - Token bucket rate limiter, optional API key auth - Periodic sync scheduler (configurable) - Graceful shutdown, structured logging (slog) - All endpoints tested with real data
This commit is contained in:
58
README.md
Normal file
58
README.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Sentinela 🇧🇷
|
||||
|
||||
Brazilian Financial Data API — serves market data from BCB and CVM public sources.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Build and run (seeds data automatically on first run)
|
||||
make run
|
||||
|
||||
# Or directly
|
||||
go run ./cmd/sentinela
|
||||
```
|
||||
|
||||
The API starts on `http://localhost:3333`. On first run, it automatically fetches:
|
||||
- **BCB**: Selic, CDI, IPCA, USD/BRL, EUR/BRL (last ~3 years)
|
||||
- **CVM**: Company registry + IPE filings (current + previous year)
|
||||
|
||||
## Endpoints
|
||||
|
||||
| Endpoint | Description |
|
||||
|---|---|
|
||||
| `GET /health` | Health check |
|
||||
| `GET /api/v1/companies` | List companies |
|
||||
| `GET /api/v1/companies/search?q=petrobras` | Search companies |
|
||||
| `GET /api/v1/companies/:id` | Get company |
|
||||
| `GET /api/v1/companies/:id/filings` | Company filings |
|
||||
| `GET /api/v1/filings` | List filings |
|
||||
| `GET /api/v1/filings/recent` | Recent filings |
|
||||
| `GET /api/v1/filings/search?q=dividendo` | Search filings |
|
||||
| `GET /api/v1/market/selic` | Selic history |
|
||||
| `GET /api/v1/market/selic/current` | Current Selic |
|
||||
| `GET /api/v1/market/cdi` | CDI history |
|
||||
| `GET /api/v1/market/cdi/current` | Current CDI |
|
||||
| `GET /api/v1/market/ipca` | IPCA history |
|
||||
| `GET /api/v1/market/ipca/current` | Current IPCA |
|
||||
| `GET /api/v1/market/fx` | FX rates |
|
||||
| `GET /api/v1/market/fx/current` | Current FX |
|
||||
| `GET /api/v1/market/overview` | Market dashboard |
|
||||
| `GET /api/v1/search?q=vale` | Global search |
|
||||
|
||||
## Configuration
|
||||
|
||||
Set via environment variables (see `.env.example`):
|
||||
|
||||
- `PORT` — HTTP port (default: 3333)
|
||||
- `DATABASE_PATH` — SQLite path (default: data/sentinela.db)
|
||||
- `RATE_LIMIT` — Requests per minute per IP (default: 100)
|
||||
- `API_KEY` — Optional API key (if set, all requests need it via `X-API-Key` header)
|
||||
- `SYNC_INTERVAL` — Auto-refresh interval (default: 30m)
|
||||
- `LOG_LEVEL` — info or debug
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- Go 1.22+
|
||||
- Fiber v2 (HTTP)
|
||||
- SQLite via modernc.org/sqlite (pure Go, no CGO)
|
||||
- FTS5 full-text search
|
||||
Reference in New Issue
Block a user