01.xyz Python SDK
Project description
01.xyz Python SDK
Python SDK to interface with the 01 Solana program.
Installation
$ pip install zo-sdk
General Usage
from zo import Zo
# Create the client. By default, this loads the local payer
# and initializes a margin account for the payer if there
# isn't already one.
zo = await Zo.new(cluster='devnet')
# View market and collateral info.
print(zo.collaterals["BTC"])
print(zo.markets["BTC-PERP"])
# Deposit and withdraw collateral.
await zo.deposit(1, mint=zo.collaterals["SOL"].mint)
await zo.withdraw(1, mint=zo.collaterals["SOL"].mint)
# Place and cancel orders.
await zo.place_order(1., 100., 'bid',
symbol="SOL-PERP", order_type="limit", client_id=1)
await zo.cancel_order_by_client_id(1, symbol="SOL-PERP")
# Refresh loaded accounts to see updates,
# such as change in collateral after deposits.
await zo.refresh()
# View own balance, positions and orders.
print(zo.balance["BTC"])
print(zo.position["BTC-PERP"])
print(zo.orders["BTC-PERP"])
# Dispatch multiple instructions in a single transaction,
# using the `_ix` variant.
await zo.send(
zo.cancel_order_by_client_id_ix(1, symbol="SOL-PERP"),
zo.place_order_ix(1., 100., 'bid',
symbol="SOL-PERP", order_type="limit", client_id=1),
)
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
zo-sdk-0.1.4.post1.tar.gz
(22.7 kB
view hashes)
Built Distribution
Close
Hashes for zo_sdk-0.1.4.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9acdad64ea12d4aa18436b1d43a8bd4bfbf3f3ed3485605930c512522cceec62 |
|
MD5 | 163884d29d7583d90ae9e6c80d39009a |
|
BLAKE2b-256 | 87571bc2bab9881151c1e2690e1ed62325e9525bf35e2f2a04a2c3d6a68da99b |