rquote 0.4.9__tar.gz → 0.5.1__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.
- {rquote-0.4.9 → rquote-0.5.1}/PKG-INFO +11 -5
- {rquote-0.4.9 → rquote-0.5.1}/README.md +10 -4
- {rquote-0.4.9 → rquote-0.5.1}/pyproject.toml +1 -1
- {rquote-0.4.9 → rquote-0.5.1}/rquote/api/price.py +13 -16
- {rquote-0.4.9 → rquote-0.5.1}/rquote.egg-info/PKG-INFO +11 -5
- {rquote-0.4.9 → rquote-0.5.1}/rquote/__init__.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/api/__init__.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/api/lists.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/api/stock_info.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/api/tick.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/cache/__init__.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/cache/base.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/cache/memory.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/cache/persistent.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/config.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/data_sources/__init__.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/data_sources/base.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/data_sources/sina.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/data_sources/tencent.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/exceptions.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/factors/__init__.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/factors/technical.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/markets/__init__.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/markets/base.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/markets/cn_stock.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/markets/factory.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/markets/future.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/markets/hk_stock.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/markets/us_stock.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/parsers/__init__.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/parsers/kline.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/plots.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/utils/__init__.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/utils/date.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/utils/helpers.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/utils/http.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/utils/logging.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/utils/web.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote/utils.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote.egg-info/SOURCES.txt +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote.egg-info/dependency_links.txt +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote.egg-info/requires.txt +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/rquote.egg-info/top_level.txt +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/setup.cfg +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/tests/test_api.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/tests/test_cache.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/tests/test_config.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/tests/test_exceptions.py +0 -0
- {rquote-0.4.9 → rquote-0.5.1}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rquote
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Mostly day quotes of cn/hk/us/fund/future markets, side with quote list fetch
|
|
5
5
|
Requires-Python: >=3.9.0
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -18,7 +18,7 @@ Requires-Dist: duckdb>=0.9.0; extra == "persistent"
|
|
|
18
18
|
|
|
19
19
|
## 版本信息
|
|
20
20
|
|
|
21
|
-
当前版本:**0.
|
|
21
|
+
当前版本:**0.5.1**
|
|
22
22
|
|
|
23
23
|
## 主要特性
|
|
24
24
|
|
|
@@ -172,15 +172,18 @@ sid, nm, df = get_price('fuM2601', freq='min')
|
|
|
172
172
|
| 2024-02-06 | 2680.48 | 2789.49 | 2802.93 | 2669.67 | 502849313 |
|
|
173
173
|
| 2024-02-07 | 2791.51 | 2829.70 | 2829.70 | 2770.53 | 547117439 |
|
|
174
174
|
|
|
175
|
-
#### `get_price_longer(i, l=2, dd=
|
|
175
|
+
#### `get_price_longer(i, l=2, edate='', freq='day', fq='qfq', dd=None)`
|
|
176
176
|
|
|
177
|
-
获取更长时间的历史数据,默认获取2
|
|
177
|
+
获取更长时间的历史数据,默认获取2年数据,并且参数与 `get_price` 保持一致
|
|
178
178
|
|
|
179
179
|
```python
|
|
180
180
|
from rquote import get_price_longer
|
|
181
181
|
|
|
182
|
-
# 获取3
|
|
182
|
+
# 获取3年的历史数据(默认日线、前复权,以最新交易日为结束)
|
|
183
183
|
sid, nm, df = get_price_longer('sh000001', l=3)
|
|
184
|
+
|
|
185
|
+
# 指定结束日期与频率(例如获取到 2024-02-01 的周线数据)
|
|
186
|
+
sid, nm, df = get_price_longer('sh000001', l=3, edate='2024-02-01', freq='week', fq='qfq')
|
|
184
187
|
```
|
|
185
188
|
|
|
186
189
|
### 股票列表获取
|
|
@@ -238,8 +241,11 @@ zz1000_stocks = get_cnindex_stocks('zz1000')
|
|
|
238
241
|
|
|
239
242
|
支持的指数类型:
|
|
240
243
|
- `'hs300'`: 沪深300
|
|
244
|
+
- `'sz50'`: 上证50
|
|
241
245
|
- `'zz500'`: 中证500
|
|
246
|
+
- `'kc500'`: 科创500
|
|
242
247
|
- `'zz1000'`: 中证1000
|
|
248
|
+
- `'zz2000'`: 中证2000
|
|
243
249
|
|
|
244
250
|
### 基金和期货
|
|
245
251
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 版本信息
|
|
6
6
|
|
|
7
|
-
当前版本:**0.
|
|
7
|
+
当前版本:**0.5.1**
|
|
8
8
|
|
|
9
9
|
## 主要特性
|
|
10
10
|
|
|
@@ -158,15 +158,18 @@ sid, nm, df = get_price('fuM2601', freq='min')
|
|
|
158
158
|
| 2024-02-06 | 2680.48 | 2789.49 | 2802.93 | 2669.67 | 502849313 |
|
|
159
159
|
| 2024-02-07 | 2791.51 | 2829.70 | 2829.70 | 2770.53 | 547117439 |
|
|
160
160
|
|
|
161
|
-
#### `get_price_longer(i, l=2, dd=
|
|
161
|
+
#### `get_price_longer(i, l=2, edate='', freq='day', fq='qfq', dd=None)`
|
|
162
162
|
|
|
163
|
-
获取更长时间的历史数据,默认获取2
|
|
163
|
+
获取更长时间的历史数据,默认获取2年数据,并且参数与 `get_price` 保持一致
|
|
164
164
|
|
|
165
165
|
```python
|
|
166
166
|
from rquote import get_price_longer
|
|
167
167
|
|
|
168
|
-
# 获取3
|
|
168
|
+
# 获取3年的历史数据(默认日线、前复权,以最新交易日为结束)
|
|
169
169
|
sid, nm, df = get_price_longer('sh000001', l=3)
|
|
170
|
+
|
|
171
|
+
# 指定结束日期与频率(例如获取到 2024-02-01 的周线数据)
|
|
172
|
+
sid, nm, df = get_price_longer('sh000001', l=3, edate='2024-02-01', freq='week', fq='qfq')
|
|
170
173
|
```
|
|
171
174
|
|
|
172
175
|
### 股票列表获取
|
|
@@ -224,8 +227,11 @@ zz1000_stocks = get_cnindex_stocks('zz1000')
|
|
|
224
227
|
|
|
225
228
|
支持的指数类型:
|
|
226
229
|
- `'hs300'`: 沪深300
|
|
230
|
+
- `'sz50'`: 上证50
|
|
227
231
|
- `'zz500'`: 中证500
|
|
232
|
+
- `'kc500'`: 科创500
|
|
228
233
|
- `'zz1000'`: 中证1000
|
|
234
|
+
- `'zz2000'`: 中证2000
|
|
229
235
|
|
|
230
236
|
### 基金和期货
|
|
231
237
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "rquote"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.5.1"
|
|
8
8
|
description = "Mostly day quotes of cn/hk/us/fund/future markets, side with quote list fetch"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
# requires-python = ">=3.6.1" # duckdb requires higher python version
|
|
@@ -38,7 +38,7 @@ def _normalize_dataframe_index(df: pd.DataFrame) -> pd.DataFrame:
|
|
|
38
38
|
return df
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
def get_price(i: str, sdate: str = '', edate: str = '', freq: str = 'day',
|
|
41
|
+
def get_price(i: str, sdate: str = '', edate: str = '', freq: str = 'day',
|
|
42
42
|
days: int = 320, fq: str = 'qfq', dd=None) -> Tuple[str, str, pd.DataFrame]:
|
|
43
43
|
'''
|
|
44
44
|
获取价格数据
|
|
@@ -84,33 +84,30 @@ def get_price(i: str, sdate: str = '', edate: str = '', freq: str = 'day',
|
|
|
84
84
|
return symbol, name, df
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
def get_price_longer(i: str, l: int = 2,
|
|
87
|
+
def get_price_longer(i: str, l: int = 2, edate: str = '', freq: str = 'day',
|
|
88
|
+
fq: str = 'qfq', dd=None) -> Tuple[str, str, pd.DataFrame]:
|
|
88
89
|
"""
|
|
89
90
|
获取更长时间的历史数据
|
|
90
91
|
|
|
91
92
|
Args:
|
|
92
93
|
i: 股票代码
|
|
93
94
|
l: 年数
|
|
95
|
+
edate: 结束日期,同 ``get_price``
|
|
96
|
+
freq: 频率,同 ``get_price``
|
|
97
|
+
fq: 复权方式,同 ``get_price``
|
|
94
98
|
dd: 缓存对象
|
|
95
99
|
|
|
96
100
|
Returns:
|
|
97
101
|
(symbol, name, DataFrame)
|
|
98
102
|
"""
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
d1 = a.index[0].strftime('%Y%m%d')
|
|
103
|
-
else:
|
|
104
|
-
# 降级处理:如果索引不是 DatetimeIndex(理论上不应该发生),尝试格式化
|
|
105
|
-
try:
|
|
106
|
-
d1 = str(a.index[0])[:8] if len(str(a.index[0])) >= 8 else str(a.index[0])
|
|
107
|
-
except:
|
|
108
|
-
d1 = a.index.format()[0] if hasattr(a.index, 'format') else str(a.index[0])
|
|
109
|
-
|
|
103
|
+
# 首段数据直接复用 get_price,透传 edate/freq/fq 参数
|
|
104
|
+
_, name, a = get_price(i, edate=edate, freq=freq, fq=fq, dd=dd)
|
|
105
|
+
|
|
110
106
|
for y in range(1, l):
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
d1 = a.index[0].strftime('%Y%m%d')
|
|
108
|
+
b = get_price(i, edate=d1, freq=freq, fq=fq, dd=dd)[2]
|
|
109
|
+
# 逐年向前补数据,保持与 get_price 相同的 freq/fq 配置
|
|
110
|
+
a = pd.concat((b, a), axis=0).drop_duplicates()
|
|
114
111
|
return i, name, a
|
|
115
112
|
|
|
116
113
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rquote
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Mostly day quotes of cn/hk/us/fund/future markets, side with quote list fetch
|
|
5
5
|
Requires-Python: >=3.9.0
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -18,7 +18,7 @@ Requires-Dist: duckdb>=0.9.0; extra == "persistent"
|
|
|
18
18
|
|
|
19
19
|
## 版本信息
|
|
20
20
|
|
|
21
|
-
当前版本:**0.
|
|
21
|
+
当前版本:**0.5.1**
|
|
22
22
|
|
|
23
23
|
## 主要特性
|
|
24
24
|
|
|
@@ -172,15 +172,18 @@ sid, nm, df = get_price('fuM2601', freq='min')
|
|
|
172
172
|
| 2024-02-06 | 2680.48 | 2789.49 | 2802.93 | 2669.67 | 502849313 |
|
|
173
173
|
| 2024-02-07 | 2791.51 | 2829.70 | 2829.70 | 2770.53 | 547117439 |
|
|
174
174
|
|
|
175
|
-
#### `get_price_longer(i, l=2, dd=
|
|
175
|
+
#### `get_price_longer(i, l=2, edate='', freq='day', fq='qfq', dd=None)`
|
|
176
176
|
|
|
177
|
-
获取更长时间的历史数据,默认获取2
|
|
177
|
+
获取更长时间的历史数据,默认获取2年数据,并且参数与 `get_price` 保持一致
|
|
178
178
|
|
|
179
179
|
```python
|
|
180
180
|
from rquote import get_price_longer
|
|
181
181
|
|
|
182
|
-
# 获取3
|
|
182
|
+
# 获取3年的历史数据(默认日线、前复权,以最新交易日为结束)
|
|
183
183
|
sid, nm, df = get_price_longer('sh000001', l=3)
|
|
184
|
+
|
|
185
|
+
# 指定结束日期与频率(例如获取到 2024-02-01 的周线数据)
|
|
186
|
+
sid, nm, df = get_price_longer('sh000001', l=3, edate='2024-02-01', freq='week', fq='qfq')
|
|
184
187
|
```
|
|
185
188
|
|
|
186
189
|
### 股票列表获取
|
|
@@ -238,8 +241,11 @@ zz1000_stocks = get_cnindex_stocks('zz1000')
|
|
|
238
241
|
|
|
239
242
|
支持的指数类型:
|
|
240
243
|
- `'hs300'`: 沪深300
|
|
244
|
+
- `'sz50'`: 上证50
|
|
241
245
|
- `'zz500'`: 中证500
|
|
246
|
+
- `'kc500'`: 科创500
|
|
242
247
|
- `'zz1000'`: 中证1000
|
|
248
|
+
- `'zz2000'`: 中证2000
|
|
243
249
|
|
|
244
250
|
### 基金和期货
|
|
245
251
|
|
|
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
|