In this test the candidate is expected to be able to develop an API using Python as programming language, communicate with a database and use cache to increase the performance of this application. Also, be able to consume a third party API using standard authentication methods. And finally, to automatically generate the respective documentation following the OpenAPI standard specification.
Develop an API in which you can query the value of the current Bitcoin (or any other cryptocurrency) and store this result in a local database and at the same time in cache for later use. Also, this endpoint must be able to convert from the price of the selected currency(ies) to another, this result will not be cached.
-
It must include an endpoint that allows to obtain the metadata of a cryptocurrency at the moment of making the request, and that optionally converts them to any other currency; that includes the following parameters:
-
name type description required symbolstringAlternatively pass one or more comma-separated cryptocurrency symbols. Example: "BTC,ETH". TrueconvertstringOptionally calculate market quotes for the given currency, by passing a cryptocurrency or fiat currency symbol. Example: "USD" False
-
-
It should generate OpenAPI documentation automatically and expose an endpoint for viewing.
-
You should write unit tests that cover as many cases as possible.
-
If your API does not have the information of a cryptocurrency, it must:
-
Query third party API (CoinMarketCap).
-
Save the result in a local database.
-
Cache the result (with an expiration of 60 seconds).
-
Return the result.
-
-
If your API already has the information, it should:
-
Query the cache first and return that value, if found.
-
Otherwise, query the database and return that value, if found. At this step, the result must be cached again for another 60 seconds.
-
Otherwise, perform the steps from rule #1.
-
-
drf-spectacular, for automatic OpenAPI schema generation.
