Poetry is used for virtual environments / dependency management. Install it here: https://python-poetry.org/docs/
poetry install
poetry shell
cp .env.example .env
Modify any variables you may need there
python manage.py runserver <port_number>
pre-commit install
GET /coinList/
: Gets a list of coins
curl --location --request GET 'http://127.0.0.1:8000/coinList'
[
{
"id": "01coin",
"name": "01coin",
"symbol": "zoc"
}
]
GET /marketCap/
: Params:coin_id, date (YYYY/MM/DD), currency
curl --location --request GET 'http://127.0.0.1:8000/marketCap?coin_id=ripple&date=2020/08/05¤cy=gbp'
{
"gbp": 10294177055.519627
}
JSON responses are cached per view for one hour, to minimize load on CoinGecko.
/marketCap
views are cached according to combination of query parameters to ensure maximum accuracy
and cache hit rate.
The CoinGecko client uses Sessions to reuse TCP connections, reducing load on CoinGecko
- HTTPS (including forced redirect if not in debug mode)
- Input validation of GET parameters
- Validation of upstream data (CoinGecko) using pydantic models
- 3 retries to CoinGecko with a backoff of 0.2
- Cached in memory so no need for an external cache (Redis)
- No database requirements