Skip to main content

PyPI - Version PyPI - Python Version PyPI - Downloads codecov

btcpriceticker

Overview

btcpriceticker is a lightweight toolkit for fetching current and historical Bitcoin pricing data from multiple services. It powers both a handy CLI and a Python API that can return spot prices, time series, and OHLC or OHLCV candles for BTC against your preferred fiat currency.

Features

  • Unified interface over CoinGecko, CoinPaprika, Kraken, and mempool.space data sources
  • Optional time series tracking with resampling utilities
  • OHLC and OHLCV aggregation backed by pandas DataFrames
  • Typer-based CLI for quick terminal access to prices, history, and candles

Installation

pip install btcpriceticker

To work on the project locally:

git clone https://github.com/holgern/btcpriceticker
cd btcpriceticker
pip install -e .[test]
pip install -r requirements-test.txt  # optional extras used in this repo

CLI Usage

Use the Typer-powered CLI after installation:

btcpriceticker price eur            # Show spot price in EUR
btcpriceticker history usd 1h       # Print recent hourly prices
btcpriceticker ohlc usd 1h          # Display OHLC candles
btcpriceticker ohlcv usd 1h         # Display OHLCV candles (requires services that support volume)

Flags such as --service and --verbose allow switching providers and log verbosity, e.g. btcpriceticker --service kraken price usd.

Python API

from btcpriceticker.price import Price

price = Price(service="kraken", fiat="usd", enable_ohlcv=True)
price.refresh()

spot = price.get_price_now()
ohlcv_frame = price.ohlcv
change = price.get_price_change()

The Price object caches provider instances and exposes helper methods such as get_usd_price, get_timeseries_list, and set_next_service for provider rotation.

Testing

Run the test suite and collect coverage with:

pytest
pytest --cov=btcpriceticker

The project follows Ruff formatting rules and includes optional pre-commit hooks:

ruff check --fix
pre-commit run --all-files

Contributing

Issues and pull requests are welcome. Please open an issue describing proposed changes and ensure tests pass before submitting.

License

Licensed under the MIT License. See LICENSE for details.

Metadata

Release files for btcpriceticker 0.3.1

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

Source distribution (sdist)

Source distribution for btcpriceticker 0.3.1
File Size Uploaded
btcpriceticker-0.3.1.tar.gz 29.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for btcpriceticker 0.3.1
File Interpreter ABI Platform
btcpriceticker-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 55.9 kB

Release files / btcpriceticker-0.3.1.tar.gz

Download URL btcpriceticker-0.3.1.tar.gz
Size 29.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6beaa2facc8eaa6cbf51046bfb007302323e2337ef99a11068489fe39dd82c8c
BLAKE2b-256 checksum
How to use checksums
e5cc915e976d01e34853bfb8b1dbd8a35bdf9d39fd93395b6e99a2a43849375b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.24

Release files / btcpriceticker-0.3.1-py3-none-any.whl

Download URL btcpriceticker-0.3.1-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f0d4c08ac1cb9d9ce2cdf3edb9796caf93e53d9e8b4f381cf9f7d52bb2d71fe
BLAKE2b-256 checksum
How to use checksums
74d54a86a140ca17c9a0f617f84124adc2c9a283553140f42e9d6c6a1582808d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.24

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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