Metadata-Version: 2.1
Name: zo-sdk
Version: 0.1.2
Summary: 01.xyz Python SDK
Home-page: https://github.com/01protocol/zo-sdk-py
License: Apache-2.0
Author: Sheheryar Parvaz
Author-email: me@cherryman.org
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Requires-Dist: anchorpy (>=0.8.1,<0.9.0)
Requires-Dist: solana (>=0.21.0,<0.22.0)
Project-URL: Documentation, https://01protocol.github.io/zo-sdk-py/
Project-URL: Repository, https://github.com/01protocol/zo-sdk-py
Description-Content-Type: text/markdown

# 01.xyz Python SDK

<p align="center">
<b><a href="https://01protocol.github.io/zo-sdk-py/">Documentation</a></b>
|
<b><a href="https://pypi.org/project/zo-sdk/">PyPi</a></b>
</p>

Python SDK to interface with the 01 Solana program.

## Installation

```
$ pip install zo-sdk
```

## General Usage

```python
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"])
```

