You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

binance4py

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binance4py

Python binance API wrapper


Maintainers
1

Readme

binance4py logo

GitHub license PyPi package version Supported python versions Code style: black

This is an asynchronous Python wrapper for Binance exchange API.

Features

  • Implementation of all general, market, spot and websocket endpoints
  • Easy to contribute and use
  • Fully typed

Installation

pip install -U binance4py

Quick Start

import asyncio
from binance4py import Binance


async def handle_kline(k):
    print(k)


async def main():
    client = Binance("<API_KEY>", "<API_SECRET>", testnet=True)
    async with client:
        print(await client.general.server_time())
        await client.ws.start()
        await client.ws.kline(handle_kline, "btcbusd", "1m")
        print(await client.ws.subscriptions())
        await client.ws.wait_stop()


asyncio.run(main())

Using a different TLD and Cluster

This example will change all binance urls that support this from https://api.binance.com to https://api2.binance.jp

client = Binance(
    tld="jp",
    cluster=2
)

Using a different json dumper/loader

import ujson


client = Binance(
    json_dumps=ujson.dumps,
    json_loads=ujson.loads
)

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc