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

Uploaded Python 3Windows x86-64

almanak-2.25.0-py3-none-manylinux_2_17_x86_64.whl (47.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

almanak-2.25.0-py3-none-manylinux_2_17_aarch64.whl (47.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

almanak-2.25.0-py3-none-macosx_11_0_x86_64.whl (38.3 MB view details)

Uploaded Python 3macOS 11.0+ x86-64

almanak-2.25.0-py3-none-macosx_11_0_arm64.whl (35.8 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: almanak-2.25.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 50.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.25.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 d41b0782f4a0a143c222faf568c65543fc6f81300c7a1fba0944f64bb304ca84
MD5 4c99ee567b61bc208799cf6a71cb0d28
BLAKE2b-256 be57dfaa5762c6ec1fe68a1320ec201cc6dcdea962b8e19cbac90b56d3ad1ec2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.25.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fe923e1b73f1964dc54787b53551dc3b0e96a0b5eb3034cac315ec408da76de3
MD5 c6caf44bf8be6ccfc443e0b5494329ed
BLAKE2b-256 676d3bd82b8f32d6003c48876179d4174e52a42728f2ed77d2b8dea4955eebc6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.25.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 62be4d6bdbf58c857d2d0c6033737eaf6cd9d9501aae21e7785f21eddc91ad67
MD5 c7ab87c99e70614e10fcd01fe0dfecd1
BLAKE2b-256 d52c6089a7a6ebd5b3376574ce6f1a15dadd988a18e3fecfc3ca68664fff463d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.25.0-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 f7a1d37eff2fcaad5f19c22095b440006e3c60c4ecf8e5048348e0c19f796d90
MD5 87ad0e7d230639d0e7c6bc3ca0a151ca
BLAKE2b-256 79d4accd83f439379668660dbd562a0a1e64e086bda09f7ee4ba5fd95360fd23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.25.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb07a3f60d4a9df4c907abc6dbc95e72f6f6b593449fef32d7f17e06a340ee4f
MD5 b92440807f2a58441b08229e4f13effe
BLAKE2b-256 017b9e9d064101eed70cb743e62c40074f826ceabaff5517aecddd1eaa88f449

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