Skip to main content

Unified Crypto Exchange API

Project description

Unified Crypto Exchange API

unicex — асинхронная библиотека для работы с криптовалютными биржами, реализующая унифицированный интерфейс поверх «сырых» REST и WebSocket API разных бирж.

✅ Статус реализации

Exchange Client UniClient Adapter WebsocketManager UniWebsocketManager UserWebsocket
Binance [x] [x] [x] [x] [x] [x]
Bybit [ ] [ ] [ ] [ ] [ ] [ ]
Bitget [ ] [ ] [ ] [ ] [ ] [ ]
Okx [ ] [ ] [ ] [ ] [ ] [ ]
Mexc [ ] [ ] [ ] [ ] [ ] [ ]
Gate [ ] [ ] [ ] [ ] [ ] [ ]

🚀 Быстрый старт

  • Установка: pip install unicex или из исходников: pip install -e .
  • Библиотека полностью асинхронная. Примеры импорта:
    • Сырые клиенты: from unicex.binance import Client
    • Унифицированные клиенты: from unicex.binance import UniClient
    • Менеджеры WS: from unicex.binance import WebsocketManager, UniWebsocketManager

Пример: получить последние цены через унифицированный клиент Binance

import asyncio
from unicex.binance import UniClient


async def main():
    client = await UniClient.create()
    prices = await client.last_price()
    print(prices["BTCUSDT"])
    await client.close()


if __name__ == "__main__":
    asyncio.run(main())

Пример: подписаться на трейды через унифицированный WS‑менеджер Bitget

import asyncio
from unicex.bitget import UniWebsocketManager
from unicex import TradeDict


async def on_trade(msg: TradeDict):
    print(msg)


async def main():
    uwm = UniWebsocketManager()
    socket = uwm.trades(callback=on_trade, symbol="BTCUSDT")
    await socket.start()


if __name__ == "__main__":
    asyncio.run(main())

🧑‍💻 Блок для разработчика

📋 Todo

  • Добавить веса и рейт‑лимиты в документацию клиентов
  • Пересмотреть вопрос: должен ли быть адаптер интерфейсом?
  • Доделать BitgetClient и проверить типы
  • Добавить overload к методам с None, None
  • Определить порядок полей, возвращаемых адаптером
  • Написать 1–2 примера

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

unicex-0.2.0.tar.gz (44.8 kB view details)

Uploaded Source

Built Distribution

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

unicex-0.2.0-py3-none-any.whl (55.5 kB view details)

Uploaded Python 3

File details

Details for the file unicex-0.2.0.tar.gz.

File metadata

  • Download URL: unicex-0.2.0.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for unicex-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1ca196b386107ec349cac46d4eddd65a024be2019dc9570ccf8a8ea99f74d65f
MD5 f22bbda82509f763421ce7b92b2045be
BLAKE2b-256 6e4f3d28a41cda32e881bd3b74cdbc177d59f176a463f897cb681baa30f3eb42

See more details on using hashes here.

File details

Details for the file unicex-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: unicex-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 55.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for unicex-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cf2e0263158c94a05464ac06e0e68c3e27fdd875f7c06b0f0ed07b76f75a6a8
MD5 0993e34acdd6bf8f9a0d80a6295c11dc
BLAKE2b-256 1a6b534ab59dc765d6a4fb1b32e027e69967479b27c0f3b90b9baac3cf43309a

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