polars-ta 0.5.1__tar.gz → 0.5.2__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.5.1 → polars_ta-0.5.2}/PKG-INFO +2 -2
- polars_ta-0.5.2/polars_ta/_version.py +1 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/wq/_nb.py +8 -6
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/wq/time_series.py +43 -8
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta.egg-info/PKG-INFO +2 -2
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta.egg-info/requires.txt +1 -1
- {polars_ta-0.5.1 → polars_ta-0.5.2}/pyproject.toml +1 -1
- polars_ta-0.5.1/polars_ta/_version.py +0 -1
- {polars_ta-0.5.1 → polars_ta-0.5.2}/LICENSE +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/README.md +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/__init__.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/candles/__init__.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/candles/cdl1.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/candles/cdl1_limit.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/candles/cdl2.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/noise.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/performance/__init__.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/performance/drawdown.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/performance/returns.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/prefix/__init__.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/prefix/cdl.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/prefix/reports.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/prefix/ta.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/prefix/talib.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/prefix/tdx.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/prefix/wq.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/reports/__init__.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/reports/cicc.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/ta/__init__.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/ta/momentum.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/ta/operators.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/ta/overlap.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/ta/price.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/ta/statistic.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/ta/transform.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/ta/volatility.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/ta/volume.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/talib/__init__.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/__init__.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/_chip.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/_nb.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/_slow.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/arithmetic.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/choice.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/energy.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/logical.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/moving_average.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/over_bought_over_sold.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/pattern.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/pattern_feature.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/pressure_support.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/reference.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/statistic.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/trend.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/trend_feature.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/tdx/volume.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/utils/__init__.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/utils/helper.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/utils/numba_.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/utils/pandas_.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/utils/pit.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/utils/wrapper.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/wq/__init__.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/wq/_slow.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/wq/arithmetic.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/wq/cross_sectional.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/wq/logical.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/wq/preprocess.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/wq/transformational.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta/wq/vector.py +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta.egg-info/SOURCES.txt +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta.egg-info/dependency_links.txt +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/polars_ta.egg-info/top_level.txt +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/setup.cfg +0 -0
- {polars_ta-0.5.1 → polars_ta-0.5.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: polars_ta
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.2
|
4
4
|
Summary: polars expressions
|
5
5
|
Author-email: wukan <wu-kan@163.com>
|
6
6
|
License: MIT License
|
@@ -31,7 +31,7 @@ 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>=1.
|
34
|
+
Requires-Dist: polars>=1.28.0
|
35
35
|
Requires-Dist: polars-ols>=0.3.0
|
36
36
|
Requires-Dist: numpy
|
37
37
|
Requires-Dist: numba
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.5.2"
|
@@ -181,18 +181,20 @@ def roll_triple_corr(x1, x2, x3, window, min_periods):
|
|
181
181
|
|
182
182
|
@jit(nopython=True, nogil=True, fastmath=True, cache=True)
|
183
183
|
def _cum_prod_by(r, by):
|
184
|
+
out = by.copy()
|
184
185
|
for i in range(1, r.shape[0]):
|
185
|
-
if isnan(
|
186
|
-
|
187
|
-
return
|
186
|
+
if isnan(out[i]):
|
187
|
+
out[i] = r[i] * out[i - 1]
|
188
|
+
return out
|
188
189
|
|
189
190
|
|
190
191
|
@jit(nopython=True, nogil=True, fastmath=True, cache=True)
|
191
192
|
def _cum_sum_by(r, by):
|
193
|
+
out = by.copy()
|
192
194
|
for i in range(1, r.shape[0]):
|
193
|
-
if isnan(
|
194
|
-
|
195
|
-
return
|
195
|
+
if isnan(out[i]):
|
196
|
+
out[i] = r[i] + out[i - 1]
|
197
|
+
return out
|
196
198
|
|
197
199
|
|
198
200
|
@jit(nopython=True, nogil=True, fastmath=True, cache=True)
|
@@ -7,7 +7,7 @@ from polars_ols import RollingKwargs
|
|
7
7
|
|
8
8
|
import polars_ta
|
9
9
|
from polars_ta.utils.numba_ import batches_i1_o1, batches_i2_o1, batches_i2_o2, struct_to_numpy
|
10
|
-
from polars_ta.utils.pandas_ import
|
10
|
+
from polars_ta.utils.pandas_ import roll_rank
|
11
11
|
from polars_ta.wq._nb import roll_argmax, roll_argmin, roll_co_kurtosis, roll_co_skewness, roll_moment, roll_partial_corr, roll_triple_corr, _cum_prod_by, _cum_sum_by, _signals_to_size, _cum_sum_reset, _sum_split_by, roll_decay_linear, roll_decay_exp_window, roll_prod
|
12
12
|
|
13
13
|
|
@@ -555,18 +555,51 @@ def ts_ir(x: Expr, d: int = 1, min_samples: Optional[int] = None) -> Expr:
|
|
555
555
|
return ts_mean(x, d, min_samples) / ts_std_dev(x, d, 0, min_samples)
|
556
556
|
|
557
557
|
|
558
|
-
def ts_kurtosis(x: Expr, d: int = 5, min_samples: Optional[int] = None) -> Expr:
|
558
|
+
def ts_kurtosis(x: Expr, d: int = 5, bias: bool = False, min_samples: Optional[int] = None) -> Expr:
|
559
559
|
"""kurtosis of x for the last d days
|
560
560
|
|
561
561
|
时序滚动峰度
|
562
562
|
|
563
|
-
|
563
|
+
Parameters
|
564
|
+
----------
|
565
|
+
x
|
566
|
+
d
|
567
|
+
bias
|
568
|
+
有偏
|
569
|
+
min_samples
|
570
|
+
|
571
|
+
Notes
|
572
|
+
-----
|
573
|
+
`bias=False`时与`pandas`结果一样
|
574
|
+
|
575
|
+
Examples
|
564
576
|
--------
|
565
|
-
|
577
|
+
```python
|
578
|
+
df = pl.DataFrame({
|
579
|
+
'a': [None, 1, 2, 3, 4, 999],
|
580
|
+
}).with_columns(
|
581
|
+
out1=pl.col('a').map_batches(lambda x: pl.Series(pd.Series(x).rolling(4).kurt())),
|
582
|
+
out2=ts_kurtosis(pl.col('a'), 4),
|
583
|
+
)
|
584
|
+
|
585
|
+
shape: (6, 3)
|
586
|
+
┌──────┬──────────┬──────────┐
|
587
|
+
│ a ┆ out1 ┆ out2 │
|
588
|
+
│ --- ┆ --- ┆ --- │
|
589
|
+
│ i64 ┆ f64 ┆ f64 │
|
590
|
+
╞══════╪══════════╪══════════╡
|
591
|
+
│ null ┆ null ┆ null │
|
592
|
+
│ 1 ┆ null ┆ null │
|
593
|
+
│ 2 ┆ null ┆ null │
|
594
|
+
│ 3 ┆ null ┆ null │
|
595
|
+
│ 4 ┆ -1.2 ┆ -1.2 │
|
596
|
+
│ 999 ┆ 3.999946 ┆ 3.999946 │
|
597
|
+
└──────┴──────────┴──────────┘
|
598
|
+
```
|
566
599
|
|
567
600
|
"""
|
568
|
-
minp = min_samples or polars_ta.MIN_SAMPLES
|
569
|
-
return x.
|
601
|
+
minp = min_samples or polars_ta.MIN_SAMPLES
|
602
|
+
return x.rolling_kurtosis(d, min_samples=minp, bias=bias)
|
570
603
|
|
571
604
|
|
572
605
|
def ts_l2_norm(x: Expr, d: int = 5, min_samples: Optional[int] = None) -> Expr:
|
@@ -705,7 +738,7 @@ def ts_scale(x: Expr, d: int = 5, min_samples: Optional[int] = None) -> Expr:
|
|
705
738
|
return when(a != b).then((x - a) / (b - a)).otherwise(0)
|
706
739
|
|
707
740
|
|
708
|
-
def ts_skewness(x: Expr, d: int = 5, bias: bool = False) -> Expr:
|
741
|
+
def ts_skewness(x: Expr, d: int = 5, bias: bool = False, min_samples: Optional[int] = None) -> Expr:
|
709
742
|
"""Return skewness of x for the past d days
|
710
743
|
|
711
744
|
时序滚动偏度
|
@@ -716,13 +749,15 @@ def ts_skewness(x: Expr, d: int = 5, bias: bool = False) -> Expr:
|
|
716
749
|
d
|
717
750
|
bias
|
718
751
|
有偏
|
752
|
+
min_samples
|
719
753
|
|
720
754
|
Notes
|
721
755
|
-----
|
722
756
|
`bias=False`时与`pandas`结果一样
|
723
757
|
|
724
758
|
"""
|
725
|
-
|
759
|
+
minp = min_samples or polars_ta.MIN_SAMPLES
|
760
|
+
return x.rolling_skew(d, min_samples=minp, bias=bias)
|
726
761
|
|
727
762
|
|
728
763
|
def ts_std_dev(x: Expr, d: int = 5, ddof: int = 0, min_samples: Optional[int] = None) -> Expr:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: polars_ta
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.2
|
4
4
|
Summary: polars expressions
|
5
5
|
Author-email: wukan <wu-kan@163.com>
|
6
6
|
License: MIT License
|
@@ -31,7 +31,7 @@ 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>=1.
|
34
|
+
Requires-Dist: polars>=1.28.0
|
35
35
|
Requires-Dist: polars-ols>=0.3.0
|
36
36
|
Requires-Dist: numpy
|
37
37
|
Requires-Dist: numba
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "0.5.1"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|