Metadata-Version: 2.4
Name: pynado
Version: 0.1.6
Summary: A friendly, Pythonic wrapper for the Nado Protocol SDK
Author-email: apine <a@b.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/apine/pynado
Project-URL: Bug Tracker, https://github.com/apine/pynado/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: nado-protocol
Requires-Dist: pandas
Requires-Dist: python-dotenv
Requires-Dist: setuptools
Dynamic: license-file

# Pynado

A friendly, Pythonic wrapper for the [Nado Protocol SDK](https://github.com/nadohq/nado-python-sdk). Pynado simplifies the interaction with the Nado Protocol by abstracting low-level details and handling unit conversions automatically.

## Installation

```bash
pip install pynado
```

## Usage

### 1. Setup

Create a `.env` file in your project root to store your private key securely:

```env
NADO_PRIVATE_KEY='your_private_key_here'
```

### 2. Basic Example

Initialize the client and check your account details:

```python
from pynado import Nado

# Initialize the client (defaults to TESTNET and loads key from .env)
client = Nado()

# Access properties directly
print(f"Wallet Address: {client.address}")
print(f"USDT Balance:   {client.balance:,.2f}")
```

### 3. Market Data

Retrieve real-time prices and order book depth.

```python
# Get current mid-price
price = client.get_price("BTC-PERP")
print(f"BTC Price: {price}")

# Get top 5 levels of the order book
book = client.get_market_liquidity("ETH-PERP", depth=5)
print(f"Best Bid: {book['bids'][0][0]}")
```

### 4. Trading (Market & Limit Orders)

Pynado handles symbol resolution (Spot vs. Perp), unit scaling (`to_x18`), and price rounding automatically.

```python
# Market Buy 0.01 BTC
client.buy("BTC", 0.01)

# Limit Sell 0.5 ETH-PERP at 3,500 USD (Expires in 24h by default)
res = client.sell_limit("ETH-PERP", 3500, 0.5)
print(f"Order Digest: {res['digest']}")
```

### 5. Order Management

Cancel specific orders using their digest or clear your entire book.

```python
# Cancel a specific order
client.cancel_order("ETH-PERP", "0x...")

# Cancel ALL open orders across all products
client.cancel_all_orders()

# Cancel all open orders for a specific product
client.cancel_all_orders("BTC")
```

### 6. Checking Positions

You can easily check specific positions or get an overview of your entire account.

```python
# Get a specific position
pos = client.get_position("BTC-PERP")
print(f"Amount: {pos['amount']}, Entry Price: {pos['average_entry_price']}")

# Get all active positions
all_pos = client.get_all_positions()
for p in all_pos:
    print(f"{p['symbol']}: {p['amount']}")
```

## Features

*   **Simple Interface:** One class (`Nado`) to rule them all.
*   **Automatic Scaling:** Handles 18-decimal scaling for you (returns `float` for balances, accepts `float` for orders).
*   **Symbol Resolution:** Supports both Spot ("BTC") and Perp ("BTC-PERP") symbols.
*   **Market Data:** Easy access to prices and order book liquidity.
*   **Position Management:** Friendly methods to retrieve current holdings and average entry prices.
*   **Order Management:** Easy methods to cancel specific orders or clear your entire order book.
*   **Intelligent Defaults:** Automatically handles price increments (rounding) and order expiration.
*   **Environment Friendly:** Native support for `.env` files.
