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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ x86-64

almanak-2.15.0-py3-none-manylinux_2_17_aarch64.whl (46.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

almanak-2.15.0-py3-none-macosx_11_0_x86_64.whl (33.1 MB view details)

Uploaded Python 3macOS 11.0+ x86-64

almanak-2.15.0-py3-none-macosx_11_0_arm64.whl (30.7 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: almanak-2.15.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 49.6 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.15.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 3cedfd5bb00c2d36a0e31ced1e4d8844e44cbd7951c00f76b4768ad06135f986
MD5 de2860b98026aabf4cd8c9e90ebc2aaf
BLAKE2b-256 f6cfc497e6b11b8658ff9a50bcc72966670d4396f8b3094456ac7affed31d542

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.15.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 79f2d82aeeee537b5295a6f024b075e32c675e33a8b09bd55fdc519b4159fdeb
MD5 51c40b20ecfc77c5b062453d414c1dbd
BLAKE2b-256 63a5a1447369984bbc38c4a5dcac9edf118a467fe8990d79d8f1d1ff3fd2b48a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.15.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 26e3da78eff2c1cc304d632136cde5bef586167879d781a1197c04beeacff340
MD5 d686c63a9f7be81e892fbe5532c76f22
BLAKE2b-256 3247d9439a423f3b7a18b3aa7cbd4a97a7707823786a921fd00e757516002c58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.15.0-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 2557a4506feda4c6153aaf666bbc3ed3e6121aa9684d01de7753b90b72dc9996
MD5 3a4dd238159e1033bcedaf9fc59c81c7
BLAKE2b-256 d65766483b4daa4a756e5fffba7c0580a2acb22f822fe8a3eaa03bc072bf247f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for almanak-2.15.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 771218916c14f81ff901b94a2198d7235f82ae94fdfcb7b4d78ac402fb0d0872
MD5 0c8639cf98f29a721dcf9627c7dd2e00
BLAKE2b-256 dbc0125faa51dff4e42faba989faf63ea3dbec7dfcd0aea6602e57bc76a7cca4

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