ts-quant 0.1.0__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.
ts_quant-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 TS-Quant Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.4
2
+ Name: ts-quant
3
+ Version: 0.1.0
4
+ Summary: GPU-accelerated quantitative time-series feature extraction for financial data
5
+ Author: AnalisaSaham
6
+ License: MIT
7
+ Keywords: time-series,feature-extraction,gpu,quantitative-finance,catboost
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Financial and Insurance Industry
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Topic :: Office/Business :: Financial :: Investment
15
+ Requires-Python: >=3.8
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: torch>=2.0.0
19
+ Requires-Dist: numpy>=1.24.0
20
+ Requires-Dist: pandas>=1.5.0
21
+ Requires-Dist: tqdm>=4.65.0
22
+ Provides-Extra: signatures
23
+ Requires-Dist: signatory>=1.2.6; extra == "signatures"
24
+ Provides-Extra: test
25
+ Requires-Dist: pytest>=7.0; extra == "test"
26
+ Requires-Dist: pycatch22; extra == "test"
27
+ Requires-Dist: PyWavelets; extra == "test"
28
+ Dynamic: license-file
29
+
30
+ # ts-quant šŸš€
31
+
32
+ **GPU-Accelerated Quantitative Feature Extraction for Financial Time Series**
33
+
34
+ [![PyPI](https://img.shields.io/pypi/v/ts-quant)](https://pypi.org/project/ts-quant/)
35
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
36
+ [![PyTorch](https://img.shields.io/badge/PyTorch-2.0+-ee4c2c.svg)](https://pytorch.org/)
37
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
38
+
39
+ Extract **2000+ quantitative features** from OHLCV stock data using 5 powerful engines — all running on GPU via PyTorch.
40
+
41
+ ## šŸŽÆ Why ts-quant?
42
+
43
+ | Feature | tsfresh (CPU) | ts-quant (GPU) |
44
+ |---|---|---|
45
+ | Speed | ~60s per stock | ~0.3s per stock |
46
+ | Memory | OOM on large data | VRAM-managed, crash-proof |
47
+ | Features | 794 (statistical only) | 2000+ (statistical + wavelets + rocket + signatures) |
48
+ | GPU | āŒ | āœ… PyTorch/CUDA |
49
+
50
+ ## šŸ“¦ Installation
51
+
52
+ ```bash
53
+ pip install ts-quant
54
+ ```
55
+
56
+ **Requirements:** Python 3.9+, PyTorch 2.0+ (with CUDA for GPU acceleration)
57
+
58
+ ## šŸš€ Quick Start
59
+
60
+ ```python
61
+ import pandas as pd
62
+ from ts_quant import generate_features
63
+
64
+ # Load your OHLCV data
65
+ df = pd.read_csv('stocks.csv')
66
+ # Expected columns: symbol, date, close, volume, open, high, low
67
+
68
+ # Extract features (GPU)
69
+ df_features = generate_features(
70
+ df,
71
+ device='cuda', # 'cpu' for CPU-only
72
+ tsfresh_mode='comprehensive',
73
+ window_sizes=[20],
74
+ )
75
+
76
+ print(f"New features: {df_features.shape[1] - df.shape[1]}")
77
+ ```
78
+
79
+ ## šŸ”§ 5 Feature Engines
80
+
81
+ ### Engine A: MultiRocket šŸŽÆ
82
+ Random convolutional kernels with multi-scale dilations.
83
+ ```python
84
+ from ts_quant import RocketEngine
85
+
86
+ engine = RocketEngine(n_kernels=250)
87
+ features, names = engine.extract(x) # x: [B, T]
88
+ # → 1000 features (250 kernels Ɨ 4 pooling ops)
89
+ ```
90
+
91
+ ### Engine B: Catch22 šŸ“Š
92
+ 22 canonical time-series features (ACF, DFA, entropy, etc.).
93
+ ```python
94
+ from ts_quant import Catch22Engine
95
+
96
+ engine = Catch22Engine()
97
+ features, names = engine.extract(x)
98
+ # → 22 features per window
99
+ ```
100
+
101
+ ### Engine C: Path Signatures āœļø
102
+ Ordered interaction features via iterated integrals.
103
+ ```python
104
+ from ts_quant import SignaturesEngine
105
+
106
+ engine = SignaturesEngine(depth=3, channels=['close', 'volume'])
107
+ features, names = engine.extract(x_multivariate) # [B, T, d]
108
+ # → d + d² + d³ features
109
+ ```
110
+
111
+ ### Engine D: Wavelets 🌊
112
+ Discrete wavelet transform (Haar, db4, db2, sym4).
113
+ ```python
114
+ from ts_quant import WaveletsEngine
115
+
116
+ engine = WaveletsEngine(wavelet_types=['haar', 'db4'])
117
+ features, names = engine.extract(x)
118
+ # → 62 features (energy, entropy, mean, std, max per level)
119
+ ```
120
+
121
+ ### Engine E: Tsfresh Complete šŸ“ˆ
122
+ 63 mathematical functions, 361 features in comprehensive mode.
123
+ ```python
124
+ from ts_quant import TsfreshEngine
125
+
126
+ engine = TsfreshEngine(mode='comprehensive')
127
+ features, names = engine.extract(x)
128
+ # → 361 features (statistics, ACF, FFT, entropy, trend, ...)
129
+ ```
130
+
131
+ ## ⚔ VRAM Management
132
+
133
+ ts-quant automatically manages GPU memory to prevent OOM crashes:
134
+
135
+ ```python
136
+ # Works on any GPU size (8GB - 80GB)
137
+ df_features = generate_features(
138
+ df,
139
+ device='cuda',
140
+ max_vram_gb=8, # Optional: manual VRAM limit
141
+ )
142
+ ```
143
+
144
+ ## šŸ”¬ Feature Selection
145
+
146
+ Built-in redundancy removal:
147
+
148
+ ```python
149
+ from ts_quant import auto_select_features
150
+
151
+ selected, names = auto_select_features(
152
+ features_tensor,
153
+ feature_names,
154
+ correlation_threshold=0.95, # Remove highly correlated
155
+ )
156
+ ```
157
+
158
+ ## šŸ“ Input Format
159
+
160
+ Your DataFrame should have this structure:
161
+
162
+ | symbol | date | open | high | low | close | volume |
163
+ |--------|------|------|------|-----|-------|--------|
164
+ | BBCA | 2024-01-02 | 9500 | 9600 | 9400 | 9550 | 1000000 |
165
+ | BBRI | 2024-01-02 | 5200 | 5300 | 5100 | 5250 | 2000000 |
166
+
167
+ ## šŸ—ļø Architecture
168
+
169
+ ```
170
+ ts-quant/
171
+ ā”œā”€ā”€ ts_quant/
172
+ │ ā”œā”€ā”€ api.py # Orchestrator — generate_features()
173
+ │ ā”œā”€ā”€ core/
174
+ │ │ ā”œā”€ā”€ memory_manager.py # Dynamic VRAM management
175
+ │ │ ā”œā”€ā”€ tensor_utils.py # DataFrame ↔ Tensor conversion
176
+ │ │ └── windowing.py # GPU sliding windows
177
+ │ ā”œā”€ā”€ engines/
178
+ │ │ ā”œā”€ā”€ rocket.py # Engine A: MultiRocket
179
+ │ │ ā”œā”€ā”€ catch22.py # Engine B: Catch22
180
+ │ │ ā”œā”€ā”€ signatures.py # Engine C: Path Signatures
181
+ │ │ ā”œā”€ā”€ wavelets.py # Engine D: Wavelets
182
+ │ │ └── tsfresh_core.py # Engine E: Tsfresh Complete
183
+ │ └── utils/
184
+ │ ā”œā”€ā”€ config.py # Default configurations
185
+ │ ā”œā”€ā”€ validation.py # Input validation
186
+ │ └── feature_selection.py # Redundancy removal
187
+ └── tests/
188
+ ```
189
+
190
+ ## šŸ“„ License
191
+
192
+ MIT License
@@ -0,0 +1,163 @@
1
+ # ts-quant šŸš€
2
+
3
+ **GPU-Accelerated Quantitative Feature Extraction for Financial Time Series**
4
+
5
+ [![PyPI](https://img.shields.io/pypi/v/ts-quant)](https://pypi.org/project/ts-quant/)
6
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
7
+ [![PyTorch](https://img.shields.io/badge/PyTorch-2.0+-ee4c2c.svg)](https://pytorch.org/)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
9
+
10
+ Extract **2000+ quantitative features** from OHLCV stock data using 5 powerful engines — all running on GPU via PyTorch.
11
+
12
+ ## šŸŽÆ Why ts-quant?
13
+
14
+ | Feature | tsfresh (CPU) | ts-quant (GPU) |
15
+ |---|---|---|
16
+ | Speed | ~60s per stock | ~0.3s per stock |
17
+ | Memory | OOM on large data | VRAM-managed, crash-proof |
18
+ | Features | 794 (statistical only) | 2000+ (statistical + wavelets + rocket + signatures) |
19
+ | GPU | āŒ | āœ… PyTorch/CUDA |
20
+
21
+ ## šŸ“¦ Installation
22
+
23
+ ```bash
24
+ pip install ts-quant
25
+ ```
26
+
27
+ **Requirements:** Python 3.9+, PyTorch 2.0+ (with CUDA for GPU acceleration)
28
+
29
+ ## šŸš€ Quick Start
30
+
31
+ ```python
32
+ import pandas as pd
33
+ from ts_quant import generate_features
34
+
35
+ # Load your OHLCV data
36
+ df = pd.read_csv('stocks.csv')
37
+ # Expected columns: symbol, date, close, volume, open, high, low
38
+
39
+ # Extract features (GPU)
40
+ df_features = generate_features(
41
+ df,
42
+ device='cuda', # 'cpu' for CPU-only
43
+ tsfresh_mode='comprehensive',
44
+ window_sizes=[20],
45
+ )
46
+
47
+ print(f"New features: {df_features.shape[1] - df.shape[1]}")
48
+ ```
49
+
50
+ ## šŸ”§ 5 Feature Engines
51
+
52
+ ### Engine A: MultiRocket šŸŽÆ
53
+ Random convolutional kernels with multi-scale dilations.
54
+ ```python
55
+ from ts_quant import RocketEngine
56
+
57
+ engine = RocketEngine(n_kernels=250)
58
+ features, names = engine.extract(x) # x: [B, T]
59
+ # → 1000 features (250 kernels Ɨ 4 pooling ops)
60
+ ```
61
+
62
+ ### Engine B: Catch22 šŸ“Š
63
+ 22 canonical time-series features (ACF, DFA, entropy, etc.).
64
+ ```python
65
+ from ts_quant import Catch22Engine
66
+
67
+ engine = Catch22Engine()
68
+ features, names = engine.extract(x)
69
+ # → 22 features per window
70
+ ```
71
+
72
+ ### Engine C: Path Signatures āœļø
73
+ Ordered interaction features via iterated integrals.
74
+ ```python
75
+ from ts_quant import SignaturesEngine
76
+
77
+ engine = SignaturesEngine(depth=3, channels=['close', 'volume'])
78
+ features, names = engine.extract(x_multivariate) # [B, T, d]
79
+ # → d + d² + d³ features
80
+ ```
81
+
82
+ ### Engine D: Wavelets 🌊
83
+ Discrete wavelet transform (Haar, db4, db2, sym4).
84
+ ```python
85
+ from ts_quant import WaveletsEngine
86
+
87
+ engine = WaveletsEngine(wavelet_types=['haar', 'db4'])
88
+ features, names = engine.extract(x)
89
+ # → 62 features (energy, entropy, mean, std, max per level)
90
+ ```
91
+
92
+ ### Engine E: Tsfresh Complete šŸ“ˆ
93
+ 63 mathematical functions, 361 features in comprehensive mode.
94
+ ```python
95
+ from ts_quant import TsfreshEngine
96
+
97
+ engine = TsfreshEngine(mode='comprehensive')
98
+ features, names = engine.extract(x)
99
+ # → 361 features (statistics, ACF, FFT, entropy, trend, ...)
100
+ ```
101
+
102
+ ## ⚔ VRAM Management
103
+
104
+ ts-quant automatically manages GPU memory to prevent OOM crashes:
105
+
106
+ ```python
107
+ # Works on any GPU size (8GB - 80GB)
108
+ df_features = generate_features(
109
+ df,
110
+ device='cuda',
111
+ max_vram_gb=8, # Optional: manual VRAM limit
112
+ )
113
+ ```
114
+
115
+ ## šŸ”¬ Feature Selection
116
+
117
+ Built-in redundancy removal:
118
+
119
+ ```python
120
+ from ts_quant import auto_select_features
121
+
122
+ selected, names = auto_select_features(
123
+ features_tensor,
124
+ feature_names,
125
+ correlation_threshold=0.95, # Remove highly correlated
126
+ )
127
+ ```
128
+
129
+ ## šŸ“ Input Format
130
+
131
+ Your DataFrame should have this structure:
132
+
133
+ | symbol | date | open | high | low | close | volume |
134
+ |--------|------|------|------|-----|-------|--------|
135
+ | BBCA | 2024-01-02 | 9500 | 9600 | 9400 | 9550 | 1000000 |
136
+ | BBRI | 2024-01-02 | 5200 | 5300 | 5100 | 5250 | 2000000 |
137
+
138
+ ## šŸ—ļø Architecture
139
+
140
+ ```
141
+ ts-quant/
142
+ ā”œā”€ā”€ ts_quant/
143
+ │ ā”œā”€ā”€ api.py # Orchestrator — generate_features()
144
+ │ ā”œā”€ā”€ core/
145
+ │ │ ā”œā”€ā”€ memory_manager.py # Dynamic VRAM management
146
+ │ │ ā”œā”€ā”€ tensor_utils.py # DataFrame ↔ Tensor conversion
147
+ │ │ └── windowing.py # GPU sliding windows
148
+ │ ā”œā”€ā”€ engines/
149
+ │ │ ā”œā”€ā”€ rocket.py # Engine A: MultiRocket
150
+ │ │ ā”œā”€ā”€ catch22.py # Engine B: Catch22
151
+ │ │ ā”œā”€ā”€ signatures.py # Engine C: Path Signatures
152
+ │ │ ā”œā”€ā”€ wavelets.py # Engine D: Wavelets
153
+ │ │ └── tsfresh_core.py # Engine E: Tsfresh Complete
154
+ │ └── utils/
155
+ │ ā”œā”€ā”€ config.py # Default configurations
156
+ │ ā”œā”€ā”€ validation.py # Input validation
157
+ │ └── feature_selection.py # Redundancy removal
158
+ └── tests/
159
+ ```
160
+
161
+ ## šŸ“„ License
162
+
163
+ MIT License
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ts-quant"
7
+ version = "0.1.0"
8
+ description = "GPU-accelerated quantitative time-series feature extraction for financial data"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.8"
12
+ authors = [
13
+ {name = "AnalisaSaham"},
14
+ ]
15
+ keywords = ["time-series", "feature-extraction", "gpu", "quantitative-finance", "catboost"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Financial and Insurance Industry",
19
+ "Intended Audience :: Science/Research",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Programming Language :: Python :: 3",
22
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
23
+ "Topic :: Office/Business :: Financial :: Investment",
24
+ ]
25
+
26
+ dependencies = [
27
+ "torch>=2.0.0",
28
+ "numpy>=1.24.0",
29
+ "pandas>=1.5.0",
30
+ "tqdm>=4.65.0",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ signatures = ["signatory>=1.2.6"]
35
+ test = [
36
+ "pytest>=7.0",
37
+ "pycatch22",
38
+ "PyWavelets",
39
+ ]
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["."]
43
+ include = ["ts_quant*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+