API Reference¶
This section documents the public Python API of the Almanak SDK.
Import Cheat Sheet¶
# Top-level exports (most common)
from almanak import (
Almanak,
Chain, Network, Protocol, ActionType,
IntentStrategy, MarketSnapshot,
SwapIntent, HoldIntent, LPOpenIntent, LPCloseIntent,
BorrowIntent, RepayIntent,
StateManager, RiskGuard,
BacktestMetrics, BacktestResult,
)
# Deep imports for specific functionality
from almanak.framework.strategies import IntentStrategy, StrategyBase
from almanak.framework.intents import SwapIntent, IntentCompiler
from almanak.framework.state import StateManager
from almanak.framework.execution import ExecutionOrchestrator
from almanak.framework.data import MarketSnapshot
from almanak.framework.data.tokens import get_token_resolver, TokenResolver
# Backtesting
from almanak.framework.backtesting import PnLBacktester, PnLBacktestConfig
# Logging
from almanak.framework.utils.logging import configure_logging, get_logger
Module Overview¶
| Module | Description |
|---|---|
| Client | Almanak SDK client for platform API access |
| Enums | Chain, Network, Protocol, ActionType, and more |
| Strategies | IntentStrategy, StrategyBase, MarketSnapshot |
| Intents | SwapIntent, LPOpenIntent, HoldIntent, and all intent types |
| Compiler | IntentCompiler - compiles intents to transactions |
| State | StateManager - persistence and migrations |
| Execution | ExecutionOrchestrator - transaction execution pipeline |
| Data | PriceOracle, BalanceProvider, MarketSnapshot |
| Tokens | TokenResolver - unified token resolution |
| Indicators | RSI, MACD, Bollinger Bands, and more |
| Connectors | Protocol adapters (Uniswap, Aave, Morpho, etc.) |
| Services | StuckDetector, EmergencyManager |
| Alerting | AlertManager, Slack/Telegram channels |
| Backtesting | PnLBacktester, PaperTrader, parameter sweeps |
| Deployment | CanaryDeployment |
| Logging | configure_logging, get_logger |