dquant 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.
dquant-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Denis Makarov
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.
dquant-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: dquant
3
+ Version: 0.1.0
4
+ Summary: ML library
5
+ Author: Denis Makarov
6
+ Project-URL: Homepage, https://github.com/artrdon/dquant
7
+ Project-URL: Issues, https://github.com/artrdon/dquant/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ License-File: LICENSE
13
+ Requires-Dist: cycler>=0.11.0
14
+ Requires-Dist: joblib>=1.2.0
15
+ Requires-Dist: lightgbm>=3.3.0
16
+ Requires-Dist: matplotlib>=3.5.0
17
+ Requires-Dist: numpy>=1.21.0
18
+ Requires-Dist: onnx>=1.14.0
19
+ Requires-Dist: onnxruntime>=1.15.0
20
+ Requires-Dist: pandas>=1.5.0
21
+ Requires-Dist: scikit-learn>=1.2.0
22
+ Requires-Dist: skl2onnx>=1.14.0
23
+ Requires-Dist: xgboost>=1.7.0
24
+ Requires-Dist: onnxconverter-common>=1.9.0
25
+ Requires-Dist: onnxmltools>=1.11.0
26
+ Dynamic: license-file
dquant-0.1.0/README.md ADDED
@@ -0,0 +1,266 @@
1
+ # dquant
2
+
3
+ [![PyPI
4
+ version](https://img.shields.io/pypi/v/dquant)](https://pypi.org/project/dquant/)
5
+ [![Python](https://img.shields.io/pypi/pyversions/dquant)](https://pypi.org/project/dquant/)
6
+ [![License](https://img.shields.io/github/license/USERNAME/dquant)](LICENSE)
7
+ [![Downloads](https://img.shields.io/pypi/dm/dquant)](https://pypi.org/project/dquant/)
8
+ [![Issues](https://img.shields.io/github/issues/USERNAME/dquant)](https://github.com/USERNAME/dquant/issues)
9
+
10
+ **dquant** --- это Python‑библиотека для **автоматического
11
+ прогнозирования волатильности финансовых временных рядов с помощью
12
+ машинного обучения**.
13
+
14
+ Библиотека берёт на себя весь ML‑пайплайн --- от сырых рыночных данных
15
+ до готового прогноза:
16
+
17
+ - автоматический feature engineering\
18
+ - построение целевой переменной\
19
+ - корректное разделение временных рядов\
20
+ - обучение модели\
21
+ - визуализацию обучения\
22
+ - прогнозирование
23
+
24
+ Цель проекта --- **сделать методы машинного обучения доступными
25
+ трейдерам, количественным аналитикам и разработчикам торговых систем**.
26
+
27
+ ------------------------------------------------------------------------
28
+
29
+ # Почему dquant
30
+
31
+ В большинстве проектов по финансовому ML приходится писать сотни строк
32
+ инфраструктурного кода:
33
+
34
+ - создание лагов
35
+ - построение признаков
36
+ - расчёт волатильности
37
+ - предотвращение look‑ahead bias
38
+ - корректная валидация временных рядов
39
+ - обучение моделей
40
+
41
+ dquant автоматизирует этот процесс.
42
+
43
+ То, что обычно требует десятков файлов и сотен строк кода, можно сделать
44
+ так:
45
+
46
+ ``` python
47
+ import yfinance as yf
48
+ from dquant import VolatilityGB
49
+
50
+ df = yf.download("AAPL", start="2020-01-01")
51
+
52
+ model = VolatilityGB()
53
+ model.fit(df, horizon=21)
54
+
55
+ prediction = model.predict(df.tail(50))
56
+ print(prediction)
57
+ ```
58
+
59
+ ------------------------------------------------------------------------
60
+
61
+ # Основные возможности
62
+
63
+ ## Автоматический Feature Engineering
64
+
65
+ При вызове `.fit()` библиотека автоматически создаёт признаки:
66
+
67
+ **Лаги** - close lag 1, 2, 3, 5, 10, 20 - volume lag
68
+
69
+ **Скользящие средние** - SMA - EMA
70
+
71
+ **Историческая волатильность** - rolling standard deviation - historical
72
+ volatility
73
+
74
+ **Отношения цен** - high / low - close / open - (close − open) / close
75
+
76
+ **Индикаторы волатильности** - ATR - Parkinson volatility -
77
+ Rogers‑Satchell volatility
78
+
79
+ **Временные признаки** - день недели - месяц - час (для intraday данных)
80
+
81
+ **Технические индикаторы** - RSI - MACD - Bollinger Bands width
82
+
83
+ Все признаки создаются **без использования будущих данных**.
84
+
85
+ ------------------------------------------------------------------------
86
+
87
+ ## Автоматическое построение таргета
88
+
89
+ Целевая переменная --- реализованная волатильность на будущем горизонте.
90
+
91
+ По умолчанию:
92
+
93
+ std(log_returns over horizon)
94
+
95
+ Таргет автоматически сдвигается вперёд, чтобы исключить утечку
96
+ информации.
97
+
98
+ ------------------------------------------------------------------------
99
+
100
+ ## Модели
101
+
102
+ По умолчанию используется:
103
+
104
+ **XGBoost**
105
+
106
+ Также поддерживается:
107
+
108
+ **LightGBM**
109
+
110
+ Поддерживаются:
111
+
112
+ - early stopping
113
+ - ограничение числа деревьев
114
+ - валидация
115
+ - визуализация обучения
116
+
117
+ ------------------------------------------------------------------------
118
+
119
+ ## Визуализация обучения
120
+
121
+ После `.fit()` можно построить график:
122
+
123
+ - ошибка train
124
+ - ошибка validation
125
+ - количество деревьев
126
+
127
+ Это позволяет обнаружить:
128
+
129
+ - переобучение
130
+ - недообучение
131
+ - оптимальное число деревьев
132
+
133
+ ------------------------------------------------------------------------
134
+
135
+ ## Сохранение моделей
136
+
137
+ model.save("model.vol")
138
+ model.load("model.vol")
139
+
140
+ Сохраняются:
141
+
142
+ - обученная модель
143
+ - признаки
144
+ - параметры
145
+ - конфигурация
146
+
147
+ ------------------------------------------------------------------------
148
+
149
+ # Установка
150
+
151
+ pip install dquant
152
+
153
+ Основные зависимости:
154
+
155
+ - pandas
156
+ - numpy
157
+ - scikit-learn
158
+ - xgboost
159
+ - lightgbm
160
+ - matplotlib
161
+
162
+ ------------------------------------------------------------------------
163
+
164
+ # Быстрый старт
165
+
166
+ ``` python
167
+ import yfinance as yf
168
+ from dquant import VolatilityGB
169
+
170
+ df = yf.download("AAPL", start="2020-01-01", end="2024-01-01")
171
+
172
+ model = VolatilityGB()
173
+
174
+ model.fit(
175
+ df,
176
+ horizon=21,
177
+ max_trees=300
178
+ )
179
+
180
+ last_data = df.iloc[-50:]
181
+
182
+ prediction = model.predict(last_data)
183
+
184
+ print(f"Ожидаемая волатильность: {prediction:.2%}")
185
+ ```
186
+
187
+ ------------------------------------------------------------------------
188
+
189
+ # Кастомизация
190
+
191
+ Можно передать собственную функцию генерации признаков:
192
+
193
+ ``` python
194
+ def my_features(df):
195
+ df = df.copy()
196
+ df["ratio"] = df["high"] / df["low"]
197
+ df["volume_ma"] = df["volume"].rolling(5).mean()
198
+ return df
199
+
200
+ model.fit(df, horizon=10, feature_engineering=my_features)
201
+ ```
202
+
203
+ ------------------------------------------------------------------------
204
+
205
+ # Архитектура проекта
206
+
207
+ dquant/
208
+
209
+ volatility_gb.py
210
+ features.py
211
+ target.py
212
+ validation.py
213
+ plotting.py
214
+ metrics.py
215
+ config.py
216
+
217
+ ------------------------------------------------------------------------
218
+
219
+ # Требования к данным
220
+
221
+ Входные данные должны быть `pandas DataFrame`.
222
+
223
+ Поддерживаемые столбцы:
224
+
225
+ open
226
+ high
227
+ low
228
+ close
229
+ volume
230
+
231
+ Минимально:
232
+
233
+ close
234
+
235
+ Требования:
236
+
237
+ - данные отсортированы по времени
238
+ - индекс числовой или DatetimeIndex
239
+
240
+ ------------------------------------------------------------------------
241
+
242
+ # Roadmap
243
+
244
+ Планируемые функции:
245
+
246
+ - LSTM модели
247
+ - Prophet
248
+ - автоматический подбор гиперпараметров (Optuna)
249
+ - прогноз волатильности портфеля
250
+ - real‑time данные
251
+ - интеграция с брокерскими API
252
+ - web dashboard
253
+
254
+ ------------------------------------------------------------------------
255
+
256
+ # Сообщество
257
+
258
+ Telegram чат:
259
+
260
+ https://t.me/dquant_chat
261
+
262
+ ------------------------------------------------------------------------
263
+
264
+ # Лицензия
265
+
266
+ MIT License
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "dquant"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name="Denis Makarov" },
10
+ ]
11
+ description = "ML library"
12
+ #readme = "README.md"
13
+ requires-python = ">=3.7"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+
20
+ # Зависимости, которые будут установлены вместе с вашей библиотекой
21
+ dependencies = [
22
+ "cycler>=0.11.0",
23
+ "joblib>=1.2.0",
24
+ "lightgbm>=3.3.0",
25
+ "matplotlib>=3.5.0",
26
+ "numpy>=1.21.0",
27
+ "onnx>=1.14.0",
28
+ "onnxruntime>=1.15.0",
29
+ "pandas>=1.5.0",
30
+ "scikit-learn>=1.2.0",
31
+ "skl2onnx>=1.14.0",
32
+ "xgboost>=1.7.0",
33
+ "onnxconverter-common>=1.9.0",
34
+ "onnxmltools>=1.11.0"
35
+ ]
36
+ # Если нужны опциональные зависимости (например, для разработки)
37
+ #[project.optional-dependencies]
38
+ #dev = ["pytest", "black"]
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/artrdon/dquant"
42
+ Issues = "https://github.com/artrdon/dquant/issues"
dquant-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes