Skip to main content

Almanak SDK

PyPI version

The Almanak SDK is a powerful Python library for developing, testing, and deploying autonomous DeFi agents. Built on an intent-based architecture, it provides a comprehensive framework for creating sophisticated trading strategies with minimal boilerplate.

Features

  • Intent-Based Architecture: Express trading logic as high-level intents (Swap, LP, Borrow, etc.) - the framework handles compilation and execution
  • Gateway Security: All external access mediated through secure gRPC gateway
  • Three-Tier State Management: Automatic persistence with HOT/WARM/COLD tiers
  • Comprehensive Backtesting: PnL simulation, paper trading on Anvil forks, and parameter sweeps
  • Multi-Chain Support: Ethereum, Arbitrum, Optimism, Base, Avalanche, Polygon, BSC, Sonic, Blast, Mantle, Berachain
  • Protocol Integration: Uniswap V3, Aave V3, Morpho Blue, GMX V2, Lido, Ethena, Kraken, and more
  • Non-Custodial Design: Full control over your funds through Safe smart accounts

Installation

pipx install almanak

Optional features ship as extras:

pipx install 'almanak[dashboard,backtest]'   # web dashboard + backtest charts/optimization
Extra Enables
dashboard almanak dashboard and the strategy/backtest web dashboards (streamlit, plotly)
backtest backtest chart export and almanak strat backtest optimize (matplotlib, plotly, optuna)
code Python LSP for almanak code (pyright)

Using an AI coding agent? Teach it the SDK in one command:

almanak agent install

Auto-detects your platform (Claude Code, Codex, Cursor, Copilot, and 6 more) and installs the strategy builder skill.

Quick Start

  1. Create a New Strategy (scaffolds a self-contained Python project with pyproject.toml, .venv/, uv.lock)

    almanak strat new
    
  2. Test on a Local Anvil Fork

    cd my_strategy
    uv run almanak strat run --network anvil --once
    

Writing a Strategy

Strategies use an intent-based architecture. Implement the decide() method to return an intent:

from almanak import IntentStrategy, SwapIntent, HoldIntent, MarketSnapshot

class MyStrategy(IntentStrategy):
    def decide(self, market: MarketSnapshot) -> Intent:
        eth_price = market.prices.get("ETH")
        usdc_balance = market.balances.get("USDC")

        if eth_price < 2000 and usdc_balance > 1000:
            return SwapIntent(
                token_in="USDC",
                token_out="ETH",
                amount=1000,
                slippage=0.005,
            )
        return HoldIntent(reason="Waiting for better conditions")

Supported Networks

Ethereum, Arbitrum, Optimism, Base, Avalanche, Polygon, BSC, Sonic, Plasma, Blast, Mantle, Berachain

Supported Protocols

  • DEXs: Uniswap V3, SushiSwap V3, PancakeSwap V3, TraderJoe V2, Aerodrome, Curve
  • Lending: Aave V3, Morpho Blue, Compound V3, Spark
  • Liquid Staking: Lido, Ethena
  • Yield: Pendle
  • Perpetuals: GMX V2, Hyperliquid
  • CEX Integration: Kraken
  • Aggregators: Enso, LiFi

Pending testing: Prediction Markets (Polymarket) and Flash loans are undergoing further validation and are temporarily withheld from the supported matrix (almanak info matrix). Treat them as experimental.

Contributing

See the Contributing Guide to get started.

Documentation

For detailed documentation, visit sdk.docs.almanak.co

Support

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

almanak-2.24.0-py3-none-win_amd64.whl (49.3 MB view details)

Uploaded Python 3Windows x86-64

almanak-2.24.0-py3-none-manylinux_2_17_x86_64.whl (47.0 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

almanak-2.24.0-py3-none-manylinux_2_17_aarch64.whl (46.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

almanak-2.24.0-py3-none-macosx_11_0_x86_64.whl (37.5 MB view details)

Uploaded Python 3macOS 11.0+ x86-64

almanak-2.24.0-py3-none-macosx_11_0_arm64.whl (35.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file almanak-2.24.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: almanak-2.24.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 49.3 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.13

File hashes

Hashes for almanak-2.24.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 8534502c96c0833afd8388fd34dd7b8e481698145d699ca9e8e364d0fe718f22
MD5 e799e25e06088220b34658549e83824e
BLAKE2b-256 59e58c5f4418e0582d34bc3984e9aa39802d09d77df3cd260328b362233a96d6

See more details on using hashes here.

File details

Details for the file almanak-2.24.0-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for almanak-2.24.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 25af76c9bcdaca60e596f68cfbce2d8cb876f8c37b24d87944eabfad90f237af
MD5 27d30d5dd51ee26a071397326c339da8
BLAKE2b-256 1a6d5571ee40b0aab85341468673d4a1e8015f78074df875c54c3caf803a094a

See more details on using hashes here.

File details

Details for the file almanak-2.24.0-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for almanak-2.24.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 ff7018aa54b48e2e69be00cf8b714dd96641e3aa4d0677ef484c72b7b195da39
MD5 2e968f377470c921fe6d595b72c71353
BLAKE2b-256 342ce35ae577c79c91c2c661e174c6a550669a7e83db981650bf893296a36251

See more details on using hashes here.

File details

Details for the file almanak-2.24.0-py3-none-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for almanak-2.24.0-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 6beeedf2f3424c17e3b2111f1765475eb10490ffe8dad0ef02427beb57bdfe67
MD5 505b41ee260d401a069176648d7eb78e
BLAKE2b-256 2f6d2f0bef310ca3aaf9407d8feff84bd996cf8748bf8165677105177052bbcf

See more details on using hashes here.

File details

Details for the file almanak-2.24.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for almanak-2.24.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 97e03830fbc28408b125ae8ba45eeb5473a27cc26c4f84a7b024d781db6442b9
MD5 37d8de3d00f4a1f662b7ed8d77b656c3
BLAKE2b-256 f37a0b68b950c1533275780a4dfe27abdba7b410f7b328a009bd53cb574f65d7

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 Sentry Error logging StatusPage Status page