Trading Strategy framework is a Python framework for algorithmic trading on decentralised exchanges.
- Download decentralised finance market data sets
- Develop and backtest trading strategies in Jupyter Notebook
- Live trade execution for onchain trading
- Smart contract vault support for turning your trading strategy to a third-party investable vault
The trading-strategy library provides data fetching for backtesting and live trading.
It is using backtesting data and real-time price feeds from Trading Strategy Protocol.
-
Analyse cryptocurrency investment opportunities on decentralised exchanges (DEXes)
-
Creating trading algorithms and trading bots that trade on DEXes
-
Deploy trading strategies as on-chain smart contracts where users can invest and withdraw with their wallets
-
Supports multiple blockchains like Ethereum mainnet, Binance Smart Chain and Polygon
-
Access trading data from on-chain decentralised exchanges like SushiSwap, QuickSwap and PancakeSwap
-
Integration with Jupyter Notebook for easy manipulation of data. See example notebooks.
-
Write algorithmic trading strategies for decentralised exchange
See the Getting Started repository and the rest of the Trading Strategy documentation.
For JSON-only vault readiness polling and ETag-verified price snapshots, see Vault scan readiness receipts.
Historical HyperCore deposit permission uses original observation clocks,
separately from price/publication time. See
convert_vault_prices_to_vault_state()
for explicit permission-history input and
select_permission_state() for snapshot
precedence and uncertainty handling. Recovered legacy flags use inferred price
clocks with visible provenance. Recorded leader shares and deposit caps remain
readable when older schemas have no separate capacity clock. A zero cap blocks
deposits without declaring the venue closed; a NULL cap remains unknown. Newer
coherent responses, including unknowns, replace the whole policy snapshot.
-
Python 3.10
-
Understanding Python package management and installation (unless using Dev Container from teh above)
You can install this package with
Poetry as a dependency:
poetry add trading-strategy -E direct-feedPoetry, local development:
poetry install -E direct-feedPip:
pip install "trading-strategy[direct-feed]" Note: trading-strategy package provides trading data
download and management functionality only. If you want to developed
automated trading strategies you need to install trade-executor package as well.
Read more documentation how to develop this package.
GNU AGPL 3.0.
The vault-state converter preserves explicit permission/capacity projections, including unknown values and original evidence clocks. For older sidecars without those projections it uses the shared eth-defi Hyperliquid classifier; it does not maintain another leader-share threshold or HLP-parent exception. Missing relationship metadata remains uncertain rather than being assumed to identify a normal vault.
Legacy sidecars without permission/capacity projections require
eth_defi.hyperliquid.vault.classify_hyperliquid_vault_deposit, introduced in
eth-defi PR #1596.
PyPI release 1.2 does not contain this API. Development and CI therefore use the
Git source pinned in the development dependency group and lockfile (44f365a,
GitHub HEAD checked on 27 October 2026); poetry install --all-extras installs
that source, including the current Web3 7 dependency stack.
The library's version-based dependency allows a parent trade-executor checkout
to supply its editable deps/web3-ethereum-defi Git checkout. That is the normal
notebook/strategy setup; it must contain the shared classifier. The development
Git pin is not imposed on that parent project's dependency resolution. Update
source pins deliberately rather than using a moving branch in the lockfile.
Price-only conversion and sidecars with recorded permission/capacity fields do
not import or call the classifier. A missing explanatory reason string alone
does not trigger protocol reclassification. Strategy admission policy belongs
to the executor's tradeexecutor.strategy.vault_closure module.