Skip to main content

A powerful Python SDK for developing and deploying autonomous DeFi agents. Features agent-based modeling, state machine architecture, and non-custodial execution through Safe smart accounts

Project description

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, Polymarket, Kraken, and more
  • Non-Custodial Design: Full control over your funds through Safe smart accounts

Installation

pipx install almanak

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, Balancer
  • Lending: Aave V3, Morpho Blue, Compound V3, Spark
  • Liquid Staking: Lido, Ethena
  • Yield: Pendle
  • Perpetuals: GMX V2, Hyperliquid
  • Prediction Markets: Polymarket
  • CEX Integration: Kraken
  • Aggregators: Enso, LiFi

Contributing

See the Contributing Guide to get started.

Documentation

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

Support

Project details


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

Uploaded Python 3Windows x86-64

almanak-2.14.0-py3-none-manylinux_2_17_x86_64.whl (45.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

almanak-2.14.0-py3-none-manylinux_2_17_aarch64.whl (45.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

almanak-2.14.0-py3-none-macosx_11_0_x86_64.whl (32.3 MB view details)

Uploaded Python 3macOS 11.0+ x86-64

almanak-2.14.0-py3-none-macosx_11_0_arm64.whl (29.7 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: almanak-2.14.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 48.9 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.14.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 11fd3f99af3e1cb86a31609d79cc0930a81fd53050cfa68e5b6ce674cdca1d1e
MD5 8b4a5f38bbdc5e0ad4269ade7fa1d91d
BLAKE2b-256 e219f7c7af8f333b6e2cb6d001a329fac943ccbc7526f2b441e8f7e89208fb4b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.14.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5241217b979964ece0ffbee620c451771619129d06c14f6e758dfc194f19576b
MD5 ac3c297c3849f9688dce797ae059179c
BLAKE2b-256 f9c640a545dcc11bae1290a424386dab4041cdd174ba8b0b30ddcd1930a49b59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.14.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 e5bfd310a27fae6541f129ac87f06ee49ee2a508923fd1370a79dbce97781ab7
MD5 8d89596bb1212f66870d672a20e5c649
BLAKE2b-256 1aca84a806c1a6253ad60b29d3e988708491f312ebbe2f3f77d76bca1475e5da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.14.0-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 8b2820c6919e7c8f41ee57bad7e1354a6c9586701178f2f0e797d5df6c03ef3d
MD5 f9661eb50874f131fc328b9c5fd508c4
BLAKE2b-256 208bb28fad6aa87f97b1424369aeffd6f8c3b6ecc3fdbe0f100ed39e65297698

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.14.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5c9ae796633a2e2a1e08d7ae012f56170a211927b2b5558bb33360a730c3b932
MD5 36d4461169b41d080594f44676da4b38
BLAKE2b-256 f9226ba5bb6df6fe734a99e55677c8c3f488c14a443d1872f7c0cd7d8e3472ec

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