Skip to main content

Official Vezgo Python SDK for Cryptocurrency Data API

Project description

Vezgo Python SDK

Official Python SDK for the Vezgo Cryptocurrency API.

What is Vezgo?

Vezgo is a unified cryptocurrency API that allows you to connect with cryptocurrency exchanges, wallets, and blockchain protocols. Instead of manually integrating with multiple exchange APIs like Coinbase, Binance, or blockchain APIs - you can simply use Vezgo for them all.

Features

  • 🔐 Secure Authentication - JWT-based token authentication
  • 📊 Account Data - Retrieve balances, positions, and wallet information
  • 💸 Transaction History - Full transaction history across all connected accounts
  • 📈 Balance History - Historical balance tracking over time
  • 📋 Order History - Trading order history from exchanges
  • 🏢 40+ Exchanges - Support for major cryptocurrency exchanges
  • ⛓️ 20+ Blockchains - Direct blockchain integrations
  • 👛 250+ Wallets - Wallet connection support

Installation

pip install vezgo

Configuration

Copy the example environment file and add your credentials:

cp env.example .env

Edit .env with your Vezgo API credentials from the Vezgo Dashboard:

VEZGO_CLIENT_ID=your_client_id_here
VEZGO_CLIENT_SECRET=your_client_secret_here

Quick Start

from vezgo import Vezgo

# Initialize the client with your API credentials
vezgo = Vezgo(
    client_id="your_client_id",
    secret="your_secret"
)

# Get list of supported providers (no user login required)
providers = vezgo.providers.get_list()
print(f"Vezgo supports {len(providers)} providers")

# Get team information
team = vezgo.get_team()
print(f"Team: {team['name']}")

User Authentication

To access user-specific data like accounts and transactions, you need to login as a user:

from vezgo import Vezgo

vezgo = Vezgo(
    client_id="your_client_id",
    secret="your_secret"
)

# Login as a specific user (use your internal user ID)
user = vezgo.login("user_123")

# Now you can access user-specific resources
accounts = user.accounts.get_list()
for account in accounts:
    print(f"Account: {account['provider']['display_name']}")
    for balance in account.get('balances', []):
        print(f"  {balance['ticker']}: {balance['amount']}")

API Reference

Provider APIs

These APIs don't require user authentication:

Get All Providers

providers = vezgo.providers.get_list()

# Each provider includes:
# - name: unique identifier
# - display_name: human-friendly name
# - auth_type: oauth, password, token, or wallet
# - credentials: required credential types
# - features: supported features (positions, transactions, nfts, etc.)

Get a Specific Provider

coinbase = vezgo.providers.get_one("coinbase")
print(f"Auth type: {coinbase['auth_type']}")
print(f"Credentials: {coinbase['credentials']}")

Account APIs

These APIs require user authentication:

List All Accounts

user = vezgo.login("user_123")
accounts = user.accounts.get_list()

for account in accounts:
    print(f"ID: {account['id']}")
    print(f"Provider: {account['provider']['display_name']}")
    print(f"Status: {account['status']}")
    print(f"Total Value: ${account.get('fiat_value', '0')}")

Get a Specific Account

account = user.accounts.get_one("603522490d2b02001233a5d6")

Sync an Account

Trigger a refresh to fetch the latest data from the provider:

account = user.accounts.sync("603522490d2b02001233a5d6")
print(f"Sync status: {account['status']}")

Remove an Account

user.accounts.remove("603522490d2b02001233a5d6")

Transaction APIs

List Transactions

user = vezgo.login("user_123")

# Get all transactions for an account
transactions = user.transactions.get_list(
    account_id="603522490d2b02001233a5d6"
)

# With filters
transactions = user.transactions.get_list(
    account_id="603522490d2b02001233a5d6",
    ticker="BTC",                    # Filter by asset
    from_date="2024-01-01",          # Start date
    to_date="2024-06-30",            # End date
    types="trade,deposit",           # Filter by type
    sort="desc",                     # Sort order
    limit=100                        # Max results
)

for tx in transactions:
    print(f"Type: {tx['transaction_type']}")
    for part in tx.get('parts', []):
        print(f"  {part['direction']}: {part['amount']} {part['ticker']}")

Get a Specific Transaction

tx = user.transactions.get_one(
    account_id="603522490d2b02001233a5d6",
    tx_id="603522490d2b02001233a5d7"
)

Balance History APIs

Get Balance History

user = vezgo.login("user_123")

history = user.history.get_list(
    account_id="603522490d2b02001233a5d6",
    from_date="2024-01-01",
    to_date="2024-06-30"
)

for entry in history:
    print(f"Date: {entry['date']}, Value: ${entry['fiat_value']}")

Order APIs

List Orders

user = vezgo.login("user_123")

orders = user.orders.get_list(
    account_id="651538b55e8e333d9c7cdc0d",
    from_date="2024-01-01",
    sort="desc"
)

for order in orders:
    print(f"Order: {order['side']} {order['base_ticker']}/{order['quote_ticker']}")
    print(f"Status: {order['order_status']}")
    print(f"Filled: {order['filled_quantity']} @ {order['average_execution_price']}")

Get a Specific Order

order = user.orders.get_one(
    account_id="603522490d2b02001233a5d6",
    order_id="651538b55e8e333d9c7cdc0d"
)

Error Handling

The SDK provides specific exception classes for different error types:

from vezgo import (
    Vezgo,
    VezgoError,
    VezgoAuthenticationError,
    VezgoAPIError,
    VezgoValidationError,
    VezgoNotFoundError,
    VezgoRateLimitError,
)

try:
    user = vezgo.login("user_123")
    account = user.accounts.get_one("invalid_id")
except VezgoNotFoundError as e:
    print(f"Account not found: {e.message}")
except VezgoAuthenticationError as e:
    print(f"Authentication failed: {e.message}")
except VezgoRateLimitError as e:
    print(f"Rate limit exceeded: {e.message}")
except VezgoAPIError as e:
    print(f"API error [{e.status_code}]: {e.message}")
except VezgoError as e:
    print(f"Vezgo error: {e.message}")

Context Manager Support

The SDK supports context managers for automatic cleanup:

with Vezgo(client_id="...", secret="...") as vezgo:
    providers = vezgo.providers.get_list()
    # Connection is automatically closed when exiting the block

Configuration Options

vezgo = Vezgo(
    client_id="your_client_id",       # Required
    secret="your_secret",             # Required
    base_url="https://api.vezgo.com/v1",  # Optional, default API URL
    connect_url="https://connect.vezgo.com",  # Optional, Connect widget URL
    timeout=30.0,                     # Optional, request timeout in seconds
)

Connecting Users (Frontend Integration)

To connect user accounts, you'll need to use Vezgo Connect in your frontend. Here's how the flow works:

  1. Backend: Generate a user token
user = vezgo.login("user_123")
token = user.get_token()
# Send this token to your frontend
  1. Frontend: Use the token with Vezgo Connect (JavaScript)
// Use the vezgo-sdk-js package or redirect to Connect URL
const { url, token } = await getConnectDataFromYourBackend();

// Redirect to Vezgo Connect or use the SDK widget
window.location.href = `${url}&token=${token}`;
  1. Backend: Handle the callback to receive the connected account

For full frontend integration, see the JavaScript SDK.

Documentation

Support

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vezgo-1.0.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

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

vezgo-1.0.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file vezgo-1.0.0.tar.gz.

File metadata

  • Download URL: vezgo-1.0.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for vezgo-1.0.0.tar.gz
Algorithm Hash digest
SHA256 412372cb2ddef86bd7ffec8e7143fd8af9e569abaa9838167419b50dd718e5fb
MD5 541c695d0d305978d434403601e597c8
BLAKE2b-256 66bb5e7019d61a42145185182e85983cc5ea20221a33dc80f3a6f267d31fdd92

See more details on using hashes here.

File details

Details for the file vezgo-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: vezgo-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for vezgo-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c54d9c4876d517acce0e9650cf5d85f9654d3f03cd080454665018c27b0b10
MD5 b798d4b8f97e2da4f501a92a09e63fd9
BLAKE2b-256 a20c1ed2277e57b5153e855ad5f566c168d875d5c91b5cc852da5fb2b9767ddd

See more details on using hashes here.

Supported by

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