polars-ta 0.4.6__py3-none-any.whl → 0.5.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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: polars_ta
3
- Version: 0.4.6
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>=0.20.19
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
@@ -1,5 +1,5 @@
1
- polars_ta/__init__.py,sha256=UfRKvBoFTFhGlL9fNsarlPs0_FV6kxM1vfWvJD5YBe8,53
2
- polars_ta/_version.py,sha256=bbBpXE_PBbo_SaI807mDML0QJywD0_ufCDPgAMlDHaE,22
1
+ polars_ta/__init__.py,sha256=ig6f6c1AMSpntwKjqaX3msBzVIwkI7J776IujEmiuvA,123
2
+ polars_ta/_version.py,sha256=eZ1bOun1DDVV0YLOBW4wj2FP1ajReLjbIrGmzN7ASBw,22
3
3
  polars_ta/noise.py,sha256=LJHubBqnWlU3Bz84z07N1JB-b-hAMW2rgBF1BT4m0FE,1471
4
4
  polars_ta/candles/__init__.py,sha256=AW68IuFC0gD4_OyjwLP3p22WSzSIYqlSrsS9fW_15xw,141
5
5
  polars_ta/candles/cdl1.py,sha256=RnRu1QzpqEt5y0-1hlfZRUvza1no-Gj4x_dx2QWxr5A,3130
@@ -26,7 +26,7 @@ polars_ta/ta/statistic.py,sha256=dS5dPBszbdlroJ9u5aXBniJmKgPQnuh9zE7miYKzICs,968
26
26
  polars_ta/ta/transform.py,sha256=c4s5l6khVqIer50g6oScdZ1EEPWYANeKm64AkBkPrtY,1789
27
27
  polars_ta/ta/volatility.py,sha256=yQDKLxos521y3RzywOcE0hTj3qIG_2mfqpARpdxQ1KU,836
28
28
  polars_ta/ta/volume.py,sha256=fPd9Po30kFu-cSmYoRQP4_Ypi9oSWROj650-mjwlfwM,739
29
- polars_ta/talib/__init__.py,sha256=bdNWsIrLlaOU2DVZWiFVBoQEBWtz-BJ1_4hAR5fa1H0,71818
29
+ polars_ta/talib/__init__.py,sha256=UZIkJ6tDYTcxBuKqjeKW93Ya_VyzTtNjXefoTqMd5P8,69701
30
30
  polars_ta/tdx/__init__.py,sha256=HBVPri6GwiEsFx4op0ZxDa3Yk4MbnPZgth5xJhtnxiA,662
31
31
  polars_ta/tdx/_chip.py,sha256=2eCe-y_0DcBivVjQHXlFwAiY410-hH-KKPrsUcRJcyk,3832
32
32
  polars_ta/tdx/_nb.py,sha256=IV3XrgSYPoR4jnOOT8p7jJWGtnoRrHLw5-fnIOfmMvA,2192
@@ -47,22 +47,22 @@ polars_ta/tdx/trend_feature.py,sha256=uNc4Z46Kyd7Prl0Ftl2ljSAXztTzQtbO28p7gy8iMv
47
47
  polars_ta/tdx/volume.py,sha256=juYM4Qlx2BX5okRCSwuf-6kRUETqDF7MVWUbYIzc4ww,901
48
48
  polars_ta/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
49
  polars_ta/utils/helper.py,sha256=rqxBhmA-RhpHd1-qxdYi7OEZloQpPxR30Kz8fJ_hLic,6254
50
- polars_ta/utils/numba_.py,sha256=HzizWbCJ8qJs-_3RwCqb33XlXMULI5UG1jUgleBNWZk,2808
51
- polars_ta/utils/pandas_.py,sha256=xdh-vc5I8RPYGVLh2WQkIwefPsdaah7fa7sb901vdj8,1956
50
+ polars_ta/utils/numba_.py,sha256=jiOxEZjdGBr8aFivCQbJllBsZCfQsBJXQ-DyGhTS2cI,5832
51
+ polars_ta/utils/pandas_.py,sha256=codb51l45TUMngY55twQaUPUxnffjvj8UEOm35zFpNE,1989
52
52
  polars_ta/utils/pit.py,sha256=YNgUE6mbwhrtA-7wyOL0PCUDdwfTQouXwage-cK6efY,4312
53
53
  polars_ta/utils/wrapper.py,sha256=jbR-ZQdzBf5iWvtnJ1HsN9HdepmDbU7fUj4w8Bt2BkU,3422
54
54
  polars_ta/wq/__init__.py,sha256=C3YYJc997XCUI7H_afGT_mj2m4UdHMcql4sboCVvrXU,327
55
- polars_ta/wq/_nb.py,sha256=cYEUlEvLQJCjt5_o_1qnWrJ2eWMamwUedOsLwYTq_Oo,9470
55
+ polars_ta/wq/_nb.py,sha256=Vh7n0_uOK9sTpmSYHCdLpu-Hc8QrOF0ugK_wgRWJXlg,11233
56
56
  polars_ta/wq/_slow.py,sha256=MfWg9FYX8NGNLWN4ezI_awf3pPTqhSq_zo0LOS4nCzw,937
57
- polars_ta/wq/arithmetic.py,sha256=rLKfp1Kvu_BFJKH7t7zp0jkfVHRn_HjkDUC0d-Jq9q8,23445
57
+ polars_ta/wq/arithmetic.py,sha256=rVFWhHpmgsMRfPj08VaXCrKapIZ3TP7-1Nc8wBi2BpE,23682
58
58
  polars_ta/wq/cross_sectional.py,sha256=mHLwuXu9m4ladb6cUJVnH4OofliBSkpzmIZu6TtBoe4,13697
59
59
  polars_ta/wq/logical.py,sha256=5lttGwQi9oHml7soqmxEwgIVVLpeWO7JSXmQ3-TUqlU,2261
60
60
  polars_ta/wq/preprocess.py,sha256=xbESoAtsbQgXJMhnLzg4r5o2H9uwPyHfySg5skk_DUg,4188
61
- polars_ta/wq/time_series.py,sha256=L74rqAUyZS6rI3S3R9aIwrKosGFFHWxP3BESNJ67ak8,27093
61
+ polars_ta/wq/time_series.py,sha256=joPwnC9uPwWch0oqJsc4gbOmhlFsQIT1sEekrPkFGUU,31043
62
62
  polars_ta/wq/transformational.py,sha256=ktluqo-lcxWysFL3huNypId0EFR1wn1PmyBGO180UQo,7194
63
63
  polars_ta/wq/vector.py,sha256=Qs-mHC2YsiWXoyMuXZZPzd5W5w_HL1ZgDCj9wRAnqmQ,1902
64
- polars_ta-0.4.6.dist-info/LICENSE,sha256=nREFtfwxWCCYD-ZA1jMzhhxMyTz-wGWFlnkpgg0DCtQ,1062
65
- polars_ta-0.4.6.dist-info/METADATA,sha256=fGq4fKlaXhEFSNeLl4rne1t56Xasvyw3Vbbnagn38yg,10711
66
- polars_ta-0.4.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
67
- polars_ta-0.4.6.dist-info/top_level.txt,sha256=eat2IhP79-dIGA4DAFOz1o-95--UDqfjeIgmU9TBsDQ,10
68
- polars_ta-0.4.6.dist-info/RECORD,,
64
+ polars_ta-0.5.1.dist-info/licenses/LICENSE,sha256=nREFtfwxWCCYD-ZA1jMzhhxMyTz-wGWFlnkpgg0DCtQ,1062
65
+ polars_ta-0.5.1.dist-info/METADATA,sha256=jy8YfW0sYfO_Xz7Xl9yFK3aQqSCA9NNmyCtpM6FufD8,8633
66
+ polars_ta-0.5.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
67
+ polars_ta-0.5.1.dist-info/top_level.txt,sha256=eat2IhP79-dIGA4DAFOz1o-95--UDqfjeIgmU9TBsDQ,10
68
+ polars_ta-0.5.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5