No project description provided
Project description
BSX Exchange Python SDK
This is the Python SDK for the BSX Exchange API.
See SDK docs to get started.
Requirements
- Python 3.9 or above
Installation
You can install the SDK via pip:
pip install bsx-sdk-py
Basic usage
Create a wallet and a signer from private keys
from eth_account import Account
wallet_private_key = "xxx"
signer_private_key = "yyy"
wallet = Account.from_key(wallet_private_key)
signer = Account.from_key(signer_private_key)
Create the BSXInstance providing BSX Exchange domain, account and signer:
from bsx_py import BSXInstance, Environment
bsx_instance = BSXInstance(env=Environment.TESTNET, wallet=wallet, signer=signer)
Perform basic operations:
# Placing orders
from bsx_py.common.types.market import CreateOrderParams
params = CreateOrderParams(
side=Side.BUY,
product_index=3,
price=price,
size=size,
time_in_force="GTC",
nonce=int(time.time())
)
order = bsx_instance.create_order(params)
print("order id:", order.id)
See Getting Started for more.
Running locally
-
Clone github repo
-
Install poetry
$ curl -sSL https://install.python-poetry.org | python3 -
- Setup a virtual environment and activate it
$ python3 -m venv venv
$ source ./venv/bin/activate
- Install dependencies via
poetry install
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
bsx_sdk_py-0.0.1b1.tar.gz
(11.0 kB
view hashes)
Built Distribution
Close
Hashes for bsx_sdk_py-0.0.1b1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24ba466b5db893ae2e17116658f5c99ab311fc844aac38a49fb80df63961f9e3 |
|
MD5 | 45f87b19e4b82e053335c92579f764aa |
|
BLAKE2b-256 | f03d95e166bfb6d55385fe2476bc66c0178d23496566809cd54ecc95b9371d55 |