cryptoCMD

guptarohitBSD-3-Clause活跃维护

用 Python 抓取 CoinMarketCap 的历史价格数据,方便做量化回测或行情分析时直接拿到干净的加密货币历史行情。

Cryptocurrency historical price data library in Python. Data from https://coinmarketcap.com.

v0.6.5发布于 2026-04-26 00:58 UTC612star118fork同步于 2026-11-07 07:34 UTC

怎么上手

由 README 提炼,执行前请确认
pip install cryptocmd
硬件要求按 README 说明

README 未说明,纯 Python 抓取库,无 GPU 或显存要求

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

从 CoinMarketCap 抓取加密货币历史行情数据的 Python 库,省去自己写爬虫

用 Python 抓取 CoinMarketCap 的历史价格数据,方便做量化回测或行情分析时直接拿到干净的加密货币历史行情。

核心能力

  • 按币种代码抓取全时段历史行情
  • 支持指定起止日期区间取数
  • 输出 list、JSON、CSV 和 Pandas DataFrame
  • 币种代码重名时可用 coin_name 指定
  • 导出 CSV 时可自定义文件名

容易踩的坑

数据实时从 coinmarketcap.com 抓取,需要联网且依赖对方页面结构;日期参数格式为 DD-MM-YYYY,容易写成 YYYY-MM-DD;README 未说明速率限制,批量抓取时注意请求频率

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.6.5
  1. v0.6.5最新正式版2026-04-26 · 2026-04-26 00:58 UTC

    Fixed

    Changed

  2. v0.6.40.6.42023-10-15 · 2023-10-15 16:08 UTC
    查看更新说明

    Added

    • In addition to Date, Open, High, Low, Close, Volume, Market Cap, the following time columns are returned: Time Open, Time High, Time Low, Time Close.
  3. v0.6.30.6.32023-07-22 · 2023-07-22 16:43 UTC
    查看更新说明

    Added

    • option id_number for getting data of a coin (useful for case when coin have conflicting coin code) #51
  4. v0.6.20.6.22023-07-15 · 2023-07-15 10:31 UTC
    查看更新说明

    Added

    • option coin_name for getting data of coin which have conflicting coin code #62
  5. v0.6.10.6.12022-02-19 · 2022-02-19 21:56 UTC
    查看更新说明

    Added

    • option to download price data in other fiat currencies #43

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    cryptoCMD: cryptoCurrency Market Data

    PyPI Version CI Status License Downloads Ruff GitHub Sponsors

    Cryptocurrency historical market price data scraper written in Python.

    Installation

    pip install cryptocmd
    

    to install from the latest source use following command

    pip install git+git://github.com/guptarohit/cryptoCMD.git
    

    Usage

    CoinMarketCap Scraper

    Following methods are available to get data in multiple formats from https://coinmarketcap.com

    To get all time historical data of a cryptocurrency
    from cryptocmd import CmcScraper
    
    # initialise scraper without time interval
    scraper = CmcScraper("XRP")
    
    # get raw data as list of list
    headers, data = scraper.get_data()
    
    # get data in a json format
    xrp_json_data = scraper.get_data("json")
    
    # export the data as csv file, you can also pass optional `name` parameter
    scraper.export("csv", name="xrp_all_time")
    
    # Pandas dataFrame for the same data
    df = scraper.get_dataframe()
    
    To get data of a cryptocurrency which have same coin code as others
    from cryptocmd import CmcScraper
    
    # initialise scraper with coin name as well
    scraper = CmcScraper(coin_code="sol", coin_name="solana")
    
    # get raw data as list of list
    headers, data = scraper.get_data()
    
    # get data in a json format
    solana_json_data = scraper.get_data("json")
    
    # export the data as csv file, you can also pass optional `name` parameter
    scraper.export("csv", name="solana_all_time")
    
    # Pandas dataFrame for the same data
    df = scraper.get_dataframe()
    
    To get data of a cryptocurrency for some days
    from cryptocmd import CmcScraper
    
    # initialise scraper with time interval
    scraper = CmcScraper("XRP", "15-10-2017", "25-10-2017")
    
    # get raw data as list of list
    headers, data = scraper.get_data()
    
    # get data in a json format
    json_data = scraper.get_data("json")
    
    # export the data to csv
    scraper.export("csv")
    
    # get dataframe for the data
    df = scraper.get_dataframe()
    
    Following are the columns of the data

    Date, Open, High, Low, Close, Volume, Market Cap, Time Open, Time High, Time Low, Time Close

    Acknowledgements

    The data is being scrapped from coinmarketcap :v: and it's free to use. :tada:

    Contributing

    Feel free to make a pull request! :octocat:

    If you found this useful, I'd appreciate your consideration in the below. ✨☕

    Buy Me A Coffee