polars-ta 0.4.6__tar.gz → 0.5.1__tar.gz
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.
- {polars_ta-0.4.6 → polars_ta-0.5.1}/PKG-INFO +43 -55
- {polars_ta-0.4.6 → polars_ta-0.5.1}/README.md +39 -52
- polars_ta-0.5.1/polars_ta/__init__.py +6 -0
- polars_ta-0.5.1/polars_ta/_version.py +1 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/talib/__init__.py +98 -98
- polars_ta-0.5.1/polars_ta/utils/numba_.py +160 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/utils/pandas_.py +4 -4
- polars_ta-0.5.1/polars_ta/wq/_nb.py +339 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/wq/arithmetic.py +16 -13
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/wq/time_series.py +146 -90
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta.egg-info/PKG-INFO +43 -55
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta.egg-info/requires.txt +1 -1
- {polars_ta-0.4.6 → polars_ta-0.5.1}/pyproject.toml +1 -1
- polars_ta-0.4.6/polars_ta/__init__.py +0 -3
- polars_ta-0.4.6/polars_ta/_version.py +0 -1
- polars_ta-0.4.6/polars_ta/utils/numba_.py +0 -79
- polars_ta-0.4.6/polars_ta/wq/_nb.py +0 -315
- {polars_ta-0.4.6 → polars_ta-0.5.1}/LICENSE +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/candles/__init__.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/candles/cdl1.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/candles/cdl1_limit.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/candles/cdl2.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/noise.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/performance/__init__.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/performance/drawdown.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/performance/returns.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/prefix/__init__.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/prefix/cdl.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/prefix/reports.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/prefix/ta.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/prefix/talib.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/prefix/tdx.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/prefix/wq.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/reports/__init__.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/reports/cicc.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/ta/__init__.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/ta/momentum.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/ta/operators.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/ta/overlap.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/ta/price.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/ta/statistic.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/ta/transform.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/ta/volatility.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/ta/volume.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/__init__.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/_chip.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/_nb.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/_slow.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/arithmetic.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/choice.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/energy.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/logical.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/moving_average.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/over_bought_over_sold.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/pattern.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/pattern_feature.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/pressure_support.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/reference.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/statistic.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/trend.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/trend_feature.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/tdx/volume.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/utils/__init__.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/utils/helper.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/utils/pit.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/utils/wrapper.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/wq/__init__.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/wq/_slow.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/wq/cross_sectional.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/wq/logical.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/wq/preprocess.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/wq/transformational.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta/wq/vector.py +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta.egg-info/SOURCES.txt +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta.egg-info/dependency_links.txt +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/polars_ta.egg-info/top_level.txt +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/setup.cfg +0 -0
- {polars_ta-0.4.6 → polars_ta-0.5.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: polars_ta
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.5.1
|
4
4
|
Summary: polars expressions
|
5
5
|
Author-email: wukan <wu-kan@163.com>
|
6
6
|
License: MIT License
|
@@ -31,13 +31,14 @@ Classifier: Programming Language :: Python
|
|
31
31
|
Requires-Python: >=3.8
|
32
32
|
Description-Content-Type: text/markdown
|
33
33
|
License-File: LICENSE
|
34
|
-
Requires-Dist: polars>=
|
34
|
+
Requires-Dist: polars>=1.26.0
|
35
35
|
Requires-Dist: polars-ols>=0.3.0
|
36
36
|
Requires-Dist: numpy
|
37
37
|
Requires-Dist: numba
|
38
38
|
Requires-Dist: pandas
|
39
39
|
Provides-Extra: talib
|
40
40
|
Requires-Dist: TA-Lib; extra == "talib"
|
41
|
+
Dynamic: license-file
|
41
42
|
|
42
43
|
# polars_ta
|
43
44
|
|
@@ -65,6 +66,7 @@ pip install polars_ta-0.1.2-py3-none-any.whl
|
|
65
66
|
```
|
66
67
|
|
67
68
|
### How to Install TA-Lib
|
69
|
+
|
68
70
|
Non-official `TA-Lib` wheels can be downloaded from `https://github.com/cgohlke/talib-build/releases`
|
69
71
|
|
70
72
|
## Usage
|
@@ -91,6 +93,18 @@ df = df.with_columns([
|
|
91
93
|
])
|
92
94
|
```
|
93
95
|
|
96
|
+
When both `min_periods` and `MIN_SAMPLES` are set, `min_periods` takes precedence. default value is `None`.
|
97
|
+
|
98
|
+
```python
|
99
|
+
import polars_ta
|
100
|
+
|
101
|
+
# Global settings. Priority Low
|
102
|
+
polars_ta.MIN_SAMPLES = 1
|
103
|
+
|
104
|
+
# High priority
|
105
|
+
ts_mean(CLOSE, 10, min_samples=1)
|
106
|
+
```
|
107
|
+
|
94
108
|
## How We Designed This
|
95
109
|
|
96
110
|
1. We use `Expr` instead of `Series` to avoid using `Series` in the calculation. Functions are no longer methods of class.
|
@@ -108,32 +122,6 @@ See [compare](compare.md)
|
|
108
122
|
|
109
123
|
See [nan_to_null](nan_to_null.md)
|
110
124
|
|
111
|
-
## Evolve of Our TA-Lib Wrappers
|
112
|
-
|
113
|
-
1. `Expr.map_batches` can be used to call third-party libraries, such as `TA-Lib, bottleneck`. But because of the input and output format requirements, you need to wrap the third-party API with a function.
|
114
|
-
- Both input and output can only be one column. If you want to support multiple columns, you need to convert them to `pl.Struct`. After that, you need to use `unnest` to split `pl.Struct`.
|
115
|
-
- The output must be `pl.Series`
|
116
|
-
2. Start to use `register_expr_namespace` to simplify the code
|
117
|
-
- Implementation [helper.py](polars_ta/utils/helper.py)
|
118
|
-
- Usage demo [demo_ta1.py](examples/demo_ta1.py)
|
119
|
-
- Pros: Easy to use
|
120
|
-
- Cons:
|
121
|
-
- The `member function call mode` is not convenient for inputting into genetic algorithms for factor mining
|
122
|
-
- `__getattribute__` dynamic method call is very flexible, but loses `IDE` support.
|
123
|
-
3. Prefix expression. Convert all member functions into formulas
|
124
|
-
- Implementation [wrapper.py](polars_ta/utils/wrapper.py)
|
125
|
-
- Usage demo [demo_ta2.py](examples/demo_ta2.py)
|
126
|
-
- Pros: Can be input into our implementation of genetic algorithms
|
127
|
-
- Cons: `__getattribute__` dynamic method call is very flexible, but loses `IDE` support.
|
128
|
-
4. Code generation.
|
129
|
-
- Implementation [codegen_talib.py](tools/codegen_talib.py)
|
130
|
-
- Generated result will be at [\_\_init\_\_.py](polars_ta/talib/__init__.py)
|
131
|
-
- Usage demo [demo_ta3.py](examples/demo_ta3.py)
|
132
|
-
- Pros:
|
133
|
-
- Can be input into our implementation of genetic algorithms
|
134
|
-
- `IDE` support
|
135
|
-
|
136
|
-
|
137
125
|
## Debugging
|
138
126
|
|
139
127
|
```commandline
|
@@ -157,10 +145,6 @@ This is required to use in `expr_codegen`.
|
|
157
145
|
- https://support.worldquantbrain.com/hc/en-us/community/posts/20278408956439-从价量看技术指标总结-Technical-Indicator-
|
158
146
|
- https://platform.worldquantbrain.com/learn/operators/operators
|
159
147
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
148
|
# polars_ta
|
165
149
|
|
166
150
|
基于`polars`的算子库。实现量化投研中常用的技术指标、数据处理等函数。对于不易翻译成`Expr`的库(如:`TA-Lib`)也提供了函数式调用的封装
|
@@ -185,6 +169,7 @@ pip install polars_ta-0.1.2-py3-none-any.whl
|
|
185
169
|
```
|
186
170
|
|
187
171
|
### TA-Lib安装
|
172
|
+
|
188
173
|
Windows用户不会安装可从`https://github.com/cgohlke/talib-build/releases` 下载对应版本whl文件
|
189
174
|
|
190
175
|
## 使用方法
|
@@ -211,6 +196,19 @@ df = df.with_columns([
|
|
211
196
|
])
|
212
197
|
```
|
213
198
|
|
199
|
+
当`min_periods`和`MIN_SAMPLES`都设置时,以`min_periods`为准,默认值为`None`
|
200
|
+
|
201
|
+
```python
|
202
|
+
import polars_ta
|
203
|
+
|
204
|
+
# 全局设置。优先级低
|
205
|
+
polars_ta.MIN_SAMPLES = 1
|
206
|
+
|
207
|
+
# 指定函数。优先级高
|
208
|
+
ts_mean(CLOSE, 10, min_samples=1)
|
209
|
+
|
210
|
+
```
|
211
|
+
|
214
212
|
## 设计原则
|
215
213
|
|
216
214
|
1. 调用方法由`成员函数`换成`独立函数`。输入输出使用`Expr`,避免使用`Series`
|
@@ -228,28 +226,6 @@ df = df.with_columns([
|
|
228
226
|
|
229
227
|
请参考[nan_to_null](nan_to_null.md)
|
230
228
|
|
231
|
-
## TA-Lib封装的演化
|
232
|
-
|
233
|
-
1. `Expr.map_batches`可以实现调用第三方库,如`TA-Lib, bottleneck`。但因为对输入与输出格式有要求,所以还需要用函数对第三方API封装一下。
|
234
|
-
- 输入输出都只能是一列,如要支持多列需转换成`pl.Struct`。事后`pl.Struct`要拆分需使用`unnest`
|
235
|
-
- 输出必须是`pl.Series`
|
236
|
-
2. 参数多,代码长。开始使用`register_expr_namespace`来简化代码
|
237
|
-
- 实现代码[helper.py](polars_ta/utils/helper.py)
|
238
|
-
- 使用演示[demo_ta1.py](examples/demo_ta1.py)
|
239
|
-
- 优点:使用简单
|
240
|
-
- 不足:`成员函数调用模式`不便于输入到遗传算法中进行因子挖掘
|
241
|
-
- 不足:`__getattribute__`动态方法调用非常灵活,但失去了`IDE`智能提示
|
242
|
-
3. 前缀表达式。将所有的成员函数都转换成公式
|
243
|
-
- 实现代码[wrapper.py](polars_ta/utils/wrapper.py)
|
244
|
-
- 使用演示[demo_ta2.py](examples/demo_ta2.py)
|
245
|
-
- 优点:可以输入到遗传算法
|
246
|
-
- 不足:`__getattribute__`动态方法调用非常灵活,但失去了`IDE`智能提示
|
247
|
-
4. 代码自动生成。
|
248
|
-
- 实现代码[codegen_talib.py](tools/codegen_talib.py)
|
249
|
-
- 生成结果[\_\_init\_\_.py](polars_ta/talib/__init__.py)
|
250
|
-
- 使用演示[demo_ta3.py](examples/demo_ta3.py)
|
251
|
-
- 优点:即可以输入到遗传算法,`IDE`还有智能提示
|
252
|
-
|
253
229
|
## 开发调试
|
254
230
|
|
255
231
|
```commandline
|
@@ -260,6 +236,18 @@ pip install -e .
|
|
260
236
|
|
261
237
|
注意:如果你在`ta`或`tdx`中添加了新的函数,请再运行`tools`下的`prefix_ta.py`或`prefix_tdx.py`,用于生成对应的前缀文件。前缀文件方便在`expr_codegen`中使用
|
262
238
|
|
239
|
+
## 文档生成
|
240
|
+
|
241
|
+
```commandline
|
242
|
+
pip install -r requirements-docs.txt
|
243
|
+
mkdocs build
|
244
|
+
```
|
245
|
+
|
246
|
+
文档生成在`site`目录下,其中的`llms-full.txt`可以作为大语言模型的知识库导入。
|
247
|
+
|
248
|
+
也可以通过以下链接导入:
|
249
|
+
https://polars-ta.readthedocs.io/en/latest/llms-full.txt
|
250
|
+
|
263
251
|
## 参考
|
264
252
|
|
265
253
|
- https://github.com/pola-rs/polars
|
@@ -24,6 +24,7 @@ pip install polars_ta-0.1.2-py3-none-any.whl
|
|
24
24
|
```
|
25
25
|
|
26
26
|
### How to Install TA-Lib
|
27
|
+
|
27
28
|
Non-official `TA-Lib` wheels can be downloaded from `https://github.com/cgohlke/talib-build/releases`
|
28
29
|
|
29
30
|
## Usage
|
@@ -50,6 +51,18 @@ df = df.with_columns([
|
|
50
51
|
])
|
51
52
|
```
|
52
53
|
|
54
|
+
When both `min_periods` and `MIN_SAMPLES` are set, `min_periods` takes precedence. default value is `None`.
|
55
|
+
|
56
|
+
```python
|
57
|
+
import polars_ta
|
58
|
+
|
59
|
+
# Global settings. Priority Low
|
60
|
+
polars_ta.MIN_SAMPLES = 1
|
61
|
+
|
62
|
+
# High priority
|
63
|
+
ts_mean(CLOSE, 10, min_samples=1)
|
64
|
+
```
|
65
|
+
|
53
66
|
## How We Designed This
|
54
67
|
|
55
68
|
1. We use `Expr` instead of `Series` to avoid using `Series` in the calculation. Functions are no longer methods of class.
|
@@ -67,32 +80,6 @@ See [compare](compare.md)
|
|
67
80
|
|
68
81
|
See [nan_to_null](nan_to_null.md)
|
69
82
|
|
70
|
-
## Evolve of Our TA-Lib Wrappers
|
71
|
-
|
72
|
-
1. `Expr.map_batches` can be used to call third-party libraries, such as `TA-Lib, bottleneck`. But because of the input and output format requirements, you need to wrap the third-party API with a function.
|
73
|
-
- Both input and output can only be one column. If you want to support multiple columns, you need to convert them to `pl.Struct`. After that, you need to use `unnest` to split `pl.Struct`.
|
74
|
-
- The output must be `pl.Series`
|
75
|
-
2. Start to use `register_expr_namespace` to simplify the code
|
76
|
-
- Implementation [helper.py](polars_ta/utils/helper.py)
|
77
|
-
- Usage demo [demo_ta1.py](examples/demo_ta1.py)
|
78
|
-
- Pros: Easy to use
|
79
|
-
- Cons:
|
80
|
-
- The `member function call mode` is not convenient for inputting into genetic algorithms for factor mining
|
81
|
-
- `__getattribute__` dynamic method call is very flexible, but loses `IDE` support.
|
82
|
-
3. Prefix expression. Convert all member functions into formulas
|
83
|
-
- Implementation [wrapper.py](polars_ta/utils/wrapper.py)
|
84
|
-
- Usage demo [demo_ta2.py](examples/demo_ta2.py)
|
85
|
-
- Pros: Can be input into our implementation of genetic algorithms
|
86
|
-
- Cons: `__getattribute__` dynamic method call is very flexible, but loses `IDE` support.
|
87
|
-
4. Code generation.
|
88
|
-
- Implementation [codegen_talib.py](tools/codegen_talib.py)
|
89
|
-
- Generated result will be at [\_\_init\_\_.py](polars_ta/talib/__init__.py)
|
90
|
-
- Usage demo [demo_ta3.py](examples/demo_ta3.py)
|
91
|
-
- Pros:
|
92
|
-
- Can be input into our implementation of genetic algorithms
|
93
|
-
- `IDE` support
|
94
|
-
|
95
|
-
|
96
83
|
## Debugging
|
97
84
|
|
98
85
|
```commandline
|
@@ -116,10 +103,6 @@ This is required to use in `expr_codegen`.
|
|
116
103
|
- https://support.worldquantbrain.com/hc/en-us/community/posts/20278408956439-从价量看技术指标总结-Technical-Indicator-
|
117
104
|
- https://platform.worldquantbrain.com/learn/operators/operators
|
118
105
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
106
|
# polars_ta
|
124
107
|
|
125
108
|
基于`polars`的算子库。实现量化投研中常用的技术指标、数据处理等函数。对于不易翻译成`Expr`的库(如:`TA-Lib`)也提供了函数式调用的封装
|
@@ -144,6 +127,7 @@ pip install polars_ta-0.1.2-py3-none-any.whl
|
|
144
127
|
```
|
145
128
|
|
146
129
|
### TA-Lib安装
|
130
|
+
|
147
131
|
Windows用户不会安装可从`https://github.com/cgohlke/talib-build/releases` 下载对应版本whl文件
|
148
132
|
|
149
133
|
## 使用方法
|
@@ -170,6 +154,19 @@ df = df.with_columns([
|
|
170
154
|
])
|
171
155
|
```
|
172
156
|
|
157
|
+
当`min_periods`和`MIN_SAMPLES`都设置时,以`min_periods`为准,默认值为`None`
|
158
|
+
|
159
|
+
```python
|
160
|
+
import polars_ta
|
161
|
+
|
162
|
+
# 全局设置。优先级低
|
163
|
+
polars_ta.MIN_SAMPLES = 1
|
164
|
+
|
165
|
+
# 指定函数。优先级高
|
166
|
+
ts_mean(CLOSE, 10, min_samples=1)
|
167
|
+
|
168
|
+
```
|
169
|
+
|
173
170
|
## 设计原则
|
174
171
|
|
175
172
|
1. 调用方法由`成员函数`换成`独立函数`。输入输出使用`Expr`,避免使用`Series`
|
@@ -187,28 +184,6 @@ df = df.with_columns([
|
|
187
184
|
|
188
185
|
请参考[nan_to_null](nan_to_null.md)
|
189
186
|
|
190
|
-
## TA-Lib封装的演化
|
191
|
-
|
192
|
-
1. `Expr.map_batches`可以实现调用第三方库,如`TA-Lib, bottleneck`。但因为对输入与输出格式有要求,所以还需要用函数对第三方API封装一下。
|
193
|
-
- 输入输出都只能是一列,如要支持多列需转换成`pl.Struct`。事后`pl.Struct`要拆分需使用`unnest`
|
194
|
-
- 输出必须是`pl.Series`
|
195
|
-
2. 参数多,代码长。开始使用`register_expr_namespace`来简化代码
|
196
|
-
- 实现代码[helper.py](polars_ta/utils/helper.py)
|
197
|
-
- 使用演示[demo_ta1.py](examples/demo_ta1.py)
|
198
|
-
- 优点:使用简单
|
199
|
-
- 不足:`成员函数调用模式`不便于输入到遗传算法中进行因子挖掘
|
200
|
-
- 不足:`__getattribute__`动态方法调用非常灵活,但失去了`IDE`智能提示
|
201
|
-
3. 前缀表达式。将所有的成员函数都转换成公式
|
202
|
-
- 实现代码[wrapper.py](polars_ta/utils/wrapper.py)
|
203
|
-
- 使用演示[demo_ta2.py](examples/demo_ta2.py)
|
204
|
-
- 优点:可以输入到遗传算法
|
205
|
-
- 不足:`__getattribute__`动态方法调用非常灵活,但失去了`IDE`智能提示
|
206
|
-
4. 代码自动生成。
|
207
|
-
- 实现代码[codegen_talib.py](tools/codegen_talib.py)
|
208
|
-
- 生成结果[\_\_init\_\_.py](polars_ta/talib/__init__.py)
|
209
|
-
- 使用演示[demo_ta3.py](examples/demo_ta3.py)
|
210
|
-
- 优点:即可以输入到遗传算法,`IDE`还有智能提示
|
211
|
-
|
212
187
|
## 开发调试
|
213
188
|
|
214
189
|
```commandline
|
@@ -219,6 +194,18 @@ pip install -e .
|
|
219
194
|
|
220
195
|
注意:如果你在`ta`或`tdx`中添加了新的函数,请再运行`tools`下的`prefix_ta.py`或`prefix_tdx.py`,用于生成对应的前缀文件。前缀文件方便在`expr_codegen`中使用
|
221
196
|
|
197
|
+
## 文档生成
|
198
|
+
|
199
|
+
```commandline
|
200
|
+
pip install -r requirements-docs.txt
|
201
|
+
mkdocs build
|
202
|
+
```
|
203
|
+
|
204
|
+
文档生成在`site`目录下,其中的`llms-full.txt`可以作为大语言模型的知识库导入。
|
205
|
+
|
206
|
+
也可以通过以下链接导入:
|
207
|
+
https://polars-ta.readthedocs.io/en/latest/llms-full.txt
|
208
|
+
|
222
209
|
## 参考
|
223
210
|
|
224
211
|
- https://github.com/pola-rs/polars
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.5.1"
|