Introduction
CMC_API is a Python-client for the Coin Market Cap API.
This client provides support for the basic or free tier at the moment. However, it is open for extension to anyone who has access to paid packages.
It provides access to all the available endpoint on the API and produce a result similar to the original API with some minor difference. The most relevant difference is the addition of a list of keys available in each answer, as shown in the bellow example.
{
"metadata": {
"timestamp": "2022-06-04T04:26:55.117Z",
"credit_count": 0,
"error_message": null,
"list_keys": [
"plan",
"usage"
]
},
...
Index
About
The CoinMarketCap API is an API provided by the company with the same name. This API provides cryptocurrency data such as price, volume, market cap, and exchange data.
This project is a wrapper around this API that facilitates its usage for python projects.
Why use the Client:
- It will reduce the coding time since the code for request and parsing of the data is already done, and the user only needs to call a function.
- It provides the option to save the response data to save in credit calls for data that is not updated constantly.
- It provides metadata information in the response. This metadata contains the "cost" per request in credits and a list of the keys in the data part of the response so users can retrieve information with ease.
Usage
- Decided with URL you will use:
BASE:base is the real API and provide the real data.cmc_helper.Urls.BASE.valueSANDBOX: sandbox is for testing, and returns dummy data.cmc_helper.Urls.SANDBOX.value
- Create an Object of class
Cmc(), passing the URL to be usecmc = Cmc(url=cmc_helper.Urls.BASE.value) - use the object of type
Cmc()to call a function.cmc.get_cmc_id_map()
from cmc_api import cmc, cmc_helper
base_url = cmc_helper.Urls.BASE.value
cmc = cmc.Cmc(url=base_url, api_key="YOU_LICENSE_KEY", save_to_json=True)
cmc.get_cmc_id_map(listing_status="active", start=1, limit=1000)
The response will be similar to:
{
"metadata": {
"timestamp": "2022-06-04T13:14:05.108Z",
"credit_count": 1,
"error_message": null,
"list_keys": [
"id",
"name",
"symbol",
"slug",
"rank",
"is_active",
"first_historical_data",
"last_historical_data",
"platform"
]
},
"data": [
{
"id": 1,
"name": "Bitcoin",
"symbol": "BTC",
"slug": "bitcoin",
"rank": 1,
"is_active": 1,
"first_historical_data": "2013-04-28T18:47:21.000Z",
"last_historical_data": "2022-06-04T13:09:00.000Z",
"platform": null
},
...
]
}
Development
Still working in this part but any contribution or suggestion is more than welcome
Pre-Requisites
- python=>3.10
- request
File Structure
This is the structure of this repository not of a project using this python-client.
.
├── coinmarketcapAPI
│ ├── json_files
│ │ ├── API_info.json
│ │ └── ...
│ └── src
│ ├── cmc_api
│ │ ├── cmc.py # definition of the wrapper and function available
│ │ └── cmc_dataHandler.py # Helper to parse the information on the API response
│ │ └── cmc_helper.py # Emuns that hold the endpoinrs URI and args need it
│ │ └── cmc_utils.py # Extra utility functions.
│ └── logs
│ └── *.logs
│ └── ....
├── LICENSE
├── MANIFEST.in
├── pyproject.toml
├── setup.cfg
└── README.md
Community
As mentioned before the contribution guidelines are not done yet, but any report or suggestion will be appreciated
Contribution
Your contributions are always welcome and appreciated. Following are the things you can do to contribute to this project.
- Report a bug
If you think you have encountered a bug, and I should know about it, feel free to report it here, and I will take care of it.
Branches
-
masteris the main development branch. -
mainis the production branch. -
Developmentis the experimental development branch.
Resources
If you want more information about the Coin market cap API you can visit their side coinmarketcapAPI
License
Metadata
Release files for cmc-api-wrapper 0.1.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cmc_api_wrapper-0.1.18.tar.gz | 16.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cmc_api_wrapper-0.1.18-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.2 kB
Release files / cmc_api_wrapper-0.1.18.tar.gz
| Download URL | cmc_api_wrapper-0.1.18.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a45550b0f91bd5bd2d8ac9e7d6e7bbf9f55abc3112a5ec3e3964726aab878691
|
|
BLAKE2b-256 checksum How to use checksums |
566b7db08a5c043dcbb90bebeb72c50d659bcb518e650a354c689f526f4e262f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / cmc_api_wrapper-0.1.18-py3-none-any.whl
| Download URL | cmc_api_wrapper-0.1.18-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76c8650e05d4bf2c17fa6b1bcf873e9acd7ff2789a3483395a89b97c6106ffc0
|
|
BLAKE2b-256 checksum How to use checksums |
5495befa2f3e158a5e5bd65d7b7c86c8e428ca1f99890697035b4e1ce9e37566
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|