deltafq 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of deltafq might be problematic. Click here for more details.

deltafq/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  一个面向量化策略开发者和量化研究人员的完整工具链。
4
4
  """
5
5
 
6
- __version__ = "0.1.0"
6
+ __version__ = "0.1.1"
7
7
  __author__ = "DeltaFQ Team"
8
8
 
9
9
  # 导入主要模块
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.4
2
+ Name: deltafq
3
+ Version: 0.1.1
4
+ Summary: A professional Python quantitative trading library
5
+ Author-email: DeltaFQ Team <your.email@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Delta-F/deltafq
8
+ Project-URL: Documentation, https://github.com/Delta-F/deltafq/tree/main/docs
9
+ Project-URL: Repository, https://github.com/Delta-F/deltafq
10
+ Project-URL: PyPI, https://pypi.org/project/deltafq/
11
+ Project-URL: Bug Tracker, https://github.com/Delta-F/deltafq/issues
12
+ Keywords: quantitative,trading,finance,backtest,strategy
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Financial and Insurance Industry
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Topic :: Office/Business :: Financial :: Investment
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: pandas>=1.3.0
27
+ Requires-Dist: numpy>=1.21.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
30
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
31
+ Requires-Dist: black>=22.0.0; extra == "dev"
32
+ Requires-Dist: flake8>=5.0.0; extra == "dev"
33
+ Requires-Dist: mypy>=0.990; extra == "dev"
34
+ Provides-Extra: plot
35
+ Requires-Dist: matplotlib>=3.5.0; extra == "plot"
36
+ Provides-Extra: all
37
+ Requires-Dist: matplotlib>=3.5.0; extra == "all"
38
+ Dynamic: license-file
39
+
40
+ # DeltaFQ
41
+
42
+ [![PyPI version](https://badge.fury.io/py/deltafq.svg)](https://badge.fury.io/py/deltafq)
43
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
44
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
45
+
46
+ A professional Python quantitative trading library providing a complete toolkit for quantitative strategy development and research.
47
+
48
+ ## Features
49
+
50
+ - 📊 **Multi-source Data Support** - Unified data interface supporting multiple data sources
51
+ - 📈 **Rich Technical Indicators** - Built-in common technical indicators with custom extension support
52
+ - 🎯 **Flexible Strategy Framework** - Clean API for rapid trading strategy development
53
+ - ⚡ **Efficient Backtest Engine** - Vectorized computation for fast strategy validation
54
+ - 📉 **Comprehensive Risk Management** - Position management, risk control, and performance analysis
55
+ - 🔧 **Parameter Optimization Tools** - Multiple optimization algorithms for finding optimal parameters
56
+ - 📱 **Live Trading Interface** - Unified trading interface for seamless simulation and live trading
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ pip install deltafq
62
+ ```
63
+
64
+ Or install from source:
65
+
66
+ ```bash
67
+ git clone https://github.com/Delta-F/deltafq.git
68
+ cd deltafq
69
+ pip install -e .
70
+ ```
71
+
72
+ ## Quick Start
73
+
74
+ ### Get Data
75
+
76
+ ```python
77
+ import deltafq as dfq
78
+
79
+ # Get stock data
80
+ data = dfq.data.get_stock_daily('000001.SZ', start='2020-01-01', end='2023-12-31')
81
+ print(data.head())
82
+ ```
83
+
84
+ ### Calculate Technical Indicators
85
+
86
+ ```python
87
+ # Calculate moving averages
88
+ data['ma5'] = dfq.indicators.SMA(data['close'], 5)
89
+ data['ma20'] = dfq.indicators.SMA(data['close'], 20)
90
+
91
+ # Calculate MACD
92
+ macd = dfq.indicators.MACD(data['close'])
93
+ data = data.join(macd)
94
+ ```
95
+
96
+ ### Build Trading Strategy
97
+
98
+ ```python
99
+ class MAStrategy(dfq.strategy.Strategy):
100
+ """Dual Moving Average Strategy"""
101
+
102
+ def on_bar(self, bar):
103
+ if bar.ma5 > bar.ma20:
104
+ self.buy()
105
+ elif bar.ma5 < bar.ma20:
106
+ self.sell()
107
+ ```
108
+
109
+ ### Run Backtest
110
+
111
+ ```python
112
+ # Create backtest engine
113
+ engine = dfq.backtest.BacktestEngine(
114
+ initial_cash=100000,
115
+ commission=0.0003
116
+ )
117
+
118
+ # Run backtest
119
+ result = engine.run(data, MAStrategy())
120
+
121
+ # View results
122
+ print(result.summary())
123
+ result.plot()
124
+ ```
125
+
126
+ ## Module Overview
127
+
128
+ - **data** - Data acquisition and management
129
+ - **indicators** - Technical indicator calculations
130
+ - **strategy** - Strategy development framework
131
+ - **backtest** - Backtest engine
132
+ - **risk** - Risk management
133
+ - **performance** - Performance analysis
134
+ - **optimization** - Parameter optimization
135
+ - **trade** - Live trading interface
136
+ - **utils** - Utility functions
137
+
138
+ ## Examples
139
+
140
+ Check the `examples/` directory for more example code:
141
+
142
+ - `ma_strategy.py` - Dual Moving Average Strategy
143
+ - `macd_strategy.py` - MACD Strategy
144
+ - `optimization_example.py` - Parameter Optimization Example
145
+
146
+ ## Documentation
147
+
148
+ - **User Guide**: [docs/GUIDE.md](docs/GUIDE.md) | [中文指南](docs/GUIDE_zh.md)
149
+ - **API Reference**: [docs/API.md](docs/API.md)
150
+ - **Development Guide**: [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md)
151
+ - **Changelog**: [docs/CHANGELOG.md](docs/CHANGELOG.md)
152
+
153
+ ## Dependencies
154
+
155
+ - Python >= 3.8
156
+ - pandas >= 1.3.0
157
+ - numpy >= 1.21.0
158
+
159
+ ## Development
160
+
161
+ ```bash
162
+ # Clone repository
163
+ git clone https://github.com/Delta-F/deltafq.git
164
+ cd deltafq
165
+
166
+ # Install development dependencies
167
+ pip install -e ".[dev]"
168
+
169
+ # Run tests
170
+ pytest
171
+
172
+ # Code formatting
173
+ black deltafq/
174
+
175
+ # Type checking
176
+ mypy deltafq/
177
+ ```
178
+
179
+ ## License
180
+
181
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
182
+
183
+ ## Contributing
184
+
185
+ Issues and Pull Requests are welcome!
186
+
187
+ ## Contact
188
+
189
+ - Project Homepage: [https://github.com/Delta-F/deltafq](https://github.com/Delta-F/deltafq)
190
+ - PyPI Homepage: [https://pypi.org/project/deltafq/](https://pypi.org/project/deltafq/)
191
+ - Issue Tracker: [https://github.com/Delta-F/deltafq/issues](https://github.com/Delta-F/deltafq/issues)
192
+
193
+ ---
194
+
195
+ ⚠️ **Risk Warning**: Quantitative trading involves risk. This library is for educational and research purposes only and does not constitute investment advice. Please exercise caution when trading live, as you bear the risk yourself.
196
+
197
+ ## Language Support
198
+
199
+ This project supports both English and Chinese documentation:
200
+
201
+ - **English**: [README.md](README.md) (current)
202
+ - **中文**: [README_zh.md](README_zh.md)
@@ -1,4 +1,4 @@
1
- deltafq/__init__.py,sha256=CR_ufA8vkfg6NeolNBnRTLLQhk7GTGWMKfQnDQG6zsM,640
1
+ deltafq/__init__.py,sha256=j_xRF3hL3oBvHyovTHvMvS31Rppvtg-eSFPnvjU5N1s,640
2
2
  deltafq/backtest/__init__.py,sha256=nH_lnnpx-XPs2FY8j4DdeptX5Rwumbgn9l82kyiu5Ds,184
3
3
  deltafq/backtest/engine.py,sha256=YefCepHM9_Y4EJi5y4eDhjwLILu5iaj1Z7soaXjZLy4,1248
4
4
  deltafq/backtest/result.py,sha256=2DS1b9c5iJb8BCeQt9p7p_hrqc805P8mWoqyu-pa3Zs,1164
@@ -22,8 +22,8 @@ deltafq/trade/__init__.py,sha256=9MLD7LlybjP0uATMbAqDPYkuwFIP1PPE9PG5WduUZBs,101
22
22
  deltafq/trade/broker.py,sha256=IMW3e38mv8XkYF279tqQxKUIjcZ79N82cb52uFhEAWY,875
23
23
  deltafq/utils/__init__.py,sha256=AMUJnZSlvojkgOWXROglzXXwqslHrp25YH_9GBbOA0s,149
24
24
  deltafq/utils/time.py,sha256=0XGMR8xxX39HS-h7xg0gN6pTuOK-SOlRsWeQq9XLW5Y,641
25
- deltafq-0.1.0.dist-info/licenses/LICENSE,sha256=5_jN6PqRGcdXKxxg6PCYHU7A2u29fcTdA-8laOCdsZU,1092
26
- deltafq-0.1.0.dist-info/METADATA,sha256=l-1eLC18TbCd1ay_i06gSfvO0sMqDPDAx5aQ5ep45GY,5495
27
- deltafq-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
- deltafq-0.1.0.dist-info/top_level.txt,sha256=j1Q3ce7BEqdXVZd-mlHiJBDHq3iJGiKRKEXPW8xHLHo,8
29
- deltafq-0.1.0.dist-info/RECORD,,
25
+ deltafq-0.1.1.dist-info/licenses/LICENSE,sha256=5_jN6PqRGcdXKxxg6PCYHU7A2u29fcTdA-8laOCdsZU,1092
26
+ deltafq-0.1.1.dist-info/METADATA,sha256=2OqdSeGSE80XVsRQYFOyj7v73cxBQ-z35rhhHP9tCLE,6195
27
+ deltafq-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
+ deltafq-0.1.1.dist-info/top_level.txt,sha256=j1Q3ce7BEqdXVZd-mlHiJBDHq3iJGiKRKEXPW8xHLHo,8
29
+ deltafq-0.1.1.dist-info/RECORD,,
@@ -1,195 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: deltafq
3
- Version: 0.1.0
4
- Summary: 专业的Python量化交易库
5
- Author-email: DeltaFQ Team <your.email@example.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/Delta-F/deltafq
8
- Project-URL: Documentation, https://deltafq.readthedocs.io
9
- Project-URL: Repository, https://github.com/Delta-F/deltafq
10
- Project-URL: PyPI, https://pypi.org/project/deltafq/
11
- Project-URL: Bug Tracker, https://github.com/Delta-F/deltafq/issues
12
- Keywords: quantitative,trading,finance,backtest,strategy
13
- Classifier: Development Status :: 3 - Alpha
14
- Classifier: Intended Audience :: Financial and Insurance Industry
15
- Classifier: Intended Audience :: Developers
16
- Classifier: License :: OSI Approved :: MIT License
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.8
19
- Classifier: Programming Language :: Python :: 3.9
20
- Classifier: Programming Language :: Python :: 3.10
21
- Classifier: Programming Language :: Python :: 3.11
22
- Classifier: Topic :: Office/Business :: Financial :: Investment
23
- Requires-Python: >=3.8
24
- Description-Content-Type: text/markdown
25
- License-File: LICENSE
26
- Requires-Dist: pandas>=1.3.0
27
- Requires-Dist: numpy>=1.21.0
28
- Provides-Extra: dev
29
- Requires-Dist: pytest>=7.0.0; extra == "dev"
30
- Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
31
- Requires-Dist: black>=22.0.0; extra == "dev"
32
- Requires-Dist: flake8>=5.0.0; extra == "dev"
33
- Requires-Dist: mypy>=0.990; extra == "dev"
34
- Provides-Extra: plot
35
- Requires-Dist: matplotlib>=3.5.0; extra == "plot"
36
- Provides-Extra: all
37
- Requires-Dist: matplotlib>=3.5.0; extra == "all"
38
- Dynamic: license-file
39
-
40
- # DeltaFQ
41
-
42
- [![PyPI version](https://badge.fury.io/py/deltafq.svg)](https://badge.fury.io/py/deltafq)
43
- [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
44
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
45
-
46
- 专业的Python量化交易库,为量化策略开发者和研究人员提供从数据获取到策略回测的完整工具链。
47
-
48
- ## 特性
49
-
50
- - 📊 **多源数据支持** - 统一的数据接口,支持多种数据源
51
- - 📈 **丰富的技术指标** - 内置常用技术指标,支持自定义扩展
52
- - 🎯 **灵活的策略框架** - 简洁的API,快速构建交易策略
53
- - ⚡ **高效的回测引擎** - 向量化计算,快速验证策略效果
54
- - 📉 **全面的风险管理** - 仓位管理、风险控制、绩效分析
55
- - 🔧 **参数优化工具** - 多种优化算法,寻找最佳参数
56
- - 📱 **实盘交易接口** - 统一的交易接口,无缝切换模拟与实盘
57
-
58
- ## 安装
59
-
60
- ```bash
61
- pip install deltafq
62
- ```
63
-
64
- 或者安装开发版本:
65
-
66
- ```bash
67
- git clone https://github.com/Delta-F/deltafq.git
68
- cd deltafq
69
- pip install -e .
70
- ```
71
-
72
- ## 快速开始
73
-
74
- ### 获取数据
75
-
76
- ```python
77
- import deltafq as dfq
78
-
79
- # 获取股票数据
80
- data = dfq.data.get_stock_daily('000001.SZ', start='2020-01-01', end='2023-12-31')
81
- print(data.head())
82
- ```
83
-
84
- ### 计算技术指标
85
-
86
- ```python
87
- # 计算移动平均线
88
- data['ma5'] = dfq.indicators.SMA(data['close'], 5)
89
- data['ma20'] = dfq.indicators.SMA(data['close'], 20)
90
-
91
- # 计算MACD
92
- macd = dfq.indicators.MACD(data['close'])
93
- data = data.join(macd)
94
- ```
95
-
96
- ### 构建交易策略
97
-
98
- ```python
99
- class MAStrategy(dfq.strategy.Strategy):
100
- """双均线策略"""
101
-
102
- def on_bar(self, bar):
103
- if bar.ma5 > bar.ma20:
104
- self.buy()
105
- elif bar.ma5 < bar.ma20:
106
- self.sell()
107
- ```
108
-
109
- ### 运行回测
110
-
111
- ```python
112
- # 创建回测引擎
113
- engine = dfq.backtest.BacktestEngine(
114
- initial_cash=100000,
115
- commission=0.0003
116
- )
117
-
118
- # 运行回测
119
- result = engine.run(data, MAStrategy())
120
-
121
- # 查看结果
122
- print(result.summary())
123
- result.plot()
124
- ```
125
-
126
- ## 模块说明
127
-
128
- - **data** - 数据获取和管理
129
- - **indicators** - 技术指标计算
130
- - **strategy** - 策略开发框架
131
- - **backtest** - 回测引擎
132
- - **risk** - 风险管理
133
- - **performance** - 绩效分析
134
- - **optimization** - 参数优化
135
- - **trade** - 实盘交易接口
136
- - **utils** - 工具函数
137
-
138
- ## 示例
139
-
140
- 查看 `examples/` 目录获取更多示例代码:
141
-
142
- - `ma_strategy.py` - 双均线策略
143
- - `macd_strategy.py` - MACD策略
144
- - `optimization_example.py` - 参数优化示例
145
-
146
- ## 文档
147
-
148
- - **使用指南**: [docs/GUIDE.md](docs/GUIDE.md)
149
- - **API参考**: [docs/API.md](docs/API.md)
150
- - **开发指南**: [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md)
151
- - **更新日志**: [docs/CHANGELOG.md](docs/CHANGELOG.md)
152
-
153
- ## 依赖
154
-
155
- - Python >= 3.8
156
- - pandas >= 1.3.0
157
- - numpy >= 1.21.0
158
-
159
- ## 开发
160
-
161
- ```bash
162
- # 克隆仓库
163
- git clone https://github.com/Delta-F/deltafq.git
164
- cd deltafq
165
-
166
- # 安装开发依赖
167
- pip install -e ".[dev]"
168
-
169
- # 运行测试
170
- pytest
171
-
172
- # 代码格式化
173
- black deltafq/
174
-
175
- # 类型检查
176
- mypy deltafq/
177
- ```
178
-
179
- ## 许可证
180
-
181
- 本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件
182
-
183
- ## 贡献
184
-
185
- 欢迎提交 Issue 和 Pull Request!
186
-
187
- ## 联系方式
188
-
189
- - 项目主页:[https://github.com/Delta-F/deltafq](https://github.com/Delta-F/deltafq)
190
- - PyPI 主页:[https://pypi.org/project/deltafq/](https://pypi.org/project/deltafq/)
191
- - 问题反馈:[https://github.com/Delta-F/deltafq/issues](https://github.com/Delta-F/deltafq/issues)
192
-
193
- ---
194
-
195
- ⚠️ **风险提示**:量化交易存在风险,本库仅供学习研究使用,不构成投资建议。实盘交易需谨慎,风险自担。