Official Python SDK for ArkForge DeFi portfolio management
Project description
ArkForge Python SDK
Python client for ArkForge DeFi portfolio management API.
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 keyARKFORGE_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 versionget_risk_profiles()- Get available risk profileshealth()- Check service health
KeyManagementClient:
create_key(request)- Create API keylist_keys()- List API keysget_key_details(key_id)- Get key detailsrevoke_key(key_id, reason)- Revoke API keyrotate_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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arkforge-0.0.2.tar.gz.
File metadata
- Download URL: arkforge-0.0.2.tar.gz
- Upload date:
- Size: 66.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c16f0b1aee4485c57a1b38498f62e48797e92863913e23224e65e6f35ad388f4
|
|
| MD5 |
0197c6e30cc754812864bcac11a4f6b7
|
|
| BLAKE2b-256 |
b4c50d4a7e3be7b46138ad29df8b1c923c3a958cc06f85d9fedc5fdbf2cd4447
|
Provenance
The following attestation bundles were made for arkforge-0.0.2.tar.gz:
Publisher:
publish.yml on Arkonix-finance/ArkForge-SDK-PY
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arkforge-0.0.2.tar.gz -
Subject digest:
c16f0b1aee4485c57a1b38498f62e48797e92863913e23224e65e6f35ad388f4 - Sigstore transparency entry: 637800281
- Sigstore integration time:
-
Permalink:
Arkonix-finance/ArkForge-SDK-PY@f5606ec7c44d4bb28ef6a8caeae178c60d718c2b -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/Arkonix-finance
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f5606ec7c44d4bb28ef6a8caeae178c60d718c2b -
Trigger Event:
release
-
Statement type:
File details
Details for the file arkforge-0.0.2-py3-none-any.whl.
File metadata
- Download URL: arkforge-0.0.2-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
141a7fce1cc75664d5682c4b0e5de1767c278f71bc062561fb0e94a696d9cb15
|
|
| MD5 |
e156da44356ff931f03882636270bda5
|
|
| BLAKE2b-256 |
f2a20af8d9a9d78145b977d53c57ed693b3850ade9625f866b9990e4541b0eeb
|
Provenance
The following attestation bundles were made for arkforge-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on Arkonix-finance/ArkForge-SDK-PY
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arkforge-0.0.2-py3-none-any.whl -
Subject digest:
141a7fce1cc75664d5682c4b0e5de1767c278f71bc062561fb0e94a696d9cb15 - Sigstore transparency entry: 637800302
- Sigstore integration time:
-
Permalink:
Arkonix-finance/ArkForge-SDK-PY@f5606ec7c44d4bb28ef6a8caeae178c60d718c2b -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/Arkonix-finance
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f5606ec7c44d4bb28ef6a8caeae178c60d718c2b -
Trigger Event:
release
-
Statement type: