Skip to main content

coinmarketcappy: Python wrapper and scraper for coinmarketcap data

https://img.shields.io/badge/Made%20with-Python-1f425f.svg https://img.shields.io/pypi/v/coinmarketcappy.svg https://img.shields.io/pypi/l/coinmarketcappy.svg https://img.shields.io/pypi/pyversions/coinmarketcappy.svg

Installation

To install coinmarketcappy, simply use pip:

$ pip install coinmarketcappy

or install directly from source to include latest changes:

$ pip install git+https://github.com/saporitigianni/coinmarketcappy.git

or clone and then install:

$ git clone https://github.com/saporitigianni/coinmarketcappy.git
$ cd coinmarketcappy
$ python3 setup.py install

Usage

Every method supports the arguments ‘out_file’ and ‘wformat’ to save the information to a file. If ‘out_file’ is present then the info will be saved to that file. Use absolute path unless you want to save locally. If ‘wformat’ is not specified, it will default to ‘json’ (‘csv’ also supported)

All methods except for available_snaps and historical_snapshots also support the ‘epoch’ parameter. If True it will return all times as epochs, if False it will return them as date and time (e.g. ‘2018-05-01 00:19:31’)

To get Historical Snapshots (taken every Sunday since 20130428) or Global Charts data:

import coinmarketcappy as cmc

# Get all available historical snapshots to choose from
# or visit https://coinmarketcap.com/historical/
dates = cmc.available_snaps()

# Retrieve info for the last 10 snapshots
snaps = cmc.historical_snapshots(dates[-10:])

# Percentage of Market Capitalization (Dominance)
dom = cmc.dominance()

# Total Market Capitalization
cap = cmc.total_market_cap()

# Total Market Capitalization (Excluding Bitcoin)
cap = cmc.total_market_cap(exclude_btc=True)

To get tickers and simple global data:

import coinmarketcappy as cmc

# Get a list of all tickers organized by rank
tickers = cmc.get_tickers()

# Get a specific ticker (by its name not symbol. e.g. bitcoin, ethereum,... not btc, eth)
ticker = cmc.get_ticker(name='bitcoin')

# Get ticker's historical data (also by its name)
temp = cmc.get_ticker_historical(name='bitcoin')

# Get global data in ERU
glob = cmc.get_global_data(convert='eur')

Acknowledgements

This data is being sourced either from the coinmarketcap API or is being scraped from coinmarketcap.com. Its free to use so please respect their rate limit. :octocat:

Contributing

Please read the CONTRIBUTING document before making changes that you would like adopted in the code.

Code of Conduct

Everyone interacting in the coinmarketcappy project’s codebase, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.

Buy me a coffee?

ETH 0xaD1F09626b9B8e701D5f0F4a237193Df73d3C445
BTC 199zsVqCusefv8yjdYQhUQZmLCyh75dqNV
LTC LUBqs7VxC43ttPsQuM1jaZFmshKTAU1Rs9

Metadata

Release files for coinmarketcappy 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coinmarketcappy 1.2.0
File Size Uploaded Provenance Actions
coinmarketcappy-1.2.0.tar.gz 10.2 kB Without provenance Details for coinmarketcappy-1.2.0.tar.gz

Release files / coinmarketcappy-1.2.0.tar.gz

Download URL coinmarketcappy-1.2.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bac5d9e68086fa213b83194901a56faad9f8a69e480cb27d7971f42aefe1295c
BLAKE2b-256 checksum
How to use checksums
6c70e9b6bdeb3fe40ec67ef87f0dd86cc5db4e2bd8eafa0833b63d080fc4ce82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for coinmarketcappy 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page