Name | purrio JSON |
Version |
0.1.2
JSON |
| download |
home_page | None |
Summary | CLI wrapper for Hyperliquid's Python SDK - agent-first design for traders and bots |
upload_time | 2025-08-16 22:47:05 |
maintainer | None |
docs_url | None |
author | Purrio Team |
requires_python | <4.0,>=3.10 |
license | MIT |
keywords |
hyperliquid
trading
cli
defi
cryptocurrency
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Purrio CLI
Terminal interface for Hyperliquid. Built for traders and automation.
## What it does
Purrio is a command-line wrapper around Hyperliquid's Python SDK. It lets you trade, check positions, and query market data from your terminal. The output formats (table/json/csv) make it easy to use in scripts, trading bots, or AI agents.
## Features
- **Terminal Trading**: Execute trades and monitor positions from the command line
- **Multiple Output Formats**: Table (human), JSON (scripts), CSV (spreadsheets)
- **Scriptable**: No interactive prompts - everything via flags for automation
- **Simple Wrapper**: Thin layer over Hyperliquid's Python SDK
- **Modular Design**: Commands organized into logical groups (info, trade, config)
## Commands Overview
```bash
# Information Commands
purrio coins # List all available trading pairs
purrio price [COINS...] # Get current prices
purrio positions ADDRESS # View positions for any wallet
purrio orders ADDRESS # View open orders
purrio fills ADDRESS # View recent trades
purrio account ADDRESS # View account summary
purrio funding COIN # Get funding rate history
purrio orderbook COIN # Get order book depth
purrio meta COIN # Get asset info (leverage, decimals)
purrio asset-ctx [COIN] # Get asset context with market data
# Trading Commands (requires credentials)
purrio long COIN LEVERAGE MARGIN # Open long position
purrio short COIN LEVERAGE MARGIN # Open short position
purrio close COIN PERCENTAGE # Close position
purrio close all PERCENTAGE # Close all positions
# Limit Order Commands
purrio limit long COIN LEVERAGE PRICE MARGIN # Place long limit order
purrio limit short COIN LEVERAGE PRICE MARGIN # Place short limit order
purrio limit cancel COIN ORDER_ID # Cancel specific order
purrio limit cancel COIN --all # Cancel all orders for coin
# Configuration
purrio config show # Display current configuration
purrio version # Show version
```
## Installation
```bash
# Using pip
pip install purrio
# Using poetry
poetry add purrio
# From source
git clone https://github.com/purrio/purrio-cli.git
cd purrio-cli
poetry install
```
## Quick Start
### Get Prices
```bash
# All prices
purrio price
# Specific coins
purrio price BTC ETH
# JSON output for scripts
purrio --output json price BTC
```
### View Positions
```bash
# Any wallet address
purrio positions 0x1234...
# JSON format
purrio --output json positions 0x1234...
```
### Open Positions
```bash
# Set up credentials
export PURRIO_ACCOUNT_ADDRESS=0x...
export PURRIO_SECRET_KEY=0x...
# Open long position
purrio long BTC 5x 1000 # 5x leverage, $1000 margin
# Open short position
purrio short ETH 3x 2000 # 3x leverage, $2000 margin
# Close positions
purrio close BTC 100% # Close BTC position completely
purrio close all 50% # Close 50% of all positions
```
### Limit Orders
```bash
# Place limit orders with leverage and margin
purrio limit long BTC 5x 50000 1000 # Long BTC at $50k, 5x leverage, $1000 margin
purrio limit short ETH 3x 3000 2000 # Short ETH at $3k, 3x leverage, $2000 margin
# With options
purrio limit long SOL 10x 100 500 --tif Ioc --reduce-only
```
## Configuration
### Environment Variables
Create a `.env` file or set environment variables:
```bash
# Required for trading
PURRIO_ACCOUNT_ADDRESS=0x... # Your wallet address
PURRIO_SECRET_KEY=0x... # Your private key
# Optional settings
PURRIO_API_URL=https://api.hyperliquid.xyz # or testnet URL
PURRIO_OUTPUT_FORMAT=table # table, json, or csv
PURRIO_NETWORK=mainnet # mainnet or testnet
```
### Security Note
⚠️ **Never commit your private key to version control!** Use environment variables or a secure `.env` file.
## Output Formats
Purrio supports three output formats controlled by the `--output` flag:
- **TABLE** (default): Human-readable tables with formatted data
- **JSON**: Raw SDK data for agents/scripts - exactly what Hyperliquid API returns
- **CSV**: Formatted data for spreadsheets (same as TABLE but comma-separated)
```bash
# Examples of different output formats
purrio price BTC # TABLE: $50,000.50
purrio price BTC --output json # JSON: {"BTC": "50000.5"}
purrio price BTC --output csv # CSV: Coin,Price\nBTC,"$50,000.50"
```
**For Developers**: JSON output always returns raw Hyperliquid SDK data with no transformations - perfect for building tools and agents.
## Commands
### Information Commands
#### `purrio price [COINS...]`
Get current mid prices for specified coins.
```bash
purrio price # All coins
purrio price BTC ETH # Specific coins
purrio price BTC --output json # Raw SDK data
```
#### `purrio positions [ADDRESS]`
Get positions for any wallet address (defaults to configured address).
```bash
purrio positions 0x1234...
purrio positions 0x1234... --output json # Raw user_state data
```
#### `purrio orders [ADDRESS]`
Get open orders for any wallet address (defaults to configured address).
```bash
purrio orders 0x1234...
```
#### `purrio account [ADDRESS]`
Get account summary including balances and margin.
```bash
purrio account 0x1234...
```
#### `purrio funding COIN --hours N`
Get funding rate history for a coin.
```bash
purrio funding BTC # Last 24 hours
purrio funding ETH --hours 48
```
#### `purrio orderbook COIN --depth N`
Get L2 orderbook snapshot.
```bash
purrio orderbook BTC # Default 10 levels
purrio orderbook ETH --depth 20
```
#### `purrio fills [ADDRESS]`
Get recent trade fills for any address (defaults to configured address).
```bash
purrio fills 0x1234...
```
#### `purrio meta COIN`
Get asset metadata including max leverage and decimals.
```bash
purrio meta BTC
purrio meta @107 # Query by token ID
```
#### `purrio asset-ctx [COIN]`
Get asset metadata with market context (volume, funding, open interest).
```bash
purrio asset-ctx # All assets
purrio asset-ctx BTC # Single asset context
purrio asset-ctx --output json # Raw meta_and_asset_ctxs data
```
### Position Trading Commands
#### `purrio long COIN LEVERAGE MARGIN`
Open a long position with specified leverage and margin.
```bash
purrio long BTC 5x 1000 # 5x leverage, $1000 margin
purrio long ETH 10 2000 # 10x leverage, $2000 margin
purrio long SOL 3x 500 --slippage 2.0 # Custom slippage
```
Options:
- `--slippage`: Maximum slippage percentage (default: 1%)
#### `purrio short COIN LEVERAGE MARGIN`
Open a short position with specified leverage and margin.
```bash
purrio short BTC 3x 1500 # 3x leverage, $1500 margin
purrio short ETH 5x 1000 # 5x leverage, $1000 margin
purrio short SOL 2x 800 --slippage 1.5 # Custom slippage
```
Options:
- `--slippage`: Maximum slippage percentage (default: 1%)
#### `purrio close COIN PERCENTAGE`
Close a percentage of an existing position.
```bash
purrio close BTC 100% # Close entire BTC position
purrio close ETH 50% # Close half of ETH position
purrio close SOL 25 # Close 25% (% symbol optional)
```
#### `purrio close all PERCENTAGE`
Close a percentage of all open positions.
```bash
purrio close all 100% # Close all positions completely
purrio close all 30% # Take 30% profits on all positions
purrio close all 50 --slippage 2.0 # Custom slippage
```
Options:
- `--slippage`: Maximum slippage percentage (default: 1%)
### Limit Order Commands
#### `purrio limit long/short COIN LEVERAGE PRICE MARGIN`
Place a limit order with leverage and margin.
```bash
purrio limit long BTC 5x 50000 1000 # Long BTC at $50k, 5x leverage, $1000 margin
purrio limit short ETH 3x 3000 2000 # Short ETH at $3k, 3x leverage, $2000 margin
purrio limit long SOL 10x 100 500 --tif Ioc --reduce-only
```
Options:
- `--tif`: Time in force (Gtc, Ioc, Alo)
- `--reduce-only`: Reduce-only order
#### `purrio limit cancel COIN ORDER_ID`
Cancel an open order.
```bash
purrio limit cancel BTC 12345 # Cancel specific order
purrio limit cancel BTC --all # Cancel all BTC orders
```
### Configuration Commands
#### `purrio config show`
Display current configuration.
```bash
purrio config show
purrio config show --output json
```
#### `purrio version`
Show CLI version.
```bash
purrio version
```
## Performance & Caching
Purrio includes intelligent caching to optimize performance:
### Asset Data Caching
Asset information (max leverage, decimals, names) is cached locally to avoid redundant API calls:
```bash
# Instant lookups using cached data
purrio asset ETH # Shows max leverage, decimals
purrio asset @107 # Resolves token ID to name (ALT)
# Refresh asset cache when needed
purrio-refresh-assets # Updates cached asset data
```
### Performance Benefits
- **Asset info lookups**: 100-1000x faster (cached vs API)
- **Leverage validation**: Instant for known assets
- **Token name resolution**: Instant for @ tokens
- **Commands affected**: `info asset`, leverage validation, @ token display
### Cache Management
The cache is automatically used but can be refreshed:
```bash
# Refresh cache (run occasionally)
poetry run purrio-refresh-assets
# Or manually
python scripts/refresh_assets.py
```
Cache files are stored in `src/purrio/constants/assets.py` and include both mainnet and testnet data.
## Agent Integration
Purrio is designed for programmatic use by agents and scripts:
### Python Example
```python
import subprocess
import json
# Get prices programmatically
result = subprocess.run(
["purrio", "--output", "json", "price", "BTC"],
capture_output=True,
text=True
)
data = json.loads(result.stdout)
btc_price = data["BTC"]
print(f"BTC Price: ${btc_price:,.2f}")
# Check positions
result = subprocess.run(
["purrio", "--output", "json", "positions", "0x..."],
capture_output=True,
text=True
)
positions = json.loads(result.stdout)
```
### Shell Script Example
```bash
#!/bin/bash
# Get BTC price
BTC_PRICE=$(purrio --output json price BTC | jq '.BTC')
echo "Current BTC price: $BTC_PRICE"
# Check if price is above threshold
if (( $(echo "$BTC_PRICE > 50000" | bc -l) )); then
echo "BTC is above $50,000"
fi
```
### Design Principles for Agents
1. **No Interactive Prompts**: All input via flags/arguments
2. **Structured Output**: Consistent JSON schema
3. **Predictable Errors**: Clear error codes and messages
4. **Exit Codes**: 0 for success, 1 for error
5. **Idempotent Operations**: Safe for retry logic
## Output Formats
### Table (Default)
Human-readable format with Rich formatting:
```
┏━━━━━━━┳━━━━━━━━━━━━━┓
┃ Coin ┃ Price ┃
┡━━━━━━━╇━━━━━━━━━━━━━┩
│ BTC │ $50,000.00 │
│ ETH │ $3,000.00 │
└───────┴─────────────┘
```
### JSON
Machine-readable format for scripts:
```json
{
"BTC": 50000.0,
"ETH": 3000.0
}
```
### CSV
Spreadsheet-compatible format:
```csv
Coin,Price
BTC,50000.0
ETH,3000.0
```
## Development
### Project Structure
```
src/purrio/
├── cli.py # Main application entry point
├── commands/ # Command modules
│ ├── base.py # Shared decorators and utilities
│ ├── market.py # Market operations (long, short, close)
│ ├── orders.py # Limit orders and cancellation
│ ├── query.py # Account queries (positions, orders, fills)
│ ├── data.py # Market data (prices, funding, orderbook)
│ └── config.py # Configuration commands
├── client.py # Hyperliquid SDK wrapper
├── config.py # Configuration management (Pydantic models)
├── constants/ # Static data
│ └── assets.py # Cached asset information
├── context.py # Application context
├── output.py # Output formatting (table/json/csv)
├── types.py # Type definitions
└── utils.py # Shared utilities
```
### Setup
```bash
# Clone repository
git clone https://github.com/purrio/purrio-cli.git
cd purrio-cli
# Install dependencies
poetry install
# Install pre-commit hooks
pre-commit install
```
### Testing
```bash
# Run tests
poetry run pytest
# Run with coverage
poetry run pytest --cov
# Run specific test
poetry run pytest tests/test_config.py
```
### Code Quality
```bash
# Format code
poetry run ruff format
# Lint code
poetry run ruff check --fix
# Type checking
poetry run mypy src/
```
## Known Issues
1. **Python 3.11+ Compatibility**: The `parsimonious` library (dependency of eth-abi) has issues with Python 3.11+. Currently recommended to use Python 3.10.
## Support
- GitHub Issues: [github.com/purrio/purrio-cli/issues](https://github.com/purrio/purrio-cli/issues)
- Documentation: [docs.purrio.io](https://docs.purrio.io)
## License
MIT License - see LICENSE file for details.
## Disclaimer
This software is provided "as is" without warranty of any kind. Trading cryptocurrencies carries risk. Always verify orders and positions through official Hyperliquid interfaces.
Raw data
{
"_id": null,
"home_page": null,
"name": "purrio",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "hyperliquid, trading, cli, defi, cryptocurrency",
"author": "Purrio Team",
"author_email": "team@purrio.io",
"download_url": "https://files.pythonhosted.org/packages/5f/15/f8c8d419f81be3eb9d428f3d3f64645639a14f47fd312dcc8ec802cc42e3/purrio-0.1.2.tar.gz",
"platform": null,
"description": "# Purrio CLI\n\nTerminal interface for Hyperliquid. Built for traders and automation.\n\n## What it does\n\nPurrio is a command-line wrapper around Hyperliquid's Python SDK. It lets you trade, check positions, and query market data from your terminal. The output formats (table/json/csv) make it easy to use in scripts, trading bots, or AI agents.\n\n## Features\n\n- **Terminal Trading**: Execute trades and monitor positions from the command line\n- **Multiple Output Formats**: Table (human), JSON (scripts), CSV (spreadsheets)\n- **Scriptable**: No interactive prompts - everything via flags for automation\n- **Simple Wrapper**: Thin layer over Hyperliquid's Python SDK\n- **Modular Design**: Commands organized into logical groups (info, trade, config)\n\n## Commands Overview\n\n```bash\n# Information Commands\npurrio coins # List all available trading pairs\npurrio price [COINS...] # Get current prices\npurrio positions ADDRESS # View positions for any wallet\npurrio orders ADDRESS # View open orders\npurrio fills ADDRESS # View recent trades\npurrio account ADDRESS # View account summary\npurrio funding COIN # Get funding rate history\npurrio orderbook COIN # Get order book depth\npurrio meta COIN # Get asset info (leverage, decimals)\npurrio asset-ctx [COIN] # Get asset context with market data\n\n# Trading Commands (requires credentials)\npurrio long COIN LEVERAGE MARGIN # Open long position\npurrio short COIN LEVERAGE MARGIN # Open short position\npurrio close COIN PERCENTAGE # Close position\npurrio close all PERCENTAGE # Close all positions\n\n# Limit Order Commands\npurrio limit long COIN LEVERAGE PRICE MARGIN # Place long limit order\npurrio limit short COIN LEVERAGE PRICE MARGIN # Place short limit order\npurrio limit cancel COIN ORDER_ID # Cancel specific order\npurrio limit cancel COIN --all # Cancel all orders for coin\n\n# Configuration\npurrio config show # Display current configuration\npurrio version # Show version\n```\n\n## Installation\n\n```bash\n# Using pip\npip install purrio\n\n# Using poetry\npoetry add purrio\n\n# From source\ngit clone https://github.com/purrio/purrio-cli.git\ncd purrio-cli\npoetry install\n```\n\n## Quick Start\n\n### Get Prices\n\n```bash\n# All prices\npurrio price\n\n# Specific coins\npurrio price BTC ETH\n\n# JSON output for scripts\npurrio --output json price BTC\n```\n\n### View Positions\n\n```bash\n# Any wallet address\npurrio positions 0x1234...\n\n# JSON format\npurrio --output json positions 0x1234...\n```\n\n### Open Positions\n\n```bash\n# Set up credentials\nexport PURRIO_ACCOUNT_ADDRESS=0x...\nexport PURRIO_SECRET_KEY=0x...\n\n# Open long position\npurrio long BTC 5x 1000 # 5x leverage, $1000 margin\n\n# Open short position\npurrio short ETH 3x 2000 # 3x leverage, $2000 margin\n\n# Close positions\npurrio close BTC 100% # Close BTC position completely\npurrio close all 50% # Close 50% of all positions\n```\n\n### Limit Orders\n\n```bash\n# Place limit orders with leverage and margin\npurrio limit long BTC 5x 50000 1000 # Long BTC at $50k, 5x leverage, $1000 margin\npurrio limit short ETH 3x 3000 2000 # Short ETH at $3k, 3x leverage, $2000 margin\n\n# With options\npurrio limit long SOL 10x 100 500 --tif Ioc --reduce-only\n```\n\n## Configuration\n\n### Environment Variables\n\nCreate a `.env` file or set environment variables:\n\n```bash\n# Required for trading\nPURRIO_ACCOUNT_ADDRESS=0x... # Your wallet address\nPURRIO_SECRET_KEY=0x... # Your private key\n\n# Optional settings\nPURRIO_API_URL=https://api.hyperliquid.xyz # or testnet URL\nPURRIO_OUTPUT_FORMAT=table # table, json, or csv\nPURRIO_NETWORK=mainnet # mainnet or testnet\n```\n\n### Security Note\n\n\u26a0\ufe0f **Never commit your private key to version control!** Use environment variables or a secure `.env` file.\n\n## Output Formats\n\nPurrio supports three output formats controlled by the `--output` flag:\n\n- **TABLE** (default): Human-readable tables with formatted data\n- **JSON**: Raw SDK data for agents/scripts - exactly what Hyperliquid API returns\n- **CSV**: Formatted data for spreadsheets (same as TABLE but comma-separated)\n\n```bash\n# Examples of different output formats\npurrio price BTC # TABLE: $50,000.50\npurrio price BTC --output json # JSON: {\"BTC\": \"50000.5\"}\npurrio price BTC --output csv # CSV: Coin,Price\\nBTC,\"$50,000.50\"\n```\n\n**For Developers**: JSON output always returns raw Hyperliquid SDK data with no transformations - perfect for building tools and agents.\n\n## Commands\n\n### Information Commands\n\n#### `purrio price [COINS...]`\nGet current mid prices for specified coins.\n\n```bash\npurrio price # All coins\npurrio price BTC ETH # Specific coins\npurrio price BTC --output json # Raw SDK data\n```\n\n#### `purrio positions [ADDRESS]`\nGet positions for any wallet address (defaults to configured address).\n\n```bash\npurrio positions 0x1234...\npurrio positions 0x1234... --output json # Raw user_state data\n```\n\n#### `purrio orders [ADDRESS]`\nGet open orders for any wallet address (defaults to configured address).\n\n```bash\npurrio orders 0x1234...\n```\n\n#### `purrio account [ADDRESS]`\nGet account summary including balances and margin.\n\n```bash\npurrio account 0x1234...\n```\n\n#### `purrio funding COIN --hours N`\nGet funding rate history for a coin.\n\n```bash\npurrio funding BTC # Last 24 hours\npurrio funding ETH --hours 48\n```\n\n#### `purrio orderbook COIN --depth N`\nGet L2 orderbook snapshot.\n\n```bash\npurrio orderbook BTC # Default 10 levels\npurrio orderbook ETH --depth 20\n```\n\n#### `purrio fills [ADDRESS]`\nGet recent trade fills for any address (defaults to configured address).\n\n```bash\npurrio fills 0x1234...\n```\n\n#### `purrio meta COIN`\nGet asset metadata including max leverage and decimals.\n\n```bash\npurrio meta BTC\npurrio meta @107 # Query by token ID\n```\n\n#### `purrio asset-ctx [COIN]`\nGet asset metadata with market context (volume, funding, open interest).\n\n```bash\npurrio asset-ctx # All assets\npurrio asset-ctx BTC # Single asset context\npurrio asset-ctx --output json # Raw meta_and_asset_ctxs data\n```\n\n### Position Trading Commands\n\n#### `purrio long COIN LEVERAGE MARGIN`\nOpen a long position with specified leverage and margin.\n\n```bash\npurrio long BTC 5x 1000 # 5x leverage, $1000 margin\npurrio long ETH 10 2000 # 10x leverage, $2000 margin\npurrio long SOL 3x 500 --slippage 2.0 # Custom slippage\n```\n\nOptions:\n- `--slippage`: Maximum slippage percentage (default: 1%)\n\n#### `purrio short COIN LEVERAGE MARGIN`\nOpen a short position with specified leverage and margin.\n\n```bash\npurrio short BTC 3x 1500 # 3x leverage, $1500 margin\npurrio short ETH 5x 1000 # 5x leverage, $1000 margin\npurrio short SOL 2x 800 --slippage 1.5 # Custom slippage\n```\n\nOptions:\n- `--slippage`: Maximum slippage percentage (default: 1%)\n\n#### `purrio close COIN PERCENTAGE`\nClose a percentage of an existing position.\n\n```bash\npurrio close BTC 100% # Close entire BTC position\npurrio close ETH 50% # Close half of ETH position\npurrio close SOL 25 # Close 25% (% symbol optional)\n```\n\n#### `purrio close all PERCENTAGE`\nClose a percentage of all open positions.\n\n```bash\npurrio close all 100% # Close all positions completely\npurrio close all 30% # Take 30% profits on all positions\npurrio close all 50 --slippage 2.0 # Custom slippage\n```\n\nOptions:\n- `--slippage`: Maximum slippage percentage (default: 1%)\n\n### Limit Order Commands\n\n#### `purrio limit long/short COIN LEVERAGE PRICE MARGIN`\nPlace a limit order with leverage and margin.\n\n```bash\npurrio limit long BTC 5x 50000 1000 # Long BTC at $50k, 5x leverage, $1000 margin\npurrio limit short ETH 3x 3000 2000 # Short ETH at $3k, 3x leverage, $2000 margin\npurrio limit long SOL 10x 100 500 --tif Ioc --reduce-only\n```\n\nOptions:\n- `--tif`: Time in force (Gtc, Ioc, Alo)\n- `--reduce-only`: Reduce-only order\n\n#### `purrio limit cancel COIN ORDER_ID`\nCancel an open order.\n\n```bash\npurrio limit cancel BTC 12345 # Cancel specific order\npurrio limit cancel BTC --all # Cancel all BTC orders\n```\n\n### Configuration Commands\n\n#### `purrio config show`\nDisplay current configuration.\n\n```bash\npurrio config show\npurrio config show --output json\n```\n\n#### `purrio version`\nShow CLI version.\n\n```bash\npurrio version\n```\n\n## Performance & Caching\n\nPurrio includes intelligent caching to optimize performance:\n\n### Asset Data Caching\n\nAsset information (max leverage, decimals, names) is cached locally to avoid redundant API calls:\n\n```bash\n# Instant lookups using cached data\npurrio asset ETH # Shows max leverage, decimals\npurrio asset @107 # Resolves token ID to name (ALT)\n\n# Refresh asset cache when needed\npurrio-refresh-assets # Updates cached asset data\n```\n\n### Performance Benefits\n\n- **Asset info lookups**: 100-1000x faster (cached vs API)\n- **Leverage validation**: Instant for known assets\n- **Token name resolution**: Instant for @ tokens\n- **Commands affected**: `info asset`, leverage validation, @ token display\n\n### Cache Management\n\nThe cache is automatically used but can be refreshed:\n\n```bash\n# Refresh cache (run occasionally)\npoetry run purrio-refresh-assets\n\n# Or manually\npython scripts/refresh_assets.py\n```\n\nCache files are stored in `src/purrio/constants/assets.py` and include both mainnet and testnet data.\n\n## Agent Integration\n\nPurrio is designed for programmatic use by agents and scripts:\n\n### Python Example\n\n```python\nimport subprocess\nimport json\n\n# Get prices programmatically\nresult = subprocess.run(\n [\"purrio\", \"--output\", \"json\", \"price\", \"BTC\"],\n capture_output=True,\n text=True\n)\ndata = json.loads(result.stdout)\nbtc_price = data[\"BTC\"]\nprint(f\"BTC Price: ${btc_price:,.2f}\")\n\n# Check positions\nresult = subprocess.run(\n [\"purrio\", \"--output\", \"json\", \"positions\", \"0x...\"],\n capture_output=True,\n text=True\n)\npositions = json.loads(result.stdout)\n```\n\n### Shell Script Example\n\n```bash\n#!/bin/bash\n\n# Get BTC price\nBTC_PRICE=$(purrio --output json price BTC | jq '.BTC')\necho \"Current BTC price: $BTC_PRICE\"\n\n# Check if price is above threshold\nif (( $(echo \"$BTC_PRICE > 50000\" | bc -l) )); then\n echo \"BTC is above $50,000\"\nfi\n```\n\n### Design Principles for Agents\n\n1. **No Interactive Prompts**: All input via flags/arguments\n2. **Structured Output**: Consistent JSON schema\n3. **Predictable Errors**: Clear error codes and messages\n4. **Exit Codes**: 0 for success, 1 for error\n5. **Idempotent Operations**: Safe for retry logic\n\n## Output Formats\n\n### Table (Default)\nHuman-readable format with Rich formatting:\n\n```\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Coin \u2503 Price \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 BTC \u2502 $50,000.00 \u2502\n\u2502 ETH \u2502 $3,000.00 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n### JSON\nMachine-readable format for scripts:\n\n```json\n{\n \"BTC\": 50000.0,\n \"ETH\": 3000.0\n}\n```\n\n### CSV\nSpreadsheet-compatible format:\n\n```csv\nCoin,Price\nBTC,50000.0\nETH,3000.0\n```\n\n## Development\n\n### Project Structure\n\n```\nsrc/purrio/\n\u251c\u2500\u2500 cli.py # Main application entry point\n\u251c\u2500\u2500 commands/ # Command modules\n\u2502 \u251c\u2500\u2500 base.py # Shared decorators and utilities\n\u2502 \u251c\u2500\u2500 market.py # Market operations (long, short, close)\n\u2502 \u251c\u2500\u2500 orders.py # Limit orders and cancellation\n\u2502 \u251c\u2500\u2500 query.py # Account queries (positions, orders, fills)\n\u2502 \u251c\u2500\u2500 data.py # Market data (prices, funding, orderbook)\n\u2502 \u2514\u2500\u2500 config.py # Configuration commands\n\u251c\u2500\u2500 client.py # Hyperliquid SDK wrapper\n\u251c\u2500\u2500 config.py # Configuration management (Pydantic models)\n\u251c\u2500\u2500 constants/ # Static data\n\u2502 \u2514\u2500\u2500 assets.py # Cached asset information\n\u251c\u2500\u2500 context.py # Application context\n\u251c\u2500\u2500 output.py # Output formatting (table/json/csv)\n\u251c\u2500\u2500 types.py # Type definitions\n\u2514\u2500\u2500 utils.py # Shared utilities\n```\n\n### Setup\n\n```bash\n# Clone repository\ngit clone https://github.com/purrio/purrio-cli.git\ncd purrio-cli\n\n# Install dependencies\npoetry install\n\n# Install pre-commit hooks\npre-commit install\n```\n\n### Testing\n\n```bash\n# Run tests\npoetry run pytest\n\n# Run with coverage\npoetry run pytest --cov\n\n# Run specific test\npoetry run pytest tests/test_config.py\n```\n\n### Code Quality\n\n```bash\n# Format code\npoetry run ruff format\n\n# Lint code\npoetry run ruff check --fix\n\n# Type checking\npoetry run mypy src/\n```\n\n## Known Issues\n\n1. **Python 3.11+ Compatibility**: The `parsimonious` library (dependency of eth-abi) has issues with Python 3.11+. Currently recommended to use Python 3.10.\n\n## Support\n\n- GitHub Issues: [github.com/purrio/purrio-cli/issues](https://github.com/purrio/purrio-cli/issues)\n- Documentation: [docs.purrio.io](https://docs.purrio.io)\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Disclaimer\n\nThis software is provided \"as is\" without warranty of any kind. Trading cryptocurrencies carries risk. Always verify orders and positions through official Hyperliquid interfaces.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CLI wrapper for Hyperliquid's Python SDK - agent-first design for traders and bots",
"version": "0.1.2",
"project_urls": null,
"split_keywords": [
"hyperliquid",
" trading",
" cli",
" defi",
" cryptocurrency"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4ffc5653bc8eccaf847276674576cf1776833ca3580cc3cb0fcb9928cdfebfc7",
"md5": "5df162abd5b9225235576f2380478a06",
"sha256": "170debed5f5d9a57bc4d84f3811cf2f42992d99f46063af25f47bc6ec94f1308"
},
"downloads": -1,
"filename": "purrio-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5df162abd5b9225235576f2380478a06",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 33595,
"upload_time": "2025-08-16T22:47:03",
"upload_time_iso_8601": "2025-08-16T22:47:03.996027Z",
"url": "https://files.pythonhosted.org/packages/4f/fc/5653bc8eccaf847276674576cf1776833ca3580cc3cb0fcb9928cdfebfc7/purrio-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5f15f8c8d419f81be3eb9d428f3d3f64645639a14f47fd312dcc8ec802cc42e3",
"md5": "e12502551c2508246bb774333537a8a3",
"sha256": "72c3f78d764b26d8d6355b7599ddd040dee7ad153f662423e0380dc59aa0966c"
},
"downloads": -1,
"filename": "purrio-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "e12502551c2508246bb774333537a8a3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 32081,
"upload_time": "2025-08-16T22:47:05",
"upload_time_iso_8601": "2025-08-16T22:47:05.449024Z",
"url": "https://files.pythonhosted.org/packages/5f/15/f8c8d419f81be3eb9d428f3d3f64645639a14f47fd312dcc8ec802cc42e3/purrio-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-16 22:47:05",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "purrio"
}