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.1b2.tar.gz
(11.0 kB
view hashes)
Built Distribution
Close
Hashes for bsx_sdk_py-0.0.1b2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56b0e383b9379d3b4e0e97166eb3ad76a5878b7fbd226b98dc5ac2d7bc0f4652 |
|
MD5 | 51f838866061a00bc5f3fa9865147563 |
|
BLAKE2b-256 | bfff89cc797e814f46bac1515b0c2ef1f99c5abebdbcfee3ace2d6d25ee6d96b |