Noureddine RAMDI / A composable Python framework for crypto algorithmic trading with functional strategies

Created Sat, 23 May 2026 20:41:14 +0000 Modified Sat, 23 May 2026 20:41:27 +0000

ivopetiz/algotrading

Algorithmic trading frameworks for cryptocurrencies often come with complex strategy patterns that can be hard to compose or extend. The algotrading repository by ivopetiz approaches this challenge differently by treating trading strategies as simple boolean functions. This functional style enables stacking and combining multiple strategies with ease, making it an interesting alternative to class-based frameworks like Backtrader or Freqtrade.

A Python framework tailored for crypto trading with multi-mode operation

The algotrading project is a Python-based algorithmic trading framework focused exclusively on cryptocurrency markets. It supports three primary modes of operation:

  • Live realtime trading via Binance exchange APIs. This mode can operate with real money, in simulation, or alert-only mode.
  • Tick-by-tick simulation to validate strategies against historical or synthetic data.
  • Full backtesting with built-in visualization of entry and exit points.

Under the hood, the framework uses Pandas and NumPy for data processing, Matplotlib for visualizations, and InfluxDB for market data storage, with CSV as a fallback option. The choice of InfluxDB allows efficient time-series data handling, which is critical for tick-level data in crypto markets.

The framework is designed to support both data-driven and event-driven system designs, accommodating various algorithmic trading approaches. Binance is the primary exchange supported, reflecting its dominance in crypto liquidity.

Functional strategy composition: simplicity and extensibility in trading rules

What sets this framework apart is its approach to strategy definition. Instead of classes and complex inheritance hierarchies, strategies are expressed as pure boolean functions:

  • Each function receives a slice of a Pandas DataFrame representing recent market data.
  • It returns a boolean True or False to signal entry or exit conditions.

This design makes it trivial to compose multiple strategies in one call by combining these boolean functions logically. For example, an entry strategy might be the logical AND of two conditions, each defined as separate functions. This approach results in clean, modular, and highly extensible strategy code that is easy to understand and maintain.

The tradeoff here is that the framework leans on functional purity at the cost of some flexibility that object-oriented strategies might provide, such as maintaining internal state or complex lifecycle hooks. However, for many crypto trading scenarios, this stateless approach reduces complexity and improves testability.

The code quality reflects this philosophy: the core is surprisingly lightweight and clean, focusing on a clear separation of concerns between strategy logic, data handling, and execution. Integration with InfluxDB for market data storage is a pragmatic choice, though it introduces an external dependency that some users might prefer to avoid.

Explore the project: navigating the repo and key resources

The repository offers comprehensive documentation and examples to help you get started. Key resources include:

  • The README.md which outlines the architecture and usage modes.
  • Examples of strategy functions demonstrating the boolean function pattern for entry and exit.
  • Configuration files for connecting to Binance APIs and InfluxDB.

The repo structure is straightforward, with separate modules for the trading engine, strategy definitions, data management, and visualization tools.

Since the repository does not provide explicit installation commands in its quickstart section, I recommend cloning the repo and reviewing the README to understand environment setup, dependencies, and configuration.

Verdict

This algorithmic trading framework is a solid choice for developers and quant traders focused on cryptocurrency markets who appreciate simplicity and modularity in strategy design. The functional approach to strategy composition is elegant and reduces boilerplate, making it well suited for rapid experimentation and stacking of trading rules.

However, it is opinionated: it depends on Binance for live trading, InfluxDB for data storage, and assumes familiarity with Python data science tools like Pandas. It may not suit those seeking a fully featured multi-exchange platform or who prefer object-oriented strategy frameworks.

Overall, the framework’s clean design and mode flexibility position it as a practical tool for crypto algo traders who want clear, composable strategies without the overhead of heavier frameworks.


→ GitHub Repo: ivopetiz/algotrading ⭐ 1,591 · Python