Skip to main content

01.xyz Python SDK

Documentation | PyPi

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, "SOL")
await zo.withdraw(1, "SOL")

# 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),
)

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.2.0.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zo_sdk-0.2.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file zo-sdk-0.2.0.tar.gz.

File metadata

  • Download URL: zo-sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.10.5 Linux/5.18.15-arch1-1

File hashes

Hashes for zo-sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bddbf5df85c87d01e2646ea0f462ed07138415130b37ba54a941874120dbbec1
MD5 bf90900861b2626f95719499e5c02042
BLAKE2b-256 345d5f40b4a7ea09a6899acba5024d3227057bcbaf4cae486ee58be20038c483

See more details on using hashes here.

File details

Details for the file zo_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: zo_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.10.5 Linux/5.18.15-arch1-1

File hashes

Hashes for zo_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09e11f975008ea4ec8afde8aa0ad9af37125bb8cd4b3b10bc8336b6a220c34be
MD5 4bf96d10b41f35ba0ed50f29e76d72f8
BLAKE2b-256 251fe5c8d89fbfcd40306b5641f3b54cc4c0a5677bccd0e6e9eb1e99d5037c34

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.4.post1

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page