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

Uploaded Python 3Windows x86-64

almanak-2.22.0-py3-none-manylinux_2_17_x86_64.whl (46.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ x86-64

almanak-2.22.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.22.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: almanak-2.22.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 49.1 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.22.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 30a24ec2721b941e96d02605c0db6fdf2811c3d1e1bc3af6134ad7d9e07d27bf
MD5 ec55eb8b808660673616ced6e8cc814c
BLAKE2b-256 a3265d073cfa63bc3f1269f44a6d9e90baf4703eafcd720cab661441604c2c26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.22.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fb57d875d132e3fcc7232f7e2720a385e77726344f26b90c2939c1b91abfedaf
MD5 031de90e68cb82cc66b23fdd7be013da
BLAKE2b-256 24f96205dbce9e9788ae0562db6e7ad7dee7debc67b63cc6375200f8b4071e2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.22.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 30be5ce67756013ba599a541880ccfa83dfc998b461e553204e9c7f8eb9eee9c
MD5 a7b84c4b436728780682de3cfaa9bd02
BLAKE2b-256 fb8f35eeac5cdfda78581360fe2d290b018238786fdd7e841d36ac0d31cbae01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.22.0-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 0bbc06139a30a3f4680627d4cee4fab2770e3a43d3f9fc54d519f4caf0915c62
MD5 2763bd0f4acdf929cfe3396eb80f6248
BLAKE2b-256 abaeeb08afe1f3c523ff3c553d040b4a5aa675c980ac1467013c8da3fa249b87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.22.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ceab19cd27d7421bb0d20e2ef83d6985a616f80c75c5a88a77d89207e2de74c
MD5 906040cb97f76e74bd328556336b8be8
BLAKE2b-256 4dc42c58e05191e31e284ee1ea3135bd5ce7e60cc1ce1b2f4d14d4775f108520

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