Skip to main content

A lightweight library that works as a connector to several crypto exchanges APIs.

Project description

Crypto-connector

tests PyPI version Python version Code Style License: MIT

This is a lightweight library that works as a connector to Binance SPOT and HTX SPOT APIs.

Installation

pip install crypto-connector

Usage examples

Public endpoints

import crypto_connector as cc

exc = cc.Binance()
# exc = cc.HTX()

# get server time
print(exc.get_server_time())

# get last 200 klines of ETHUSDT with 1d timeframe
print(exc.klines("ETHUSDT", "1d"))

Private endpoints

API key/secret are required for private endpoints.

import crypto_connector as cc

# some binance API endpoints require both sub and master accounts API key/secret.
# Therefore user needs to create a subaccount and provide subaccount api key, 
# subaccount api secret, subaccount email, master account api key and 
# master account api secret to the Binance constructor
exc = cc.Binance(
    sub_api_key="",
    sub_api_secret="",
    sub_email="",
    master_api_key="",
    master_api_secret="",
)
# exc = cc.HTX(
#     api_key="",
#     api_secret="",
# )

# get api key info
print(exc.get_api_key_info())

# get balance
print(exc.get_balance())

# post a new order
order = exc.place_order("ETHUSDT", type="limit", side="buy", qty=0.015, price=1000)
print(order)

# get open orders
print(exc.get_open_orders())

Limitation

  • This library is not intended to be comprehensive, I use it mainly for my personal projects
  • Not all endpoints of the different APIs are supported
  • Websocket and Futures are not supported

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

crypto_connector-0.3.1.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

crypto_connector-0.3.1-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file crypto_connector-0.3.1.tar.gz.

File metadata

  • Download URL: crypto_connector-0.3.1.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for crypto_connector-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e47e5cf8aa6e8c5449b057bf27015e7d08c6798afbd046d6034c4665530ad47d
MD5 8f266d29f7a1bd156092d09d4c9e8797
BLAKE2b-256 72d5b3699a5f53e3f7945c69e78552dfeacdd209c65cda42b1e4136d203e258c

See more details on using hashes here.

File details

Details for the file crypto_connector-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for crypto_connector-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a913aa576abf25064e1131ee8c4bbecd67017604cf4ea5ab30c9a09c74493cc6
MD5 f62e4abfc00971fef42c6c5a6a282ce1
BLAKE2b-256 6890f2851e7bdcc9187fb28d431b51f8391ec2ffb41eb0eefd05a83de35cad7a

See more details on using hashes here.

Supported by

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