Skip to main content

Common models and dependencies for crypto projects.

Project description

ByteForge Crypto Commons

A Python library providing common models and utilities for cryptocurrency projects. This library serves as a foundation for building cryptocurrency-related applications by providing standardized data models and types.

Features

  • Standardized Data Models: Well-defined Python dataclasses for representing cryptocurrency data
  • Type Safety: Full type hints and documentation for all models
  • Comprehensive Market Data: Support for various market metrics and statistics
  • Flexible Design: Optional fields for extended data while maintaining core required fields

Installation

pip install byteforge-crypto-commons

Usage

Token State

The TokenState class represents the complete state of a cryptocurrency token at a specific moment in time:

from crypto_commons.types.token_state import TokenState
from crypto_commons.types.quote import Quote
import datetime

# Create a quote for USD
quote = Quote(
    base_currency="USD",
    price=50000.0,
    volume_24h=1000000000.0,
    percent_change_1h=1.5,
    percent_change_24h=5.0,
    percent_change_7d=10.0,
    percent_change_30d=20.0,
    market_cap=1000000000000.0,
    last_updated=datetime.datetime.now()
)

# Create a token state
token_state = TokenState(
    id=1,
    name="Bitcoin",
    symbol="BTC",
    timestamp=int(datetime.datetime.now().timestamp()),
    quote_map={"USD": quote}
)

Quote

The Quote class represents market data for a cryptocurrency in a specific currency:

from crypto_commons.types.quote import Quote
import datetime

quote = Quote(
    base_currency="USD",
    price=50000.0,
    volume_24h=1000000000.0,
    percent_change_1h=1.5,
    percent_change_24h=5.0,
    percent_change_7d=10.0,
    percent_change_30d=20.0,
    market_cap=1000000000000.0,
    last_updated=datetime.datetime.now()
)

Data Models

TokenState

Represents the complete state of a cryptocurrency token, including:

  • Basic information (id, name, symbol)
  • Market data through Quote objects
  • Supply metrics (circulating, total, max supply)
  • Status indicators (is_active, is_fiat)
  • Additional metadata (tags, platform, creation date)

Quote

Represents market data for a cryptocurrency in a specific currency, including:

  • Price and volume data
  • Market capitalization
  • Percentage changes over various time periods
  • Supply metrics
  • Additional market statistics

Requirements

  • Python 3.8 or higher
  • python-dateutil

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

  • Jason Byteforge

Project Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

byteforge_crypto_commons-0.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

byteforge_crypto_commons-0.1-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file byteforge_crypto_commons-0.1.tar.gz.

File metadata

  • Download URL: byteforge_crypto_commons-0.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for byteforge_crypto_commons-0.1.tar.gz
Algorithm Hash digest
SHA256 4df5f2f030b94656eb8ca04496f8dfe6baa826fe5c0940a01dd188f8d87598bf
MD5 92362aa1e9dfc5b7244fd2a27acfced9
BLAKE2b-256 17f58f66654095ffed434e4dd41f53582de5675398379be7721f9590afd273dc

See more details on using hashes here.

File details

Details for the file byteforge_crypto_commons-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for byteforge_crypto_commons-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9747ecf4c0c29b8834f523d7b50d7fb25cf072d559a26aabe14c1e3b78afce5f
MD5 69fe6097ba9074f67015f905a797f97a
BLAKE2b-256 edacbbb45d5204f8a77792727b564537f735ead780c87b8f7ec404d184d6d3c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page