Metadata-Version: 2.4
Name: openxapi-binance
Version: 0.2.1
Summary: Python client for Binance API
Home-page: https://github.com/openxapi/binance-py
Author: OpenXAPI
Author-email: contact@openxapi.com
License: MIT
Keywords: OpenXAPI,OpenAPI,binance,binance-python
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: urllib3<3.0.0,>=1.25.3
Requires-Dist: python_dateutil>=2.8.2
Requires-Dist: pycryptodome>=3.9.0
Requires-Dist: pydantic>=2
Requires-Dist: typing-extensions>=4.7.1
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# Python client for Binance API

![PyPI - Version](https://img.shields.io/pypi/v/openxapi-binance?link=https%3A%2F%2Fpypi.org%2Fproject%2Fopenxapi-binance%2F)

This package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

Please do not edit the generated code manually, but rather regenerate it from [OpenXAPI](https://github.com/openxapi/openxapi).

- API version: 0.2.0
- Package version: 0.2.1

## Supported APIs

| Product | Module | Sub Products |
|:---------:|-----------|--------|
| [Spot API](binance/spot_README.md) | `binance.spot` | ✅ Spot Trading <br> ✅ Margin Trading <br> ✅ Algo Trading <br> ✅ Wallet <br> ✅ Copy Trading <br> ✅ Convert <br> ✅ Sub Account <br>✅ Binance Link <br>✅ Futures Data <br> ✅ Portfolio Margin Pro |
| [USD-M Futures API](binance/umfutures_README.md) | `binance.umfutures` | ✅ USDS Margined Futures |
| [COIN-M Futures API](binance/cmfutures_README.md) | `binance.cmfutures` | ✅ COIN Margined Futures |
| [Options API](binance/options_README.md) | `binance.options` | ✅ Options |
| [Portfolio Margin API](binance/pmargin_README.md) | `binance.pmargin` | ✅ Porfolio Margin |

## Requirements.

Python 3.8+

## Installation & Usage

```bash
pip install openxapi-binance
```

## Getting Started

In your own code, to use this library to connect and interact with spot,
you can run the following:

```python
import os
import time
from pprint import pprint

from binance import spot
from binance.spot.rest import ApiException
from binance.spot.auth import BinanceAuth

# Defining the host is optional and defaults to https://api.binance.com
# See configuration.py for a list of all supported configuration parameters.
configuration = spot.Configuration(
    host = "https://api.binance.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

conf = spot.Configuration(
    auth=BinanceAuth(
        api_key=os.getenv("BINANCE_API_KEY"),
        # secret_key=os.getenv("BINANCE_SECRET_KEY"), # if you want to use HMAC auth
        private_key_path="/path/to/private_key.pem", # Automatically detects RSA/Ed25519 private keys
    ),
)

# Enter a context with an instance of the API client
with spot.ApiClient(conf) as api_client:
    # Create an instance of the API class
    api_instance = spot.SpotTradingApi(api_client)
    try:
        # Query Commission Rates (USER_DATA)
        api_response = api_instance.get_account_v3(
            timestamp=int(time.time() * 1000)
        )
        print("The response of AccountApi->get_account_v3:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling AccountApi->get_account_v3: %s\n" % e)
```
