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

Uploaded Python 3Windows x86-64

almanak-2.17.0-py3-none-manylinux_2_17_x86_64.whl (45.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

almanak-2.17.0-py3-none-manylinux_2_17_aarch64.whl (45.0 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

almanak-2.17.0-py3-none-macosx_11_0_x86_64.whl (35.8 MB view details)

Uploaded Python 3macOS 11.0+ x86-64

almanak-2.17.0-py3-none-macosx_11_0_arm64.whl (33.3 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: almanak-2.17.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 47.7 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.17.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 1e6cae289f75297cdb3cba2ce59a4fed63fddeda983840745034271931450a07
MD5 80d9136e6a23c6b338566a88f61a0a42
BLAKE2b-256 bcc2b756298ace6920dfdfa19f5cb5f9e31b4cbc3399f82f3e067661b4c66aa9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.17.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 91424a0b256c86ca842f4b4e6e95becf222927a48cd76f47122e1934fcbc518d
MD5 de4af6f5480886c01b30d2b6cd96486c
BLAKE2b-256 dbe94f68496cdef058ad00dae8650a5c1a5a5419ebb207b79eff616ab761bc42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.17.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 9a05afcae681f94d6a488acd6c64959d5179404aecb5e47f4b36353b9c9c040e
MD5 7ebd9e597919364974a2764472a267a1
BLAKE2b-256 ceac7d19eb66dc04bdaf4fef035452c32a44ce7666b27bab0ae3c42ee02a8118

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.17.0-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 ed1cd7e6f8609d74b04796ecde59eb5bfddb15cb0739b963992f464adac5d9fc
MD5 4b6b5663acbdf31decec6da0897b89c1
BLAKE2b-256 73603a77e4a297692217987ea92a9385f04b73eca7935ed169a08709f29e8c8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.17.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b781dbab4e905120f1dce0f971a4805a8b15520abc4b10d08d3486dc697a6797
MD5 15d4c2beb0c28de33a7721fa1b245d66
BLAKE2b-256 500a729ebb86de2a56fdde0e4bb076577d83c72151ae9812f9972f74ffc27d54

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