Skip to main content

Official Python SDK for ArkForge DeFi portfolio management

Project description

ArkForge Python SDK

Python client for ArkForge DeFi portfolio management API.

PyPI version Python Version

Installation

pip install arkforge

Requirements

  • Python 3.8+
  • Valid ArkForge API key

Usage

from arkforge import ArkForgeClient
from arkforge.models import OptimizePortfolioRequest

client = ArkForgeClient(api_key="sk-arkforge-...")

result = client.optimize_portfolio(
    OptimizePortfolioRequest(
        assets=["BTC", "ETH", "SOL"],
        risk_profile="moderate"
    )
)

print(result.allocation)

Configuration

client = ArkForgeClient(
    api_key="sk-arkforge-...",
    base_url="https://api.arkforge.io",
    timeout=120,
    retry_attempts=5
)

Environment variables:

  • ARKFORGE_API_KEY - API key
  • ARKFORGE_BASE_URL - API base URL (default: http://localhost:3001)

API Methods

ArkForgeClient:

  • optimize_portfolio(request) - Optimize portfolio allocation (live or backtest mode)
  • optimize_portfolio_async(request) - Async version
  • get_risk_profiles() - Get available risk profiles
  • health() - Check service health

KeyManagementClient:

  • create_key(request) - Create API key
  • list_keys() - List API keys
  • get_key_details(key_id) - Get key details
  • revoke_key(key_id, reason) - Revoke API key
  • rotate_key(key_id, name) - Rotate API key

Backtesting

The SDK supports backtesting by providing historical price data. The API automatically enters backtest mode when historical_data is provided.

from arkforge import ArkForgeClient, OptimizePortfolioRequest

client = ArkForgeClient(api_key="sk-arkforge-...")

# Prepare historical data (90+ days per asset)
historical_data = [
    {"symbol": "BTC", "timestamp": "2024-01-01T00:00:00Z", "price": 42350.50},
    {"symbol": "BTC", "timestamp": "2024-01-02T00:00:00Z", "price": 43120.75},
    # ... 90+ days of data per asset
]

# Optional: Historical sentiment data
historical_sentiment = [
    {
        "asset": "BTC",
        "timestamp": "2024-01-15T00:00:00Z",
        "score": 0.37,
        "category": "bullish",
        "confidence": 0.82
    }
]

# Same request interface, just add historical data
request = OptimizePortfolioRequest(
    assets=["BTC", "ETH", "SOL"],
    risk_profile="moderate",
    historical_data=historical_data,
    historical_sentiment=historical_sentiment  # Optional
)

result = client.optimize_portfolio(request)

See examples/backtesting_example.py for a complete example.

Development

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Type checking
mypy arkforge

# Linting
ruff check arkforge

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

arkforge-0.0.4.tar.gz (78.2 kB view details)

Uploaded Source

Built Distribution

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

arkforge-0.0.4-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file arkforge-0.0.4.tar.gz.

File metadata

  • Download URL: arkforge-0.0.4.tar.gz
  • Upload date:
  • Size: 78.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arkforge-0.0.4.tar.gz
Algorithm Hash digest
SHA256 056b43f15ab1cdfeec22fc892cf1c9dbf9c98a54c2ae935e474225e4493e3a80
MD5 7fc5d1546e597de71833ade90d30e8f6
BLAKE2b-256 8419531fc5efe04aa9dbfa1a273792537a79626dbf372efcb27be5e7988500d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for arkforge-0.0.4.tar.gz:

Publisher: publish.yml on Arkonix-finance/ArkForge-SDK-PY

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arkforge-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: arkforge-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arkforge-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 37233f8df72711e66cdf644a3a88633bdd8198c6b0950ccc5b5ae0929be9cd96
MD5 8878cef0e14aec9481e83338504cf5bf
BLAKE2b-256 9d34ad9dad2f40f437c9dbc7b4c1a68189de9cc7cfd948be4b3f943457102be9

See more details on using hashes here.

Provenance

The following attestation bundles were made for arkforge-0.0.4-py3-none-any.whl:

Publisher: publish.yml on Arkonix-finance/ArkForge-SDK-PY

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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