A simple package for connecting to the the Binance US API.
Project description
binance-us
A simple package for connecting to the Binance US API.
This package is still in beta please try it out and please report any comments, concerns, and issues.
Latest Update
- Added Custodial class and methods.
- Updated README.md example
Installation
You can install the package using pip:
pip install binance-us
Rest API Usage
I recommend consulting the offical Binance US API documentation at: https://docs.binance.us/
Here is a simple example of how to use the package:
# Imports
from binance_us import BinanceRestAPI
from binance_us import BinanceCustodialRestAPI
api_key = 'your_api_key'
api_secret = 'your_api_secret'
# REST API
client = BinanceRestAPI(api_key, api_secret)
# Custodial API
custodial = BinanceCustodialRestAPI(api_key, secret_key)
# Get exchange information
exchange_info = client.get_exchange_information()
print(exchange_info)
# Get recent trades
recent_trades = client.get_recent_trades(symbol='BTCUSD')
print(recent_trades)
# Get custodial account information
account_balance = custodial.get_account_balance(rail='CUSTODIAL_PARTNER')
print(custodial_info)
Important Notes
- Currently all all responses are either JSON or f-strings.
- Store your API keys and secrets in environment variables or secure storage solutions.
- Do not hardcode your API keys and secrets in your scripts.
- Ambiguous method names will be subclassed into their respective categories in a coming update.
Features
- Get exchange information
- Get market data
- Interact with most Binance US API endpoints (More endpoints coming soon)
- Post trades and orders
- etc.
Next Update
- Binance Rest API Custodial subclass
Planned Updates
- Binance Websocket API class
- Binance Websocket Streams class
- Output data to pandas or polars
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file binance_us-0.0.15.tar.gz.
File metadata
- Download URL: binance_us-0.0.15.tar.gz
- Upload date:
- Size: 57.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4de76b1b614286e69fb4e8143ee6d6c42c53ad15d0636787a57fee0479f1ae6
|
|
| MD5 |
5dee10aaab297ce5da01ac2600e21ea2
|
|
| BLAKE2b-256 |
27cc8c233f985eb115e390995ff5db9555927178ebf9617cdb8df9e2c96b5210
|
Provenance
The following attestation bundles were made for binance_us-0.0.15.tar.gz:
Publisher:
main.yml on nikhilxsunder/binance-us
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
binance_us-0.0.15.tar.gz -
Subject digest:
e4de76b1b614286e69fb4e8143ee6d6c42c53ad15d0636787a57fee0479f1ae6 - Sigstore transparency entry: 171850788
- Sigstore integration time:
-
Permalink:
nikhilxsunder/binance-us@39842d290700afe222839981631078f8406bd721 -
Branch / Tag:
refs/tags/v0.0.15 - Owner: https://github.com/nikhilxsunder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@39842d290700afe222839981631078f8406bd721 -
Trigger Event:
push
-
Statement type:
File details
Details for the file binance_us-0.0.15-py3-none-any.whl.
File metadata
- Download URL: binance_us-0.0.15-py3-none-any.whl
- Upload date:
- Size: 45.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e692c427373f99ee1f43eac76795a0c7146238edd442b536c898ed497bd3ed0
|
|
| MD5 |
f9536cca0a500a001cf25b2548b150eb
|
|
| BLAKE2b-256 |
e77e92188b6ac55450a12f28d525f60ebcdd8abedb499dd1faf05a1ce37cf500
|
Provenance
The following attestation bundles were made for binance_us-0.0.15-py3-none-any.whl:
Publisher:
main.yml on nikhilxsunder/binance-us
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
binance_us-0.0.15-py3-none-any.whl -
Subject digest:
2e692c427373f99ee1f43eac76795a0c7146238edd442b536c898ed497bd3ed0 - Sigstore transparency entry: 171850790
- Sigstore integration time:
-
Permalink:
nikhilxsunder/binance-us@39842d290700afe222839981631078f8406bd721 -
Branch / Tag:
refs/tags/v0.0.15 - Owner: https://github.com/nikhilxsunder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@39842d290700afe222839981631078f8406bd721 -
Trigger Event:
push
-
Statement type: