项目 / tradingstrategy-ai/trading-strategy

tradingstrategy-ai/trading-strategy

行业推荐
语言 Python标签 ethereumcryptocurrencyalgorithmic-tradingquantitative-financequantitative-tradingtrading-bottrading-strategiestrading-algorithmspancakeswapuniswappythonarbitrumpolygontradingbase-blockchainbinance数据更新 2026-11-20 06:49:16 · 仓库 2026-11-19

一段话介绍

Trading Strategy 是一套面向去中心化交易所的 Python 量化框架。本仓库中的 `trading-strategy` 包主要用于下载和管理回测与实时行情数据,数据来自 [Trading Strategy Protocol](https://tradingstrategy.ai/)。可在 Jupyter Notebook 中做分析与回测,并编写面向去中心化交易所的算法策略;README 写明它本身只提供数据获取与管理,若要做自动化执行,还需另行安装 [trade-executor](https://github.com/tradingstrategy-ai/trade-executor/)。当前说明提到可覆盖 Ethereum、BSC、Polygon 等链,以及 SushiSwap、QuickSwap、PancakeSwap 等交易所的链上交易数据。入门可先看 [Getting Started 仓库](https://github.com/tradingstrategy-ai/getting-started) 和[项目文档](https://tradingstrategy.ai/docs/)。安装可用 `pip install "trading-strategy[direct-feed]"` 或 Poetry,需要 Python 3.10。许可为 GNU AGPL 3.0。本页只介绍用途与入口。说明见[项目站点](https://tradingstrategy.ai)和[仓库 README](https://github.com/tradingstrategy-ai/trading-strategy)。

本站整理,非 GitHub 官方 description。

官方 description(GitHub API 原样)
Python framework for quantitative financial analysis and trading algorithms on decentralised exchanges
382累计星
63Fork
—峰值日增
0上榜次数
总榜
暂未入榜
日榜
暂未入榜
周榜
暂未入榜
月榜
暂未入榜

官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。

行业与场景

按行业选型 →

量化研究与策略回测

适配系统:量化投研平台、行情终端 · 得分 1.4

内置行情接入、因子计算与回测框架,可作为投研团队的策略实验与绩效归因底座。

更多信息

以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。

我的用法
安装或使用说明见 https://github.com/tradingstrategy-ai/getting-started。
特点或设计要点
项目说明文档见 https://tradingstrategy.ai/trading-view/ethereum。
星标走势还差一天的数据,明天就能看到曲线
每天 10:30 记一次星标,连续两天后自动生成曲线
首次发现 — · 最近在榜 2026-11-16 · 语言 Python · 贡献者 —
python

GitHub 项目主页介绍

来自 GitHub 仓库 README / 主页介绍正文,原样摘录,共 6,828 字节。

[![PyPI version](https://badge.fury.io/py/trading-strategy.svg)](https://badge.fury.io/py/trading-strategy)

[![CI Status](https://github.com/tradingstrategy-ai/trading-strategy/actions/workflows/python-app.yml/badge.svg)](https://github.com/tradingstrategy-ai/trading-strategy/actions/workflows/python-app.yml)

[![pip installation works](https://github.com/tradingstrategy-ai/trading-strategy/actions/workflows/pip-install.yml/badge.svg)](https://github.com/tradingstrategy-ai/trading-strategy/actions/workflows/pip-install.yml)

<a href="https://tradingstrategy.ai">
  <img src="https://raw.githubusercontent.com/tradingstrategy-ai/trading-strategy/master/logo.svg" width="384">
</a>

# Trading Strategy framework for Python

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](https://tradingstrategy.ai/trading-view/backtesting) and [real-time price feeds](https://tradingstrategy.ai/trading-view)
from [Trading Strategy Protocol](https://tradingstrategy.ai/). 

# Use cases

* Analyse cryptocurrency investment opportunities on [decentralised exchanges (DEXes)](https://tradingstrategy.ai/trading-view/exchanges)

* 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

# Features

* Supports multiple blockchains like [Ethereum mainnet](https://tradingstrategy.ai/trading-view/ethereum), 
  [Binance Smart Chain](https://tradingstrategy.ai/trading-view/binance) and 
  [Polygon](https://tradingstrategy.ai/trading-view/polygon)

* Access trading data from on-chain decentralised exchanges like
  [SushiSwap](https://tradingstrategy.ai/trading-view/ethereum/sushi), [QuickSwap](https://tradingstrategy.ai/trading-view/polygon/quickswap) and [PancakeSwap](https://tradingstrategy.ai/trading-view/binance/pancakeswap-v2)

* Integration with Jupyter Notebook for easy manipulation of data.
  See [example notebooks](https://tradingstrategy.ai/docs/programming/code-examples/index.html).

* Write [algorithmic trading strategies](https://tradingstrategy.ai/docs/programming/strategy-examples/index.html) for  decentralised exchange 

# Getting started 

See [the Getting Started repository](https://github.com/tradingstrategy-ai/getting-started) and the rest of the [Trading Strategy documentation](https://tradingstrategy.ai/docs/).

For JSON-only vault readiness polling and ETag-verified price snapshots, see
[Vault scan readiness receipts](tradingstrategy/vault_scan_manifest.py).

Historical HyperCore deposit permission uses original observation clocks,
separately from price/publication time. See
[`convert_vault_prices_to_vault_state()`](tradingstrategy/alternative_data/vault.py)
for explicit permission-history input and
[`select_permission_state()`](tradingstrategy/vault_permission.py) 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.

# Prerequisites

* Python 3.10

* [Understanding Python package management and installation](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)
  (unless using Dev Container from teh above)

# Installing the package

You can install this package with 

[Poetry](https://python-poetry.org/) as a dependency:

```shell
poetry add trading-strategy -E direct-feed
```

Poetry, local development:

```shell
poetry install -E direct-feed
```

Pip:

```shell
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](https://github.com/tradingstrategy-ai/trade-executor/).

# Documentation

- [Documentation](https://tradingstrategy.ai/docs/).

- [Getting started](https://tradingstrategy.ai/docs/getting-started.html).

Community
---------

* [Trading Strategy website](https://tradingstrategy.ai)

* [Blog](https://tradingstrategy.ai/blog)

* [Twitter](https://twitter.com/TradingProtocol)

* [Discord](https://tradingstrategy.ai/community#discord) 

* [Telegram channel](https://t.me/trading_protocol)

* [Changelog and version history](https://github.com/tradingstrategy-ai/trading-strategy/blob/master/CHANGELOG.md)

[Read more documentation how to develop this package](https://tradingstrategy.ai/docs/programming/development.html).

# License

GNU AGPL 3.0. 

## Vault permission sidecars

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](https://github.com/tradingstrategy-ai/web3-ethereum-defi/pull/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.
↑