- Used Goa (https://github.com/goadesign/goa) to generate design-based service, see:
design/design.go
- Took some extra time on this as I've been wanting to learn Goa
- See
gen/http/openapi*
for autogenerated specs
- Basic Messari API client with two endpoints, see:
messari/client.go
https://data.messari.io/api/v2/assets
used for aggregate cachinghttps://data.messari.io/api/v1/assets/{slug}/metrics
used for individual metric lookup
- Implemented Metrics Service API, see:
endpoints.go
/aggregate
for aggregate asset metrics/asset/{slug}
for individual asset metrics
- Implemented an AssetCache for reduced aggregate request times, see:
asset_cache.go
- I would move this to a Redis-backed cache in a real world scenario
- Wrote some tests, but would write a lot more in the real world
- Check out project:
git clone git@github.com:jordanfowler/messari-metrics.git
- From project root:
go mod download
- Export your Messari API Key:
export MESSARI_API_KEY=...
- From project root:
go run .
- Single asset metrics endpoint:
localhost:8000/asset/{slug}
- Example:
curl localhost:8000/asset/btc
- Example:
- Aggregate asset metrics (query params optional):
curl localhost:8000/aggregate[?tags=...|sector=...]
- Mkt Cap >= 100M:
curl localhost:8000/aggregate
- Tag example:
curl localhost:8000/aggregate?tag=NFT
- Sector example:
curl localhost:8000/aggregate?sector=Scaling
- Mkt Cap >= 100M:
- Aggregate endpoint will take a few seconds to have a fully warmed cache
- Until removing Messari API rate limiting, aggregate endpoint may encounter errors with sub-requests