Welcome to CCXT Wrapper documentation!

Installation & Usage

CCXT Wrapper

CI Status Documentation Status Test coverage percentage

Poetry black pre-commit

PyPI Version Supported Python versions License

A wrapper for CCXT with type hints, etc.

Installation

Install this via pip (or your favourite package manager):

pip install ccxt-wrapper

Usage

import warnings
from src.ccxt_wrapper.wrapper import CCXTWrapper
from ccxt.async_support import binance

with warnings.catch_warnings():
    # ccxt_wrapper will raise numerous warnings about wrong types, missing keys, etc.
    # This is 99% blame on ccxt :>
    warnings.simplefilter("ignore")

    # Creating exchange instance from CCXTWrapper
    async with CCXTWrapper.new(binance, default_type='future') as wrapper:
        # Our API
        ticker = await wrapper.fetch_ticker("BTC/USDT")
        print(type(ticker)) # attrs class <class 'src.ccxt_wrapper.dtypes.Ticker'>

        # CCXT API
        ticker_orginal = await wrapper.exchange.fetch_ticker("BTC/USDT")
        print(type(ticker_orginal)) # dict <class 'dict'>

        # Same result but more fluent
        assert ticker.high == ticker_orginal["high"]

    # Using existing exchange instance
    async with CCXTWrapper(binance()) as wrapper:
        pass

Contributors ✨

Thanks goes to these wonderful people (emoji key):

34j
34j

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

This package was created with Copier and the browniebroke/pypackage-template project template.