# dexodus-perps-sdk
Python SDK for Dexodus perpetual futures trading platform on Base.
## Features
- **Position Management**: Open, close, increase, and decrease positions
- **Real-Time Data**: Get positions with live PnL, ROE, and liquidation prices
- **Limit Orders**: Create Take Profit and Stop Loss orders
- **Sponsored Gas**: Free transactions for position management
- **Market Symbols Enum**: Type-safe market selection with IDE autocomplete
- **Debug Mode**: Verbose logging for development and troubleshooting
- **Streamlined Setup**: Minimal configuration required
## Installation
### Prerequisites
This package requires **Node.js 16+** to be installed on your system, as it uses the JavaScript SDK internally.
**Install Node.js:**
- **macOS**: `brew install node` or download from [nodejs.org](https://nodejs.org/)
- **Ubuntu/Debian**: `sudo apt install nodejs npm`
- **Windows**: Download from [nodejs.org](https://nodejs.org/)
**Install Node.js dependencies:**
```bash
npm install @pythnetwork/hermes-client @biconomy/account ethers dotenv
```
### Install Python Package
```bash
pip install dexodus-perps-sdk
```
## Quick Start
```python
from dexodus_perps_sdk import DexodusClient, MarketSymbols
# Initialize client (only private key required!)
client = DexodusClient.create(
debug=False # Optional: Set to True for verbose logging
)
# Open a long position
result = client.open_long(
market=MarketSymbols.BTC,
size=50.0, # $50 position
collateral=10.0, # $10 collateral (5x leverage)
slippage=0.5 # 0.5% slippage
)
print(f"Position opened! TX: {result['transactionHash']}")
```
## Configuration
The SDK requires only your private key for authentication. All network and contract configurations are pre-configured for the Base mainnet.
Set up your environment variables in a `.env` file:
```bash
# Required
PRIVATE_KEY=your_private_key_here
# Optional
DEBUG=false
```
**Network Configuration:**
- Network: Base mainnet (Chain ID: 8453)
- Gas Sponsorship: Enabled for position operations
- Contract Integration: Fully configured for Dexodus protocol
## API Reference
### Client Initialization
```python
# Initialize with private key
client = DexodusClient.create(
private_key="your_private_key", # Optional: uses PRIVATE_KEY env var if not provided
debug=False # Optional: Enable verbose logging
)
# Initialize using environment variable
client = DexodusClient.create() # Uses PRIVATE_KEY from .env
```
### Position Management
```python
# Open positions
client.open_long(market=MarketSymbols.BTC, size=50, collateral=10, slippage=0.5)
client.open_short(market=MarketSymbols.ETH, size=30, collateral=10, slippage=0.5)
# Modify positions
client.increase_position(market=MarketSymbols.BTC, is_long=True, size_delta=25, slippage=0.5)
client.decrease_position(market=MarketSymbols.BTC, is_long=True, size_delta=30, slippage=0.5)
# Get positions with real-time data
positions = client.get_positions()
for pos in positions:
print(f"{pos['marketName']} {pos['isLong'] and 'Long' or 'Short'}: ${pos['pnl']:.2f} PnL")
```
### Limit Orders
```python
# Take Profit
client.create_take_profit(
market=MarketSymbols.BTC,
is_long=True,
size_to_close=25.0,
limit_price=50000.0,
slippage=0.5
)
# Stop Loss
client.create_stop_loss(
market=MarketSymbols.BTC,
is_long=True,
size_to_close=50.0,
limit_price=40000.0,
slippage=0.5
)
```
### Fund Management
```python
# Deposit/withdraw USDC
client.deposit(100.0) # Deposit $100 USDC
client.withdraw(50.0) # Withdraw $50 USDC
# Check balances
balances = client.get_balances()
print(f"Smart Account: ${balances['smartAccount']} USDC")
```
## Market Symbols
Use the `MarketSymbols` class for type safety:
```python
from dexodus_perps_sdk import MarketSymbols
# Available markets
MarketSymbols.BTC # "BTC"
MarketSymbols.ETH # "ETH"
MarketSymbols.SOL # "SOL"
# ... and more
```
## Gas Fees
- **Position Operations**: FREE (sponsored by protocol)
- **Withdrawals**: Paid in USDC (deducted from withdrawal amount)
- **Deposits**: Standard ETH gas fees
## Testing
Test your installation:
```bash
# Run the built-in test
dexodus-perps-test
# Or in Python
python -c "from dexodus_perps_sdk import MarketSymbols; print('SDK installed correctly!')"
```
## Requirements
- **Python**: 3.7+
- **Node.js**: 16+ (required for JavaScript SDK)
- **Network**: Base network access
- **Funds**: USDC for trading
## Support
- **Documentation**: https://docs.dexodus.com/sdk
- **Issues**: https://github.com/dexodus/perps-sdk-python/issues
- **Discord**: https://discord.gg/dexodus
- **JavaScript SDK**: https://www.npmjs.com/package/dexodus-perps-sdk
## License
MIT
Raw data
{
"_id": null,
"home_page": "https://github.com/dexodus/perps-sdk-python",
"name": "dexodus-perps-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Dexodus Team",
"author_email": "Dexodus Team <dev@dexodus.com>",
"download_url": "https://files.pythonhosted.org/packages/a3/b7/d9f02c49661371c68b2f6276233d3b38cc34e8e97d54ee0f442050dcb86c/dexodus_perps_sdk-1.1.1.tar.gz",
"platform": null,
"description": "# dexodus-perps-sdk\n\nPython SDK for Dexodus perpetual futures trading platform on Base.\n\n## Features\n\n- **Position Management**: Open, close, increase, and decrease positions\n- **Real-Time Data**: Get positions with live PnL, ROE, and liquidation prices\n- **Limit Orders**: Create Take Profit and Stop Loss orders\n- **Sponsored Gas**: Free transactions for position management\n- **Market Symbols Enum**: Type-safe market selection with IDE autocomplete\n- **Debug Mode**: Verbose logging for development and troubleshooting\n- **Streamlined Setup**: Minimal configuration required\n\n## Installation\n\n### Prerequisites\n\nThis package requires **Node.js 16+** to be installed on your system, as it uses the JavaScript SDK internally.\n\n**Install Node.js:**\n- **macOS**: `brew install node` or download from [nodejs.org](https://nodejs.org/)\n- **Ubuntu/Debian**: `sudo apt install nodejs npm`\n- **Windows**: Download from [nodejs.org](https://nodejs.org/)\n\n**Install Node.js dependencies:**\n```bash\nnpm install @pythnetwork/hermes-client @biconomy/account ethers dotenv\n```\n\n### Install Python Package\n\n```bash\npip install dexodus-perps-sdk\n```\n\n## Quick Start\n\n```python\nfrom dexodus_perps_sdk import DexodusClient, MarketSymbols\n\n# Initialize client (only private key required!)\nclient = DexodusClient.create(\n debug=False # Optional: Set to True for verbose logging\n)\n\n# Open a long position\nresult = client.open_long(\n market=MarketSymbols.BTC,\n size=50.0, # $50 position\n collateral=10.0, # $10 collateral (5x leverage)\n slippage=0.5 # 0.5% slippage\n)\n\nprint(f\"Position opened! TX: {result['transactionHash']}\")\n```\n\n## Configuration\n\nThe SDK requires only your private key for authentication. All network and contract configurations are pre-configured for the Base mainnet.\n\nSet up your environment variables in a `.env` file:\n\n```bash\n# Required\nPRIVATE_KEY=your_private_key_here\n\n# Optional\nDEBUG=false\n```\n\n**Network Configuration:**\n- Network: Base mainnet (Chain ID: 8453)\n- Gas Sponsorship: Enabled for position operations\n- Contract Integration: Fully configured for Dexodus protocol\n\n## API Reference\n\n### Client Initialization\n\n```python\n# Initialize with private key\nclient = DexodusClient.create(\n private_key=\"your_private_key\", # Optional: uses PRIVATE_KEY env var if not provided\n debug=False # Optional: Enable verbose logging\n)\n\n# Initialize using environment variable\nclient = DexodusClient.create() # Uses PRIVATE_KEY from .env\n```\n\n### Position Management\n\n```python\n# Open positions\nclient.open_long(market=MarketSymbols.BTC, size=50, collateral=10, slippage=0.5)\nclient.open_short(market=MarketSymbols.ETH, size=30, collateral=10, slippage=0.5)\n\n# Modify positions\nclient.increase_position(market=MarketSymbols.BTC, is_long=True, size_delta=25, slippage=0.5)\nclient.decrease_position(market=MarketSymbols.BTC, is_long=True, size_delta=30, slippage=0.5)\n\n# Get positions with real-time data\npositions = client.get_positions()\nfor pos in positions:\n print(f\"{pos['marketName']} {pos['isLong'] and 'Long' or 'Short'}: ${pos['pnl']:.2f} PnL\")\n```\n\n### Limit Orders\n\n```python\n# Take Profit\nclient.create_take_profit(\n market=MarketSymbols.BTC,\n is_long=True,\n size_to_close=25.0,\n limit_price=50000.0,\n slippage=0.5\n)\n\n# Stop Loss\nclient.create_stop_loss(\n market=MarketSymbols.BTC,\n is_long=True,\n size_to_close=50.0,\n limit_price=40000.0,\n slippage=0.5\n)\n```\n\n### Fund Management\n\n```python\n# Deposit/withdraw USDC\nclient.deposit(100.0) # Deposit $100 USDC\nclient.withdraw(50.0) # Withdraw $50 USDC\n\n# Check balances\nbalances = client.get_balances()\nprint(f\"Smart Account: ${balances['smartAccount']} USDC\")\n```\n\n## Market Symbols\n\nUse the `MarketSymbols` class for type safety:\n\n```python\nfrom dexodus_perps_sdk import MarketSymbols\n\n# Available markets\nMarketSymbols.BTC # \"BTC\"\nMarketSymbols.ETH # \"ETH\"\nMarketSymbols.SOL # \"SOL\"\n# ... and more\n```\n\n## Gas Fees\n\n- **Position Operations**: FREE (sponsored by protocol)\n- **Withdrawals**: Paid in USDC (deducted from withdrawal amount)\n- **Deposits**: Standard ETH gas fees\n\n## Testing\n\nTest your installation:\n\n```bash\n# Run the built-in test\ndexodus-perps-test\n\n# Or in Python\npython -c \"from dexodus_perps_sdk import MarketSymbols; print('SDK installed correctly!')\"\n```\n\n## Requirements\n\n- **Python**: 3.7+\n- **Node.js**: 16+ (required for JavaScript SDK)\n- **Network**: Base network access\n- **Funds**: USDC for trading\n\n## Support\n\n- **Documentation**: https://docs.dexodus.com/sdk\n- **Issues**: https://github.com/dexodus/perps-sdk-python/issues\n- **Discord**: https://discord.gg/dexodus\n- **JavaScript SDK**: https://www.npmjs.com/package/dexodus-perps-sdk\n\n## License\n\nMIT\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python SDK for Dexodus perpetual futures trading platform on Base",
"version": "1.1.1",
"project_urls": {
"Documentation": "https://docs.dexodus.com/sdk",
"Homepage": "https://github.com/dexodus/perps-sdk-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c3722ef8ef9bd65cce0c764147b6063741bc116465ef6267cb6890b7f9bcf64d",
"md5": "81a1dc57c1ef0433e8ffae563aa15543",
"sha256": "d60841ee52525a58af6c8a98adf6b6174df78014fca8aafb363e685a5a6eb22f"
},
"downloads": -1,
"filename": "dexodus_perps_sdk-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "81a1dc57c1ef0433e8ffae563aa15543",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 27538,
"upload_time": "2025-08-04T20:21:36",
"upload_time_iso_8601": "2025-08-04T20:21:36.597186Z",
"url": "https://files.pythonhosted.org/packages/c3/72/2ef8ef9bd65cce0c764147b6063741bc116465ef6267cb6890b7f9bcf64d/dexodus_perps_sdk-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a3b7d9f02c49661371c68b2f6276233d3b38cc34e8e97d54ee0f442050dcb86c",
"md5": "ef087d9ebfda9e7e7e413a6bd58e9d46",
"sha256": "409035fb6e206c50df0cfdf4ed2cfd2eaca3d36b704968a2413d90791a1b7aae"
},
"downloads": -1,
"filename": "dexodus_perps_sdk-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "ef087d9ebfda9e7e7e413a6bd58e9d46",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 26627,
"upload_time": "2025-08-04T20:21:37",
"upload_time_iso_8601": "2025-08-04T20:21:37.538215Z",
"url": "https://files.pythonhosted.org/packages/a3/b7/d9f02c49661371c68b2f6276233d3b38cc34e8e97d54ee0f442050dcb86c/dexodus_perps_sdk-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-04 20:21:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dexodus",
"github_project": "perps-sdk-python",
"github_not_found": true,
"lcname": "dexodus-perps-sdk"
}