datahub_binary 1.4.9__cp312-cp312-win_amd64.whl → 1.4.10__cp312-cp312-win_amd64.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.
datahub/dbo/sr.pyi CHANGED
@@ -38,6 +38,7 @@ class StarRocks(Database):
38
38
  def get_seq_y_data(self, start_time: datetime, end_time: datetime, factors: Sequence[str] = (), instruments: Sequence[str] = ()) -> pl.DataFrame: ...
39
39
  def get_seq_y_stat(self, start_time: datetime, end_time: datetime, stat_type: str, factors: Sequence[str] = (), instruments: Sequence[str] = ()) -> pl.DataFrame: ...
40
40
  def get_ex_factor_info(self, instruments: Sequence[str] = (), trade_date: date | None = None) -> pl.DataFrame: ...
41
+ def get_trading_days(self, start_date: date, end_date: date, market: str = 'XSHG') -> list[date]: ...
41
42
  def get_kline(self, freq: str, instruments: Sequence[str] = (), start_time: datetime | None = None, end_time: datetime | None = None, adj_method: str | None = None) -> pl.DataFrame: ...
42
43
  def get_md_transaction(self, start_date: date, end_date: date, instruments: Sequence[str] = (), markets: Sequence[str] = ()) -> pl.DataFrame: ...
43
44
  def get_instrument_industry(self, trade_date: date, industry_source: str = 'sws', industry_level: Literal[1, 2, 3] = 1, use_last: bool = False) -> pl.DataFrame: ...
Binary file
@@ -0,0 +1,252 @@
1
+ Metadata-Version: 2.4
2
+ Name: datahub_binary
3
+ Version: 1.4.10
4
+ Summary: A comprehensive Python library for data processing, integration, and management.
5
+ Requires-Python: <3.13,>=3.9
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: SQLAlchemy>=1.0.0
8
+ Requires-Dist: httpx[socks]>=0.28.0
9
+ Requires-Dist: starrocks>=1.0.0
10
+ Requires-Dist: polars-lts-cpu>=1.0.0; sys_platform == "darwin"
11
+ Requires-Dist: polars>=1.0.0; sys_platform != "darwin"
12
+ Requires-Dist: loguru>=0.7.3
13
+ Requires-Dist: numpy>=2.0.0
14
+ Requires-Dist: protobuf>=6.30.1
15
+ Requires-Dist: redis>=5.2.1
16
+ Requires-Dist: psycopg2-binary>=2.9.10
17
+ Requires-Dist: paramiko>=3.5.1
18
+ Requires-Dist: toml>=0.10.0
19
+ Requires-Dist: pydantic>=2.11.3
20
+ Requires-Dist: lark-oapi>=1.4.14
21
+ Requires-Dist: pyzmq>=26.4.0
22
+ Requires-Dist: sortedcontainers>=2.4.0
23
+
24
+ ### 使用示例
25
+
26
+ ```python3
27
+ import os
28
+ from datetime import datetime
29
+
30
+ import polars as pl
31
+
32
+ os.environ["LOGURU_LEVEL"] = "TRACE"
33
+
34
+ from datahub import *
35
+
36
+
37
+ def main():
38
+ starrocks_setting = StarRocksSetting(
39
+ host="xxx",
40
+ db_port=9030,
41
+ http_port=8040,
42
+ username="xxx",
43
+ password="xxx",
44
+ # sftp=sftp_setting # 设置sftp后会启用大查询缓存
45
+ )
46
+
47
+ setting = Setting(
48
+ starrocks=starrocks_setting,
49
+ )
50
+ datahub = DataHub(setting)
51
+ start_time = datetime(2024, 12, 19)
52
+ end_time = datetime(2024, 12, 29)
53
+ # pl.Config.set_tbl_cols(-1) # -1 表示显示所有列
54
+ # pl.Config.set_fmt_str_lengths(100) # 设置字符串显示长度
55
+ # pl.Config.set_tbl_width_chars(200) # 设置表格宽度字符数
56
+
57
+ # 发送监控报警
58
+ # mylogger = logger.Logger("test")
59
+ # mylogger.monitor.to("alpha运维").info("test")
60
+ # mylogger.monitor.to("alpha运维").at("all").error("test")
61
+
62
+ print("获取交易日")
63
+ result = datahub.get_trading_days(start_time, end_time)
64
+ print(result)
65
+
66
+ print("获取指定日期, 指定indicator 可用标的")
67
+ result = datahub.get_instrument_list(
68
+ trade_date=start_time.date(),
69
+ indicators=["premiums_income"],
70
+ )
71
+ print(result)
72
+
73
+ print("获取指定日期标的信息")
74
+ result = datahub.get_instrument_info(
75
+ trade_date=start_time.date(), market="XSHG", instrument_type="spot")
76
+ print(result)
77
+
78
+ print("获取指定日期标的池")
79
+ result = datahub.get_universe(trade_date=datetime(
80
+ 2025, 2, 20), universe="basic_alpha")
81
+ print(result)
82
+
83
+ print("获取某日逐笔成交")
84
+ result = datahub.get_md_transaction(
85
+ start_date=datetime(2025, 1, 27).date(),
86
+ instruments=["508086.XSHG"],
87
+ )
88
+ print(result)
89
+
90
+ print("获取某日快照行情")
91
+ result = datahub.get_md_snapshot(
92
+ start_date=datetime(2025, 1, 27).date(),
93
+ instruments=["508086.XSHG"],
94
+ )
95
+ print(result)
96
+
97
+ print("获取某日快照行情")
98
+ result = datahub.get_trading_days(
99
+ start_date=start_time.date(),
100
+ end_date=end_time.date(),
101
+ )
102
+ print(result)
103
+
104
+ print("获取指标值")
105
+ result = datahub.get_indicator_data(
106
+ start_time=start_time,
107
+ end_time=end_time,
108
+ # indicators=["5min_stat_open"],
109
+ instruments=["600519.XSHG"],
110
+ types=["5min_stat"]
111
+ )
112
+ print(result)
113
+
114
+ print("获取BarDataMatrix")
115
+ bar_data = datahub.get_indicator_matrix(
116
+ trade_time=datetime(2024, 12, 19, 10),
117
+ indicators=["5min_stat_open", "5min_stat_low"],
118
+ instrument_ids=["600519.XSHG", "000001.XSHE", "000002.XSHG"],
119
+ )
120
+ print(bar_data)
121
+
122
+ print("获取BarDataMatrix列表")
123
+ bar_data = datahub.get_indicator_matrix_list(
124
+ start_date=datetime(2024, 12, 19, 10),
125
+ end_date=datetime(2024, 12, 20, 10),
126
+ indicators=["5min_stat_open", "5min_stat_low"],
127
+ instrument_ids=["600519.XSHG", "000001.XSHE", "000002.XSHG"],
128
+ )
129
+ print(bar_data)
130
+
131
+ print("获取因子值")
132
+ result = datahub.get_factor_data(
133
+ start_time=start_time,
134
+ end_time=end_time,
135
+ # factors=["5min_stat_open"],
136
+ instruments=["600519.XSHG"],
137
+ types=["5min_stat"]
138
+ )
139
+ print(result)
140
+
141
+ print("获取因子值矩阵")
142
+ result = datahub.get_factor_matrix(
143
+ trade_time=datetime(2024, 12, 19, 10),
144
+ factors=["5min_stat_open", "5min_stat_low"],
145
+ instrument_ids=["600519.XSHG", "000001.XSHE", "000002.XSHG"],
146
+ )
147
+ print(result)
148
+
149
+ print("获取收益率数据")
150
+ result = datahub.get_return_data(
151
+ start_time=start_time,
152
+ end_time=end_time,
153
+ instruments=["600519.XSHG"],
154
+ )
155
+ print(result)
156
+
157
+ print("获取收益率矩阵")
158
+ result = datahub.get_return_matrix(
159
+ trade_time=datetime(2024, 10, 31, 19, 15),
160
+ factors=["forward_ret_raw_1d"],
161
+ instrument_ids=["600519.XSHG", "000001.XSHE", "000002.XSHG"],
162
+ )
163
+ print(result)
164
+
165
+ print("获取K线")
166
+ result = datahub.get_kline(
167
+ "5min", instruments=["600519.XSHG", "603350.XSHG"],
168
+ start_time=start_time, end_time=end_time, adj_method="backward"
169
+ )
170
+ print(result)
171
+
172
+ print("获取指标信息")
173
+ result = datahub.get_indicator_info()
174
+ print(result)
175
+
176
+ print("获取指标类型信息")
177
+ result = datahub.get_indicator_type()
178
+ print(result)
179
+
180
+ print("获取因子类型信息")
181
+ result = datahub.get_factor_type()
182
+ print(result)
183
+
184
+ print("获取行业分类信息")
185
+ result = datahub.get_instrument_industry(datetime(2018, 1, 5).date())
186
+ print(result)
187
+
188
+ print("获取交易日")
189
+ result = datahub.calendar.get_latest_trade_date(
190
+ dt=datetime(2025, 1, 4).date())
191
+ print(result)
192
+
193
+ print("获取主力期货合约信息")
194
+ result = datahub.get_future_domain_info("IC")
195
+ print(result)
196
+
197
+ print("获取主力期货快照行情")
198
+ result = datahub.get_future_snapshot(
199
+ "IC", start_date=start_time.date(), end_date=end_time.date())
200
+ print(result)
201
+
202
+ print("获取return_factor的数据")
203
+ df = datahub.get_return_matrix(
204
+ trade_time=datetime(2018, 1, 29, 9, 35),
205
+ factors=["ret_raw_1d", "ret_raw_3d", "ret_raw_5d"],
206
+ instrument_ids=["600519.XSHG", "000001.XSHE", "000002.XSHG"],
207
+ )
208
+ print(df)
209
+
210
+ print("获取risk_factor的数据")
211
+ df = datahub.get_risk_factor_matrix(
212
+ version="rq_v2_sws2021",
213
+ trade_time=datetime(2018, 1, 11, 20),
214
+ factors=["liquidity", "longterm_reversal", "mid_cap"],
215
+ instrument_ids=["600519.XSHG", "000001.XSHE", "000002.XSHG"],
216
+ )
217
+ print(df)
218
+
219
+ print("获取最新黑名单列表, 可以指定日期")
220
+ df = datahub.get_blacklist(blacklist_ids=["cms_dma_blacklist", "XXX"], end_date=None)
221
+ print(df)
222
+
223
+ print("获取券池列表, 可以指定券池和日期")
224
+ df = datahub.get_sbl_list(end_date=datetime(2025, 1, 1))
225
+ print(df)
226
+
227
+ print("获取seq y")
228
+ df = datahub.get_seq_y_info(resample_type="time_interval_ms_500",)
229
+ print(df)
230
+
231
+ print("获取seq factor info")
232
+ df = datahub.get_seq_factor_info(resample_type="time_interval_ms_500",)
233
+ print(df)
234
+
235
+ print("获取 seq factor")
236
+ df = datahub.get_seq_factor_data(
237
+ start_time=datetime(2025, 2, 10, 9, 30, 9, 920000),
238
+ end_time=datetime(2025, 2, 10, 9, 30, 11, 920000),
239
+ factors=["ActiveCashFlowFactors__lookback_tick_30s__time_interval_ms_500__buy_amount"],
240
+ instruments=["000029.XSHE"]
241
+ )
242
+ print(df)
243
+
244
+ print("获取get_seq_y_stat")
245
+ df = datahub.get_seq_y_stat(start_time=datetime(2025, 1, 10, 23), end_time=datetime(2025, 1, 10, 23),
246
+ stat_type="std_1d")
247
+ print(df)
248
+
249
+
250
+ if __name__ == "__main__":
251
+ main()
252
+ ```
@@ -1,4 +1,4 @@
1
- datahub.cp312-win_amd64.pyd,sha256=MNGR3nCvHeUobM6aH0_-EOQmARCkLhhpAJ5zhbAsu4M,1782272
1
+ datahub.cp312-win_amd64.pyd,sha256=kWmDuLEYfXKYeLaNn3CC5wSy8aOktPyw_1yrt7CuRtg,1786880
2
2
  datahub.pyi,sha256=IXQ1dWxIq3itkkoYNJiPuRMWksWE1_4XVpjRYjy9tnQ,1449
3
3
  datahub/__init__.pyi,sha256=hX8D9Qd6uPjZiUBd6rIq7Llkt_H4l_RvRXsws3sdYbI,630
4
4
  datahub/datacache.pyi,sha256=rVDkzr0nLn54RT6EkYMDBh41t788XfVFyL4XKTJ2eSM,3587
@@ -8,7 +8,7 @@ datahub/ats/client_sdk.pyi,sha256=wwYRrVlM_qnpGhUifS-xgBAwoUDgQgFAC6TkTq8CLX8,32
8
8
  datahub/dbo/database.pyi,sha256=O8Gp0Os3tzznLa6hdmCaXnq7Iw4xAAkW4YcjK0jUSUY,1024
9
9
  datahub/dbo/pg.pyi,sha256=zSr5GAiPVwvqXSN6qctkUh1My7c2tMyGETJB0Ir1Uvo,871
10
10
  datahub/dbo/redis_stream.pyi,sha256=B3DJ5GQ_gnGqaPAGwgHwvTAVubMz99mAaoS8EK_2VaQ,734
11
- datahub/dbo/sr.pyi,sha256=oYyQQbZwkempgVFfMECcKz9G9I7EEpF3touuCLlyY_0,5268
11
+ datahub/dbo/sr.pyi,sha256=S-xVb0WDkxgusdot4FGQJ6dyTsMdehFUybllWYPe-BU,5375
12
12
  datahub/protos/client_pb2.pyi,sha256=CZTEbNX3LduN31Ir1gNb4iK9GFEbP75kc4yeuAwg-dA,220830
13
13
  datahub/protos/common_pb2.pyi,sha256=KCzIIakHr0iViKFNFcK1ZotkqcQuZ9_XTNIfvyvcSbM,32839
14
14
  datahub/protos/management_pb2.pyi,sha256=DtHNxR31C1T4HTUWT7KSsFPMvHiq37u_3G3aO__McA8,23183
@@ -25,7 +25,7 @@ datahub/utils/monitor/__init__.pyi,sha256=EOwgf8CbJ4g3iUAaFoR6O-mYemJ9xjP42zlBj2
25
25
  datahub/utils/monitor/base.pyi,sha256=n1dKYK73JJ_7QPkCWFc-6Aj_a16j2z_VBaQ9zkN9A3E,310
26
26
  datahub/utils/monitor/feishu.pyi,sha256=GgvJXYeX3cPOQjqpV0GJUr_Ri1_cZe2-viRBkpe6O_g,402
27
27
  datahub.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
28
- datahub_binary-1.4.9.dist-info/METADATA,sha256=fJXI17taUl48dejnemLFPZsOPOn7izrMB4TT8fQsQf0,806
29
- datahub_binary-1.4.9.dist-info/WHEEL,sha256=wQGB_Dged6RIso_Q-D9Gk_VsGJ3cQzyC7g9I2lGvFV4,97
30
- datahub_binary-1.4.9.dist-info/top_level.txt,sha256=J0rzqYfZghMgpObWaPGhQtV88I-KXrgArDvi_ddf6ZA,8
31
- datahub_binary-1.4.9.dist-info/RECORD,,
28
+ datahub_binary-1.4.10.dist-info/METADATA,sha256=D70IvDmHs7fjTK9H6VP9FsCGJ0V4Tg51llWqNjaFZFM,7841
29
+ datahub_binary-1.4.10.dist-info/WHEEL,sha256=wQGB_Dged6RIso_Q-D9Gk_VsGJ3cQzyC7g9I2lGvFV4,97
30
+ datahub_binary-1.4.10.dist-info/top_level.txt,sha256=J0rzqYfZghMgpObWaPGhQtV88I-KXrgArDvi_ddf6ZA,8
31
+ datahub_binary-1.4.10.dist-info/RECORD,,
@@ -1,22 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: datahub_binary
3
- Version: 1.4.9
4
- Summary: A comprehensive Python library for data processing, integration, and management.
5
- Requires-Python: <3.13,>=3.9
6
- Description-Content-Type: text/markdown
7
- Requires-Dist: SQLAlchemy>=1.0.0
8
- Requires-Dist: httpx[socks]>=0.28.0
9
- Requires-Dist: starrocks>=1.0.0
10
- Requires-Dist: polars-lts-cpu>=1.0.0; sys_platform == "darwin"
11
- Requires-Dist: polars>=1.0.0; sys_platform != "darwin"
12
- Requires-Dist: loguru>=0.7.3
13
- Requires-Dist: numpy>=2.0.0
14
- Requires-Dist: protobuf>=6.30.1
15
- Requires-Dist: redis>=5.2.1
16
- Requires-Dist: psycopg2-binary>=2.9.10
17
- Requires-Dist: paramiko>=3.5.1
18
- Requires-Dist: toml>=0.10.0
19
- Requires-Dist: pydantic>=2.11.3
20
- Requires-Dist: lark-oapi>=1.4.14
21
- Requires-Dist: pyzmq>=26.4.0
22
- Requires-Dist: sortedcontainers>=2.4.0