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.23.0-py3-none-win_amd64.whl (49.2 MB view details)

Uploaded Python 3Windows x86-64

almanak-2.23.0-py3-none-manylinux_2_17_x86_64.whl (46.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

almanak-2.23.0-py3-none-manylinux_2_17_aarch64.whl (46.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

almanak-2.23.0-py3-none-macosx_11_0_x86_64.whl (37.3 MB view details)

Uploaded Python 3macOS 11.0+ x86-64

almanak-2.23.0-py3-none-macosx_11_0_arm64.whl (34.8 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: almanak-2.23.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 49.2 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.23.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 8a694fe13fe3cc68e025b99e0bc2ed7e40727816c41e3aa062a4500368bb8dba
MD5 1e261788c4798adf2803dd0012bbae58
BLAKE2b-256 2376eec82aeece0060c6005e3b05ebe16a2a0037fdaa30ea5139bdde4d98cc8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.23.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 56b1c4210cf09e80b3a08691cde3999a881806118f49ea99435e5e6e27c5ccf8
MD5 c849c326d6c7e34067b87d8184dd1f18
BLAKE2b-256 e5290123348195f2a350249679a74678b5ed4351e495bbcc61837bcf8d62c87d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.23.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 52d9d46d923cc21b99720469ed63170b2e2adea9d2e64d8f173fb28c2129a5f1
MD5 eb88381592e40728a8345ffbba7bd3b4
BLAKE2b-256 4289a7fa5c21dec0a5f0eadbe9db8e325540a65f4365263f5580d92056a8fae0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.23.0-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 8aabeafdc5e006f9088a118fcf8a998c0d356847c6187289b5e78525c396f452
MD5 c3a3452e8dab2f00633ff61a18bd5686
BLAKE2b-256 23700acc7a2cf1936f51cf8728fe333bf2f3b8573d52639e9f6c12218c7678b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.23.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a1fce4978a3c24567b21e2c333430013490b72d308efc38be3a84b2b38d8cddc
MD5 a3b5ee9972a7ad56507ad79e23f1b274
BLAKE2b-256 210851d8c86cbe3b266f11fcc7bb2d50547973267e8cfbd0612f65c2487d91fe

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