yjdata 0.2.4__tar.gz → 0.2.5__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.
- yjdata-0.2.5/PKG-INFO +49 -0
- yjdata-0.2.5/README.md +38 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/pyproject.toml +1 -1
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/web/client.py +12 -0
- yjdata-0.2.5/src/yjdata/web/cn_fund.py +116 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/web/cn_future.py +81 -12
- yjdata-0.2.5/src/yjdata/web/cn_stock.py +202 -0
- yjdata-0.2.5/src/yjdata/web/md.py +78 -0
- yjdata-0.2.5/src/yjdata.egg-info/PKG-INFO +49 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata.egg-info/SOURCES.txt +4 -1
- yjdata-0.2.5/tests/test_web_market_data.py +185 -0
- yjdata-0.2.4/PKG-INFO +0 -66
- yjdata-0.2.4/README.md +0 -55
- yjdata-0.2.4/src/yjdata/web/cn_stock.py +0 -108
- yjdata-0.2.4/src/yjdata.egg-info/PKG-INFO +0 -66
- {yjdata-0.2.4 → yjdata-0.2.5}/setup.cfg +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/__init__.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/_optional.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/dataset/__init__.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/dataset/common.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/dataset/quote.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/dataset/snapshot.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/dataset/trade.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/db/__init__.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/db/adapter.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/db/expression.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/db/mysql.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/db/postgres.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/db/sql.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/dtype.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/utlity/__init__.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/utlity/s3.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/web/__init__.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/web/_context.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/web/_input.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/web/calendar.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata/web/time_util.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata.egg-info/dependency_links.txt +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata.egg-info/requires.txt +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/src/yjdata.egg-info/top_level.txt +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/tests/test_batch_writes.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/tests/test_last_of_group.py +0 -0
- {yjdata-0.2.4 → yjdata-0.2.5}/tests/test_mysql_batch_updates.py +0 -0
yjdata-0.2.5/PKG-INFO
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: yjdata
|
|
3
|
+
Version: 0.2.5
|
|
4
|
+
Summary: yjdata SDK for Python
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: httpx>=0.25
|
|
8
|
+
Requires-Dist: polars>=1.30
|
|
9
|
+
Requires-Dist: pyarrow>=18
|
|
10
|
+
Requires-Dist: pydantic>=2.11
|
|
11
|
+
|
|
12
|
+
# yjdata
|
|
13
|
+
|
|
14
|
+
Python SDK,提供 yjdata WebAPI client、MySQL/PostgreSQL adapter 和 Parquet 工具。
|
|
15
|
+
[更新日志](doc/updates/v0.2.x.md)
|
|
16
|
+
|
|
17
|
+
## 安装与配置
|
|
18
|
+
|
|
19
|
+
需要 Python 3.10+:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install yjdata
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
默认访问内网 `yjdata-api.yaojingriver.internal`,可通过
|
|
26
|
+
`YJDATA_WEB_BASE_URL` 环境变量或 client 的 `host` 参数指定地址。
|
|
27
|
+
|
|
28
|
+
## 使用
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from yjdata import WebDataClient
|
|
32
|
+
|
|
33
|
+
client = WebDataClient()
|
|
34
|
+
prices = client.cn_stock.stk_eod_md("2026-11-06", ids="000001.XSHE")
|
|
35
|
+
for price in prices:
|
|
36
|
+
print(price.id, price.close)
|
|
37
|
+
|
|
38
|
+
for snapshot in client.md.latest_brief(["000001.XSHE"]):
|
|
39
|
+
print(snapshot.id, snapshot.last, snapshot.bid1, snapshot.ask1)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- WebAPI:`calendar`、`md`、`cn_stock`、`cn_future`、`cn_fund`;异步使用 `AsyncWebDataClient`。
|
|
43
|
+
- ETF/LOF:`cn_fund.etf_eod_md` 和 `cn_fund.etf_sod_ref` 按交易日查询收盘行情和盘前参考数据。对应的 `_id` 方法按单只基金查询闭区间内的数据。
|
|
44
|
+
- 最新行情:`md.latest_brief` 获取买卖一档,`md.latest_full` 获取完整快照。两者均接受显示 ID 列表或逗号分隔的字符串。
|
|
45
|
+
- 数据库:`yjdata.db.MysqlAdapter`、`yjdata.db.PostgresAdapter`。
|
|
46
|
+
- Parquet:`yjdata.dataset`。
|
|
47
|
+
|
|
48
|
+
接口与字段见 [OpenAPI](https://yjdata-api.yaojingriver.internal/openapi.json),
|
|
49
|
+
Python 参数见对应模块的 docstring。
|
yjdata-0.2.5/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# yjdata
|
|
2
|
+
|
|
3
|
+
Python SDK,提供 yjdata WebAPI client、MySQL/PostgreSQL adapter 和 Parquet 工具。
|
|
4
|
+
[更新日志](doc/updates/v0.2.x.md)
|
|
5
|
+
|
|
6
|
+
## 安装与配置
|
|
7
|
+
|
|
8
|
+
需要 Python 3.10+:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install yjdata
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
默认访问内网 `yjdata-api.yaojingriver.internal`,可通过
|
|
15
|
+
`YJDATA_WEB_BASE_URL` 环境变量或 client 的 `host` 参数指定地址。
|
|
16
|
+
|
|
17
|
+
## 使用
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from yjdata import WebDataClient
|
|
21
|
+
|
|
22
|
+
client = WebDataClient()
|
|
23
|
+
prices = client.cn_stock.stk_eod_md("2026-11-06", ids="000001.XSHE")
|
|
24
|
+
for price in prices:
|
|
25
|
+
print(price.id, price.close)
|
|
26
|
+
|
|
27
|
+
for snapshot in client.md.latest_brief(["000001.XSHE"]):
|
|
28
|
+
print(snapshot.id, snapshot.last, snapshot.bid1, snapshot.ask1)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- WebAPI:`calendar`、`md`、`cn_stock`、`cn_future`、`cn_fund`;异步使用 `AsyncWebDataClient`。
|
|
32
|
+
- ETF/LOF:`cn_fund.etf_eod_md` 和 `cn_fund.etf_sod_ref` 按交易日查询收盘行情和盘前参考数据。对应的 `_id` 方法按单只基金查询闭区间内的数据。
|
|
33
|
+
- 最新行情:`md.latest_brief` 获取买卖一档,`md.latest_full` 获取完整快照。两者均接受显示 ID 列表或逗号分隔的字符串。
|
|
34
|
+
- 数据库:`yjdata.db.MysqlAdapter`、`yjdata.db.PostgresAdapter`。
|
|
35
|
+
- Parquet:`yjdata.dataset`。
|
|
36
|
+
|
|
37
|
+
接口与字段见 [OpenAPI](https://yjdata-api.yaojingriver.internal/openapi.json),
|
|
38
|
+
Python 参数见对应模块的 docstring。
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import os
|
|
2
2
|
|
|
3
3
|
from .calendar import SyncCalenderWebClient, AsyncCalendarWebClient
|
|
4
|
+
from .cn_fund import CnFundWebClient
|
|
4
5
|
from .cn_future import CnFutureWebClient
|
|
5
6
|
from .cn_stock import CnStockWebClient
|
|
7
|
+
from .md import MdWebClient
|
|
6
8
|
from ._context import RequestContext, SyncRequestContext, AsyncRequestContext
|
|
7
9
|
|
|
8
10
|
|
|
@@ -25,11 +27,21 @@ class _WebClient:
|
|
|
25
27
|
self._host = host
|
|
26
28
|
self._context = context
|
|
27
29
|
|
|
30
|
+
@property
|
|
31
|
+
def md(self) -> MdWebClient:
|
|
32
|
+
"""API set for latest market snapshots."""
|
|
33
|
+
return MdWebClient(self._host, self._context)
|
|
34
|
+
|
|
28
35
|
@property
|
|
29
36
|
def cn_stock(self) -> CnStockWebClient:
|
|
30
37
|
"""API set for domestic stock market data."""
|
|
31
38
|
return CnStockWebClient(self._host, self._context)
|
|
32
39
|
|
|
40
|
+
@property
|
|
41
|
+
def cn_fund(self) -> CnFundWebClient:
|
|
42
|
+
"""API set for domestic ETF and LOF data."""
|
|
43
|
+
return CnFundWebClient(self._host, self._context)
|
|
44
|
+
|
|
33
45
|
@property
|
|
34
46
|
def cn_future(self) -> CnFutureWebClient:
|
|
35
47
|
"""API set for domestic futures market data."""
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
from typing import Awaitable
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
4
|
+
|
|
5
|
+
from ._context import RequestContext
|
|
6
|
+
from ._input import DateStrArgType, StrListArgType, parse_date_str_arg, parse_str_list_arg
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
__all__ = ['CnFundWebClient', 'EtfEodMd', 'EtfSodRef']
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class EtfEodMd(BaseModel):
|
|
13
|
+
"""ETF/LOF end-of-day prices, volume and turnover."""
|
|
14
|
+
|
|
15
|
+
model_config = ConfigDict(validate_by_name=True)
|
|
16
|
+
|
|
17
|
+
id: str
|
|
18
|
+
time: str = Field(alias='date')
|
|
19
|
+
pre_close: float = Field(alias='pc')
|
|
20
|
+
open: float = Field(alias='o')
|
|
21
|
+
high: float = Field(alias='h')
|
|
22
|
+
low: float = Field(alias='l')
|
|
23
|
+
close: float = Field(alias='c')
|
|
24
|
+
volume: int = Field(alias='vol')
|
|
25
|
+
amount: float = Field(alias='amt')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class EtfSodRef(BaseModel):
|
|
29
|
+
"""ETF/LOF pre-market reference data."""
|
|
30
|
+
|
|
31
|
+
model_config = ConfigDict(validate_by_name=True)
|
|
32
|
+
|
|
33
|
+
id: str
|
|
34
|
+
time: str = Field(alias='date')
|
|
35
|
+
name: str
|
|
36
|
+
ticker: str
|
|
37
|
+
display_id: str = Field(alias='dispId')
|
|
38
|
+
trading_status: str = Field(alias='status')
|
|
39
|
+
pre_close: float = Field(alias='pc')
|
|
40
|
+
prior_close: float = Field(alias='prc')
|
|
41
|
+
upper_limit: float = Field(alias='ul')
|
|
42
|
+
lower_limit: float = Field(alias='ll')
|
|
43
|
+
auct_hours: str = Field(alias='auct')
|
|
44
|
+
cont_hours: str = Field(alias='cont')
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _range_payload(id: str, start: DateStrArgType, end: DateStrArgType, stable_id: bool) -> dict:
|
|
48
|
+
return {
|
|
49
|
+
'id': id,
|
|
50
|
+
'start': parse_date_str_arg(start, False),
|
|
51
|
+
'end': parse_date_str_arg(end, False),
|
|
52
|
+
'stableId': stable_id,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class CnFundWebClient:
|
|
57
|
+
"""Domestic ETF/LOF data by trading date or inclusive date range.
|
|
58
|
+
|
|
59
|
+
Dates accept date or datetime objects and YYYY-MM-DD or YYYYMMDD strings.
|
|
60
|
+
Daily queries accept a list of IDs or a comma-separated string. Omit ids
|
|
61
|
+
to request all funds, or pass an empty list to request none.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
def __init__(self, host: str, context: RequestContext) -> None:
|
|
65
|
+
self._api_root = f'http://{host}/v1/cn-fund'
|
|
66
|
+
self._context = context
|
|
67
|
+
|
|
68
|
+
def etf_eod_md(
|
|
69
|
+
self, date: DateStrArgType, ids: StrListArgType = None, stable_id: bool = True,
|
|
70
|
+
) -> list[EtfEodMd] | Awaitable[list[EtfEodMd]]:
|
|
71
|
+
"""Get daily prices. Set stable_id=False to query and return current IDs."""
|
|
72
|
+
return self._context.post_model_list(
|
|
73
|
+
EtfEodMd, f'{self._api_root}/etf-eod-md',
|
|
74
|
+
payload={
|
|
75
|
+
'date': parse_date_str_arg(date, False),
|
|
76
|
+
'ids': None if ids is None else parse_str_list_arg(ids),
|
|
77
|
+
'stableId': stable_id,
|
|
78
|
+
},
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
def etf_sod_ref(
|
|
82
|
+
self, date: DateStrArgType, ids: StrListArgType = None,
|
|
83
|
+
) -> list[EtfSodRef] | Awaitable[list[EtfSodRef]]:
|
|
84
|
+
"""Get pre-market reference data for a trading date using internal IDs."""
|
|
85
|
+
return self._context.post_model_list(
|
|
86
|
+
EtfSodRef, f'{self._api_root}/etf-sod-ref',
|
|
87
|
+
payload={
|
|
88
|
+
'date': parse_date_str_arg(date, False),
|
|
89
|
+
'ids': None if ids is None else parse_str_list_arg(ids),
|
|
90
|
+
},
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
def etf_eod_md_id(
|
|
94
|
+
self, id: str, start: DateStrArgType, end: DateStrArgType, stable_id: bool = True,
|
|
95
|
+
) -> list[EtfEodMd] | Awaitable[list[EtfEodMd]]:
|
|
96
|
+
"""Get one fund's prices from start through end, sorted by date.
|
|
97
|
+
|
|
98
|
+
Set stable_id=False to query by the current ID and return it on each record.
|
|
99
|
+
"""
|
|
100
|
+
return self._context.post_model_list(
|
|
101
|
+
EtfEodMd, f'{self._api_root}/etf-eod-md-id',
|
|
102
|
+
payload=_range_payload(id, start, end, stable_id),
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
def etf_sod_ref_id(
|
|
106
|
+
self, id: str, start: DateStrArgType, end: DateStrArgType, stable_id: bool = True,
|
|
107
|
+
) -> list[EtfSodRef] | Awaitable[list[EtfSodRef]]:
|
|
108
|
+
"""Get one fund's pre-market data from start through end, sorted by date.
|
|
109
|
+
|
|
110
|
+
Set stable_id=False to query by the current ID. Each record contains the
|
|
111
|
+
internal id and the display_id in effect on its trading date.
|
|
112
|
+
"""
|
|
113
|
+
return self._context.post_model_list(
|
|
114
|
+
EtfSodRef, f'{self._api_root}/etf-sod-ref-id',
|
|
115
|
+
payload=_range_payload(id, start, end, stable_id),
|
|
116
|
+
)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
from typing import Awaitable, List, Union
|
|
2
|
-
|
|
3
1
|
from pydantic import BaseModel, ConfigDict, Field
|
|
2
|
+
from typing import Awaitable, List, Union
|
|
4
3
|
|
|
5
4
|
from ._context import RequestContext
|
|
6
5
|
from ._input import DateStrArgType, StrListArgType, parse_date_str_arg, parse_str_list_arg
|
|
@@ -53,8 +52,8 @@ class FutSodRef(BaseModel):
|
|
|
53
52
|
|
|
54
53
|
class CnFutureWebClient:
|
|
55
54
|
|
|
56
|
-
def __init__(self, host: str, context: RequestContext):
|
|
57
|
-
self._api_root = f'http://{host}/v1/
|
|
55
|
+
def __init__(self, host: str, context: RequestContext) -> None:
|
|
56
|
+
self._api_root = f'http://{host}/v1/cn-future'
|
|
58
57
|
self._context = context
|
|
59
58
|
|
|
60
59
|
def fut_eod_md(
|
|
@@ -77,10 +76,14 @@ class CnFutureWebClient:
|
|
|
77
76
|
list[FutEodMd] or Awaitable[list[FutEodMd]]
|
|
78
77
|
Validated records; await the result with AsyncWebDataClient.
|
|
79
78
|
"""
|
|
80
|
-
return self._context.post_model_list(
|
|
81
|
-
|
|
82
|
-
'
|
|
83
|
-
|
|
79
|
+
return self._context.post_model_list(
|
|
80
|
+
FutEodMd,
|
|
81
|
+
f'{self._api_root}/fut-eod-md',
|
|
82
|
+
payload={
|
|
83
|
+
'date': parse_date_str_arg(date, False),
|
|
84
|
+
'ids': None if ids is None else parse_str_list_arg(ids),
|
|
85
|
+
},
|
|
86
|
+
)
|
|
84
87
|
|
|
85
88
|
def fut_sod_ref(
|
|
86
89
|
self,
|
|
@@ -104,7 +107,73 @@ class CnFutureWebClient:
|
|
|
104
107
|
API fields dispId and ulId use display_id and underlying_id.
|
|
105
108
|
underlying_id is None for contracts without an underlying index.
|
|
106
109
|
"""
|
|
107
|
-
return self._context.post_model_list(
|
|
108
|
-
|
|
109
|
-
'
|
|
110
|
-
|
|
110
|
+
return self._context.post_model_list(
|
|
111
|
+
FutSodRef,
|
|
112
|
+
f'{self._api_root}/fut-sod-ref',
|
|
113
|
+
payload={
|
|
114
|
+
'date': parse_date_str_arg(date, False),
|
|
115
|
+
'ids': None if ids is None else parse_str_list_arg(ids),
|
|
116
|
+
},
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
def fut_eod_md_id(
|
|
120
|
+
self,
|
|
121
|
+
id: str,
|
|
122
|
+
start: DateStrArgType,
|
|
123
|
+
end: DateStrArgType,
|
|
124
|
+
) -> Union[List[FutEodMd], Awaitable[List[FutEodMd]]]:
|
|
125
|
+
"""Get one futures contract's end-of-day data for a date range.
|
|
126
|
+
|
|
127
|
+
Parameters
|
|
128
|
+
----------
|
|
129
|
+
id : str
|
|
130
|
+
A single contract ID, preserving the contract code's case.
|
|
131
|
+
start, end : str, datetime.date or datetime.datetime
|
|
132
|
+
Inclusive dates; strings accept YYYY-MM-DD or YYYYMMDD.
|
|
133
|
+
end must not precede start.
|
|
134
|
+
|
|
135
|
+
Returns
|
|
136
|
+
-------
|
|
137
|
+
list[FutEodMd] or Awaitable[list[FutEodMd]]
|
|
138
|
+
Records sorted by date ascending; await with AsyncWebDataClient.
|
|
139
|
+
"""
|
|
140
|
+
return self._context.post_model_list(
|
|
141
|
+
FutEodMd,
|
|
142
|
+
f'{self._api_root}/fut-eod-md-id',
|
|
143
|
+
payload={
|
|
144
|
+
'id': id,
|
|
145
|
+
'start': parse_date_str_arg(start, False),
|
|
146
|
+
'end': parse_date_str_arg(end, False),
|
|
147
|
+
},
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
def fut_sod_ref_id(
|
|
151
|
+
self,
|
|
152
|
+
id: str,
|
|
153
|
+
start: DateStrArgType,
|
|
154
|
+
end: DateStrArgType,
|
|
155
|
+
) -> Union[List[FutSodRef], Awaitable[List[FutSodRef]]]:
|
|
156
|
+
"""Get one futures contract's pre-market data for a date range.
|
|
157
|
+
|
|
158
|
+
Parameters
|
|
159
|
+
----------
|
|
160
|
+
id : str
|
|
161
|
+
A single contract ID, preserving the contract code's case.
|
|
162
|
+
start, end : str, datetime.date or datetime.datetime
|
|
163
|
+
Inclusive dates; strings accept YYYY-MM-DD or YYYYMMDD.
|
|
164
|
+
end must not precede start.
|
|
165
|
+
|
|
166
|
+
Returns
|
|
167
|
+
-------
|
|
168
|
+
list[FutSodRef] or Awaitable[list[FutSodRef]]
|
|
169
|
+
Records sorted by date ascending; await with AsyncWebDataClient.
|
|
170
|
+
"""
|
|
171
|
+
return self._context.post_model_list(
|
|
172
|
+
FutSodRef,
|
|
173
|
+
f'{self._api_root}/fut-sod-ref-id',
|
|
174
|
+
payload={
|
|
175
|
+
'id': id,
|
|
176
|
+
'start': parse_date_str_arg(start, False),
|
|
177
|
+
'end': parse_date_str_arg(end, False),
|
|
178
|
+
},
|
|
179
|
+
)
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
2
|
+
from typing import Awaitable, List, Union
|
|
3
|
+
|
|
4
|
+
from ._context import RequestContext
|
|
5
|
+
from ._input import DateStrArgType, StrListArgType, parse_date_str_arg, parse_str_list_arg
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ['CnStockWebClient', 'StkEodMd', 'StkSodRef']
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class StkEodMd(BaseModel):
|
|
12
|
+
"""Stock end-of-day prices, volume and turnover."""
|
|
13
|
+
|
|
14
|
+
model_config = ConfigDict(validate_by_name=True)
|
|
15
|
+
|
|
16
|
+
id: str
|
|
17
|
+
time: str = Field(alias='date')
|
|
18
|
+
pre_close: float = Field(alias='pc')
|
|
19
|
+
open: float = Field(alias='o')
|
|
20
|
+
high: float = Field(alias='h')
|
|
21
|
+
low: float = Field(alias='l')
|
|
22
|
+
close: float = Field(alias='c')
|
|
23
|
+
volume: int = Field(alias='vol')
|
|
24
|
+
amount: float = Field(alias='amt')
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class StkSodRef(BaseModel):
|
|
28
|
+
"""Stock pre-market reference data. IDs use the first listing ticker."""
|
|
29
|
+
|
|
30
|
+
model_config = ConfigDict(validate_by_name=True)
|
|
31
|
+
|
|
32
|
+
id: str
|
|
33
|
+
time: str = Field(alias='date')
|
|
34
|
+
name: str
|
|
35
|
+
display_id: str = Field(alias='dispId')
|
|
36
|
+
ticker: str
|
|
37
|
+
trading_status: str = Field(alias='status')
|
|
38
|
+
st_status: str = Field(alias='st')
|
|
39
|
+
pre_close: float = Field(alias='pc')
|
|
40
|
+
prior_close: float = Field(alias='prc')
|
|
41
|
+
upper_limit: float = Field(alias='ul')
|
|
42
|
+
lower_limit: float = Field(alias='ll')
|
|
43
|
+
auct_hours: str = Field(alias='auct')
|
|
44
|
+
cont_hours: str = Field(alias='cont')
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class CnStockWebClient:
|
|
48
|
+
|
|
49
|
+
def __init__(self, host: str, context: RequestContext) -> None:
|
|
50
|
+
self._api_root = f'http://{host}/v1/cn-stock'
|
|
51
|
+
self._context = context
|
|
52
|
+
|
|
53
|
+
def stk_eod_md(
|
|
54
|
+
self,
|
|
55
|
+
date: DateStrArgType,
|
|
56
|
+
ids: StrListArgType = None,
|
|
57
|
+
stable_id: bool = True
|
|
58
|
+
) -> Union[List[StkEodMd], Awaitable[List[StkEodMd]]]:
|
|
59
|
+
"""Get stock end-of-day market data for a trading date.
|
|
60
|
+
|
|
61
|
+
Parameters
|
|
62
|
+
----------
|
|
63
|
+
date : str, datetime.date or datetime.datetime
|
|
64
|
+
Trading date; strings accept YYYY-MM-DD or YYYYMMDD.
|
|
65
|
+
ids : str or list[str], optional
|
|
66
|
+
IDs as a list or comma-separated string. None returns all records;
|
|
67
|
+
an empty list or blank string returns no records.
|
|
68
|
+
stable_id : bool, default: True
|
|
69
|
+
True filters by stable (first-listing) IDs. False filters by
|
|
70
|
+
current latest IDs, independent of the requested date, and all
|
|
71
|
+
returned IDs use those latest IDs. If multiple listings match,
|
|
72
|
+
the server uses the last listing by start_time for each ID.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
list[StkEodMd] or Awaitable[list[StkEodMd]]
|
|
77
|
+
Validated records; await the result with AsyncWebDataClient.
|
|
78
|
+
"""
|
|
79
|
+
return self._context.post_model_list(
|
|
80
|
+
StkEodMd,
|
|
81
|
+
f'{self._api_root}/stk-eod-md',
|
|
82
|
+
payload={
|
|
83
|
+
'date': parse_date_str_arg(date, False),
|
|
84
|
+
'ids': None if ids is None else parse_str_list_arg(ids),
|
|
85
|
+
'stableId': stable_id,
|
|
86
|
+
},
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
def stk_sod_ref(
|
|
90
|
+
self,
|
|
91
|
+
date: DateStrArgType,
|
|
92
|
+
ids: StrListArgType = None,
|
|
93
|
+
stable_id: bool = True,
|
|
94
|
+
) -> Union[List[StkSodRef], Awaitable[List[StkSodRef]]]:
|
|
95
|
+
"""Get stock pre-market reference data for a trading date.
|
|
96
|
+
|
|
97
|
+
Parameters
|
|
98
|
+
----------
|
|
99
|
+
date : str, datetime.date or datetime.datetime
|
|
100
|
+
Trading date; strings accept YYYY-MM-DD or YYYYMMDD.
|
|
101
|
+
ids : str or list[str], optional
|
|
102
|
+
IDs as a list or comma-separated string. None returns all records;
|
|
103
|
+
an empty list or blank string returns no records.
|
|
104
|
+
stable_id : bool, default: True
|
|
105
|
+
True filters by stable (first-listing) IDs. False filters by
|
|
106
|
+
current latest IDs, independent of the requested date. If multiple
|
|
107
|
+
listings match, the server uses the last listing by start_time
|
|
108
|
+
for each ID. Returned fields remain unchanged: id is stable and
|
|
109
|
+
display_id is the ticker plus exchange on each record's date.
|
|
110
|
+
|
|
111
|
+
Returns
|
|
112
|
+
-------
|
|
113
|
+
list[StkSodRef] or Awaitable[list[StkSodRef]]
|
|
114
|
+
Validated records; await the result with AsyncWebDataClient.
|
|
115
|
+
Fields use backend Python names, such as display_id for dispId.
|
|
116
|
+
"""
|
|
117
|
+
return self._context.post_model_list(
|
|
118
|
+
StkSodRef,
|
|
119
|
+
f'{self._api_root}/stk-sod-ref',
|
|
120
|
+
payload={
|
|
121
|
+
'date': parse_date_str_arg(date, False),
|
|
122
|
+
'ids': None if ids is None else parse_str_list_arg(ids),
|
|
123
|
+
'stableId': stable_id,
|
|
124
|
+
},
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
def stk_eod_md_id(
|
|
128
|
+
self,
|
|
129
|
+
id: str,
|
|
130
|
+
start: DateStrArgType,
|
|
131
|
+
end: DateStrArgType,
|
|
132
|
+
stable_id: bool = True,
|
|
133
|
+
) -> Union[List[StkEodMd], Awaitable[List[StkEodMd]]]:
|
|
134
|
+
"""Get one stock's end-of-day data within an inclusive date range.
|
|
135
|
+
|
|
136
|
+
Parameters
|
|
137
|
+
----------
|
|
138
|
+
id : str
|
|
139
|
+
A single stock ID; its meaning is controlled by stable_id.
|
|
140
|
+
start, end : str, datetime.date or datetime.datetime
|
|
141
|
+
Inclusive dates; strings accept YYYY-MM-DD or YYYYMMDD.
|
|
142
|
+
end must not precede start.
|
|
143
|
+
stable_id : bool, default: True
|
|
144
|
+
True filters by stable (first-listing) ID. False uses the current
|
|
145
|
+
latest ID, independent of start/end, and replaces every returned
|
|
146
|
+
id with that latest ID. If multiple listings match, the server
|
|
147
|
+
uses the last listing by start_time.
|
|
148
|
+
|
|
149
|
+
Returns
|
|
150
|
+
-------
|
|
151
|
+
list[StkEodMd] or Awaitable[list[StkEodMd]]
|
|
152
|
+
Records sorted by date ascending; await with AsyncWebDataClient.
|
|
153
|
+
"""
|
|
154
|
+
return self._context.post_model_list(
|
|
155
|
+
StkEodMd,
|
|
156
|
+
f'{self._api_root}/stk-eod-md-id',
|
|
157
|
+
payload={
|
|
158
|
+
'id': id,
|
|
159
|
+
'start': parse_date_str_arg(start, False),
|
|
160
|
+
'end': parse_date_str_arg(end, False),
|
|
161
|
+
'stableId': stable_id,
|
|
162
|
+
},
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
def stk_sod_ref_id(
|
|
166
|
+
self,
|
|
167
|
+
id: str,
|
|
168
|
+
start: DateStrArgType,
|
|
169
|
+
end: DateStrArgType,
|
|
170
|
+
stable_id: bool = True,
|
|
171
|
+
) -> Union[List[StkSodRef], Awaitable[List[StkSodRef]]]:
|
|
172
|
+
"""Get one stock's pre-market data within an inclusive date range.
|
|
173
|
+
|
|
174
|
+
Parameters
|
|
175
|
+
----------
|
|
176
|
+
id : str
|
|
177
|
+
A single stock ID; its meaning is controlled by stable_id.
|
|
178
|
+
start, end : str, datetime.date or datetime.datetime
|
|
179
|
+
Inclusive dates; strings accept YYYY-MM-DD or YYYYMMDD.
|
|
180
|
+
end must not precede start.
|
|
181
|
+
stable_id : bool, default: True
|
|
182
|
+
True filters by stable (first-listing) ID. False uses the current
|
|
183
|
+
latest ID, independent of start/end. If multiple listings match,
|
|
184
|
+
the server uses the last listing by start_time. Returned fields
|
|
185
|
+
remain unchanged: id is stable and display_id is the ticker plus
|
|
186
|
+
exchange on each record's date.
|
|
187
|
+
|
|
188
|
+
Returns
|
|
189
|
+
-------
|
|
190
|
+
list[StkSodRef] or Awaitable[list[StkSodRef]]
|
|
191
|
+
Records sorted by date ascending; await with AsyncWebDataClient.
|
|
192
|
+
"""
|
|
193
|
+
return self._context.post_model_list(
|
|
194
|
+
StkSodRef,
|
|
195
|
+
f'{self._api_root}/stk-sod-ref-id',
|
|
196
|
+
payload={
|
|
197
|
+
'id': id,
|
|
198
|
+
'start': parse_date_str_arg(start, False),
|
|
199
|
+
'end': parse_date_str_arg(end, False),
|
|
200
|
+
'stableId': stable_id,
|
|
201
|
+
},
|
|
202
|
+
)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from typing import Awaitable
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
4
|
+
|
|
5
|
+
from ._context import RequestContext
|
|
6
|
+
from ._input import parse_str_list_arg
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
__all__ = ['MdWebClient', 'BriefSnapshotRecord', 'FullSnapshotRecord']
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class _SnapshotRecord(BaseModel):
|
|
13
|
+
"""Latest market snapshot for a display ID, with time in Unix milliseconds."""
|
|
14
|
+
|
|
15
|
+
model_config = ConfigDict(validate_by_name=True)
|
|
16
|
+
|
|
17
|
+
id: str = Field(alias='i')
|
|
18
|
+
time: int = Field(alias='t')
|
|
19
|
+
pre_close: float = Field(alias='pc')
|
|
20
|
+
pre_settle: float = Field(alias='ps')
|
|
21
|
+
last: float = Field(alias='c')
|
|
22
|
+
volume: int = Field(alias='v')
|
|
23
|
+
amount: float = Field(alias='a')
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class BriefSnapshotRecord(_SnapshotRecord):
|
|
27
|
+
"""Snapshot with best bid and ask prices and quantities."""
|
|
28
|
+
|
|
29
|
+
bid1: float
|
|
30
|
+
bid1_qty: int = Field(alias='bid1q')
|
|
31
|
+
ask1: float
|
|
32
|
+
ask1_qty: int = Field(alias='ask1q')
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class FullSnapshotRecord(_SnapshotRecord):
|
|
36
|
+
"""Snapshot with order-book depth, session prices and open interest."""
|
|
37
|
+
|
|
38
|
+
pre_nav: float = Field(alias='preNav')
|
|
39
|
+
pre_open_interest: int = Field(alias='preOi')
|
|
40
|
+
open: float = Field(alias='o')
|
|
41
|
+
high: float = Field(alias='h')
|
|
42
|
+
low: float = Field(alias='l')
|
|
43
|
+
bid: list[float]
|
|
44
|
+
bid_qty: list[int] = Field(alias='bidq')
|
|
45
|
+
ask: list[float]
|
|
46
|
+
ask_qty: list[int] = Field(alias='askq')
|
|
47
|
+
upper_limit: float = Field(alias='ul')
|
|
48
|
+
lower_limit: float = Field(alias='ll')
|
|
49
|
+
open_interest: int = Field(alias='oi')
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class MdWebClient:
|
|
53
|
+
"""Query latest snapshots by display ID using a list or comma-separated string.
|
|
54
|
+
|
|
55
|
+
The server returns available snapshots sorted by display ID, once per ID.
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
def __init__(self, host: str, context: RequestContext) -> None:
|
|
59
|
+
self._api_root = f'http://{host}/v1/md'
|
|
60
|
+
self._context = context
|
|
61
|
+
|
|
62
|
+
def latest_brief(
|
|
63
|
+
self, ids: str | list[str],
|
|
64
|
+
) -> list[BriefSnapshotRecord] | Awaitable[list[BriefSnapshotRecord]]:
|
|
65
|
+
"""Get the latest brief snapshots for the requested display IDs."""
|
|
66
|
+
return self._context.post_model_list(
|
|
67
|
+
BriefSnapshotRecord, f'{self._api_root}/latest-brief',
|
|
68
|
+
payload={'ids': parse_str_list_arg(ids)},
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
def latest_full(
|
|
72
|
+
self, ids: str | list[str],
|
|
73
|
+
) -> list[FullSnapshotRecord] | Awaitable[list[FullSnapshotRecord]]:
|
|
74
|
+
"""Get the latest full snapshots for the requested display IDs."""
|
|
75
|
+
return self._context.post_model_list(
|
|
76
|
+
FullSnapshotRecord, f'{self._api_root}/latest-full',
|
|
77
|
+
payload={'ids': parse_str_list_arg(ids)},
|
|
78
|
+
)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: yjdata
|
|
3
|
+
Version: 0.2.5
|
|
4
|
+
Summary: yjdata SDK for Python
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: httpx>=0.25
|
|
8
|
+
Requires-Dist: polars>=1.30
|
|
9
|
+
Requires-Dist: pyarrow>=18
|
|
10
|
+
Requires-Dist: pydantic>=2.11
|
|
11
|
+
|
|
12
|
+
# yjdata
|
|
13
|
+
|
|
14
|
+
Python SDK,提供 yjdata WebAPI client、MySQL/PostgreSQL adapter 和 Parquet 工具。
|
|
15
|
+
[更新日志](doc/updates/v0.2.x.md)
|
|
16
|
+
|
|
17
|
+
## 安装与配置
|
|
18
|
+
|
|
19
|
+
需要 Python 3.10+:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install yjdata
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
默认访问内网 `yjdata-api.yaojingriver.internal`,可通过
|
|
26
|
+
`YJDATA_WEB_BASE_URL` 环境变量或 client 的 `host` 参数指定地址。
|
|
27
|
+
|
|
28
|
+
## 使用
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from yjdata import WebDataClient
|
|
32
|
+
|
|
33
|
+
client = WebDataClient()
|
|
34
|
+
prices = client.cn_stock.stk_eod_md("2026-11-06", ids="000001.XSHE")
|
|
35
|
+
for price in prices:
|
|
36
|
+
print(price.id, price.close)
|
|
37
|
+
|
|
38
|
+
for snapshot in client.md.latest_brief(["000001.XSHE"]):
|
|
39
|
+
print(snapshot.id, snapshot.last, snapshot.bid1, snapshot.ask1)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- WebAPI:`calendar`、`md`、`cn_stock`、`cn_future`、`cn_fund`;异步使用 `AsyncWebDataClient`。
|
|
43
|
+
- ETF/LOF:`cn_fund.etf_eod_md` 和 `cn_fund.etf_sod_ref` 按交易日查询收盘行情和盘前参考数据。对应的 `_id` 方法按单只基金查询闭区间内的数据。
|
|
44
|
+
- 最新行情:`md.latest_brief` 获取买卖一档,`md.latest_full` 获取完整快照。两者均接受显示 ID 列表或逗号分隔的字符串。
|
|
45
|
+
- 数据库:`yjdata.db.MysqlAdapter`、`yjdata.db.PostgresAdapter`。
|
|
46
|
+
- Parquet:`yjdata.dataset`。
|
|
47
|
+
|
|
48
|
+
接口与字段见 [OpenAPI](https://yjdata-api.yaojingriver.internal/openapi.json),
|
|
49
|
+
Python 参数见对应模块的 docstring。
|
|
@@ -26,9 +26,12 @@ src/yjdata/web/_context.py
|
|
|
26
26
|
src/yjdata/web/_input.py
|
|
27
27
|
src/yjdata/web/calendar.py
|
|
28
28
|
src/yjdata/web/client.py
|
|
29
|
+
src/yjdata/web/cn_fund.py
|
|
29
30
|
src/yjdata/web/cn_future.py
|
|
30
31
|
src/yjdata/web/cn_stock.py
|
|
32
|
+
src/yjdata/web/md.py
|
|
31
33
|
src/yjdata/web/time_util.py
|
|
32
34
|
tests/test_batch_writes.py
|
|
33
35
|
tests/test_last_of_group.py
|
|
34
|
-
tests/test_mysql_batch_updates.py
|
|
36
|
+
tests/test_mysql_batch_updates.py
|
|
37
|
+
tests/test_web_market_data.py
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
import httpx
|
|
3
|
+
import json
|
|
4
|
+
import unittest
|
|
5
|
+
|
|
6
|
+
from unittest.mock import patch
|
|
7
|
+
from yjdata import AsyncWebDataClient, WebDataClient
|
|
8
|
+
from yjdata.web.cn_future import FutEodMd, FutSodRef
|
|
9
|
+
from yjdata.web.cn_stock import StkEodMd, StkSodRef
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
STOCK_EOD = {
|
|
13
|
+
'id': '000022.XSHE', 'date': '2016-11-04',
|
|
14
|
+
'pc': 10.0, 'o': 10.1, 'h': 10.5, 'l': 9.9, 'c': 10.2,
|
|
15
|
+
'vol': 100, 'amt': 1020.0,
|
|
16
|
+
}
|
|
17
|
+
STOCK_SOD = {
|
|
18
|
+
'id': '000022.XSHE', 'date': '2016-11-04', 'name': 'test stock',
|
|
19
|
+
'dispId': '000022.XSHE', 'ticker': '000022', 'status': 'T', 'st': 'N',
|
|
20
|
+
'pc': 10.0, 'prc': 10.0, 'ul': 11.0, 'll': 9.0,
|
|
21
|
+
'auct': '555|565,897|900', 'cont': '570|690,780|897',
|
|
22
|
+
}
|
|
23
|
+
FUTURE_EOD = {
|
|
24
|
+
**STOCK_EOD, 'id': 'cu2612.XSGE', 'ps': 10.0, 's': 10.2, 'oi': 1000,
|
|
25
|
+
}
|
|
26
|
+
FUTURE_SOD = {
|
|
27
|
+
'id': 'cu2612.XSGE', 'date': '2016-11-04', 'name': 'test future',
|
|
28
|
+
'dispId': 'cu2612.XSGE', 'ticker': 'cu2612', 'status': 'T',
|
|
29
|
+
'ulId': None, 'prod': 'cu', 'mult': 5.0, 'tick': 10.0,
|
|
30
|
+
'pc': 10.0, 'ps': 10.0, 'ul': 11.0, 'll': 9.0,
|
|
31
|
+
'auct': '-185|-180,535|540', 'cont': '-180|60,540|615,630|690,810|900',
|
|
32
|
+
}
|
|
33
|
+
ENDPOINTS = (
|
|
34
|
+
('cn_stock', 'stk_eod_md', StkEodMd, STOCK_EOD),
|
|
35
|
+
('cn_stock', 'stk_sod_ref', StkSodRef, STOCK_SOD),
|
|
36
|
+
('cn_future', 'fut_eod_md', FutEodMd, FUTURE_EOD),
|
|
37
|
+
('cn_future', 'fut_sod_ref', FutSodRef, FUTURE_SOD),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def request_cases():
|
|
42
|
+
for market, method, model, record in ENDPOINTS:
|
|
43
|
+
for suffix in ('', '_id'):
|
|
44
|
+
for latest in (False, True) if market == 'cn_stock' else (False,):
|
|
45
|
+
id = '001872.XSHE' if latest else record['id']
|
|
46
|
+
if suffix:
|
|
47
|
+
args = {
|
|
48
|
+
'id': id,
|
|
49
|
+
'start': datetime.date(2016, 11, 1),
|
|
50
|
+
'end': datetime.datetime(2016, 11, 4, 15, 0),
|
|
51
|
+
}
|
|
52
|
+
payload = {'id': id, 'start': '2016-11-01', 'end': '2016-11-04'}
|
|
53
|
+
else:
|
|
54
|
+
args = {'date': '20161104', 'ids': f' {id} '}
|
|
55
|
+
payload = {'date': '2016-11-04', 'ids': [id]}
|
|
56
|
+
if market == 'cn_stock':
|
|
57
|
+
payload['stableId'] = not latest
|
|
58
|
+
if latest:
|
|
59
|
+
args['stable_id'] = False
|
|
60
|
+
expected = dict(record)
|
|
61
|
+
if latest and method == 'stk_eod_md':
|
|
62
|
+
expected['id'] = id
|
|
63
|
+
path = f'/v1/{market}/{method}{suffix}'.replace('_', '-')
|
|
64
|
+
yield market, method + suffix, model, args, path, payload, expected
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class MarketDataTests(unittest.TestCase):
|
|
68
|
+
def test_sync_endpoints_payloads_and_models(self) -> None:
|
|
69
|
+
for market, method, model, args, path, payload, record in request_cases():
|
|
70
|
+
with self.subTest(method=method, payload=payload):
|
|
71
|
+
requests = []
|
|
72
|
+
|
|
73
|
+
def respond(request: httpx.Request) -> httpx.Response:
|
|
74
|
+
requests.append(request)
|
|
75
|
+
return httpx.Response(200, json=[record])
|
|
76
|
+
|
|
77
|
+
with httpx.Client(transport=httpx.MockTransport(respond)) as http:
|
|
78
|
+
with patch('yjdata.web._context.httpx.Client', return_value=http):
|
|
79
|
+
client = WebDataClient('example.test:8000')
|
|
80
|
+
result = getattr(getattr(client, market), method)(**args)
|
|
81
|
+
self.assertEqual(len(requests), 1)
|
|
82
|
+
self.assertEqual(requests[0].method, 'POST')
|
|
83
|
+
self.assertEqual(str(requests[0].url), f'http://example.test:8000{path}')
|
|
84
|
+
self.assertEqual(json.loads(requests[0].content), payload)
|
|
85
|
+
self.assertIsInstance(result[0], model)
|
|
86
|
+
self.assertEqual(result[0].model_dump(by_alias=True), record)
|
|
87
|
+
|
|
88
|
+
def test_daily_id_defaults_and_empty_filters(self) -> None:
|
|
89
|
+
for market, method, _, record in ENDPOINTS:
|
|
90
|
+
for ids, expected in (
|
|
91
|
+
(None, None), ('', []), ([], []),
|
|
92
|
+
(f' {record["id"]}, another-id ', [record['id'], 'another-id']),
|
|
93
|
+
):
|
|
94
|
+
with self.subTest(method=method, ids=ids):
|
|
95
|
+
requests = []
|
|
96
|
+
|
|
97
|
+
def respond(request: httpx.Request) -> httpx.Response:
|
|
98
|
+
requests.append(request)
|
|
99
|
+
return httpx.Response(200, json=[])
|
|
100
|
+
|
|
101
|
+
with httpx.Client(transport=httpx.MockTransport(respond)) as http:
|
|
102
|
+
with patch('yjdata.web._context.httpx.Client', return_value=http):
|
|
103
|
+
client = WebDataClient('example.test')
|
|
104
|
+
method_call = getattr(getattr(client, market), method)
|
|
105
|
+
self.assertEqual(method_call('2016-11-04', ids), [])
|
|
106
|
+
payload = json.loads(requests[0].content)
|
|
107
|
+
self.assertEqual(payload['ids'], expected)
|
|
108
|
+
if market == 'cn_stock':
|
|
109
|
+
self.assertIs(payload['stableId'], True)
|
|
110
|
+
else:
|
|
111
|
+
self.assertNotIn('stableId', payload)
|
|
112
|
+
|
|
113
|
+
def test_range_date_formats_and_http_errors(self) -> None:
|
|
114
|
+
requests = []
|
|
115
|
+
|
|
116
|
+
def respond(request: httpx.Request) -> httpx.Response:
|
|
117
|
+
requests.append(request)
|
|
118
|
+
return httpx.Response(422, json={'detail': 'invalid range'})
|
|
119
|
+
|
|
120
|
+
dates = (
|
|
121
|
+
'20161104', '2016-11-04', datetime.date(2016, 11, 4),
|
|
122
|
+
datetime.datetime(2016, 11, 4, 12, 30),
|
|
123
|
+
)
|
|
124
|
+
with httpx.Client(transport=httpx.MockTransport(respond)) as http:
|
|
125
|
+
with patch('yjdata.web._context.httpx.Client', return_value=http):
|
|
126
|
+
client = WebDataClient('example.test')
|
|
127
|
+
for market, method, _, record in ENDPOINTS:
|
|
128
|
+
for date in dates:
|
|
129
|
+
with self.subTest(method=method, date=date):
|
|
130
|
+
with self.assertRaises(httpx.HTTPStatusError):
|
|
131
|
+
getattr(getattr(client, market), method + '_id')(
|
|
132
|
+
record['id'],
|
|
133
|
+
date,
|
|
134
|
+
'20161101',
|
|
135
|
+
)
|
|
136
|
+
payload = json.loads(requests[-1].content)
|
|
137
|
+
self.assertEqual(payload['start'], '2016-11-04')
|
|
138
|
+
self.assertEqual(payload['end'], '2016-11-01')
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class AsyncMarketDataTests(unittest.IsolatedAsyncioTestCase):
|
|
142
|
+
async def test_async_endpoints_payloads_and_models(self) -> None:
|
|
143
|
+
for market, method, model, args, path, payload, record in request_cases():
|
|
144
|
+
with self.subTest(method=method, payload=payload):
|
|
145
|
+
requests = []
|
|
146
|
+
|
|
147
|
+
def respond(request: httpx.Request) -> httpx.Response:
|
|
148
|
+
requests.append(request)
|
|
149
|
+
return httpx.Response(200, json=[record])
|
|
150
|
+
|
|
151
|
+
async with httpx.AsyncClient(transport=httpx.MockTransport(respond)) as http:
|
|
152
|
+
with patch('yjdata.web._context.httpx.AsyncClient', return_value=http):
|
|
153
|
+
client = AsyncWebDataClient('example.test:8000')
|
|
154
|
+
result = await getattr(getattr(client, market), method)(**args)
|
|
155
|
+
self.assertEqual(len(requests), 1)
|
|
156
|
+
self.assertEqual(requests[0].method, 'POST')
|
|
157
|
+
self.assertEqual(str(requests[0].url), f'http://example.test:8000{path}')
|
|
158
|
+
self.assertEqual(json.loads(requests[0].content), payload)
|
|
159
|
+
self.assertIsInstance(result[0], model)
|
|
160
|
+
self.assertEqual(result[0].model_dump(by_alias=True), record)
|
|
161
|
+
|
|
162
|
+
async def test_async_empty_results_and_http_errors(self) -> None:
|
|
163
|
+
for status in (200, 422, 500):
|
|
164
|
+
def respond(request: httpx.Request) -> httpx.Response:
|
|
165
|
+
return httpx.Response(status, json=[])
|
|
166
|
+
|
|
167
|
+
async with httpx.AsyncClient(transport=httpx.MockTransport(respond)) as http:
|
|
168
|
+
with patch('yjdata.web._context.httpx.AsyncClient', return_value=http):
|
|
169
|
+
client = AsyncWebDataClient('example.test')
|
|
170
|
+
for market, method, _, record in ENDPOINTS:
|
|
171
|
+
with self.subTest(status=status, method=method):
|
|
172
|
+
result = getattr(getattr(client, market), method + '_id')(
|
|
173
|
+
record['id'],
|
|
174
|
+
'20161101',
|
|
175
|
+
'20161104',
|
|
176
|
+
)
|
|
177
|
+
if status == 200:
|
|
178
|
+
self.assertEqual(await result, [])
|
|
179
|
+
else:
|
|
180
|
+
with self.assertRaises(httpx.HTTPStatusError):
|
|
181
|
+
await result
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
if __name__ == '__main__':
|
|
185
|
+
unittest.main()
|
yjdata-0.2.4/PKG-INFO
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: yjdata
|
|
3
|
-
Version: 0.2.4
|
|
4
|
-
Summary: yjdata SDK for Python
|
|
5
|
-
Requires-Python: >=3.10
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: httpx>=0.25
|
|
8
|
-
Requires-Dist: polars>=1.30
|
|
9
|
-
Requires-Dist: pyarrow>=18
|
|
10
|
-
Requires-Dist: pydantic>=2.11
|
|
11
|
-
|
|
12
|
-
# yjdata
|
|
13
|
-
|
|
14
|
-
Python SDK for the YJData web API, MySQL/PostgreSQL adapters, and Parquet utilities.
|
|
15
|
-
|
|
16
|
-
## Web API
|
|
17
|
-
|
|
18
|
-
```python
|
|
19
|
-
from yjdata import WebDataClient
|
|
20
|
-
|
|
21
|
-
client = WebDataClient()
|
|
22
|
-
prices = client.cn_stock.stk_eod_md("2026-11-06", ids="000001.XSHE")
|
|
23
|
-
for price in prices:
|
|
24
|
-
print(price.id, price.close)
|
|
25
|
-
|
|
26
|
-
trading_days = client.calendar.range("2026-11-01", "2026-11-06")
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
| Method | Data |
|
|
30
|
-
| --- | --- |
|
|
31
|
-
| `cn_stock.stk_eod_md(date, ids=None, stable_id=True)` | Stock end-of-day prices |
|
|
32
|
-
| `cn_stock.stk_sod_ref(date, ids=None)` | Stock pre-market reference data |
|
|
33
|
-
| `cn_future.fut_eod_md(date, ids=None)` | Futures end-of-day prices |
|
|
34
|
-
| `cn_future.fut_sod_ref(date, ids=None)` | Futures pre-market reference data |
|
|
35
|
-
| `calendar.next_n(start, n)`, `last_n(end, n)`, `range(start, end)`, `is_trading_day(date)` | Trading calendar; optional `calendar="XSHG"` |
|
|
36
|
-
|
|
37
|
-
- Dates accept `YYYY-MM-DD`, `YYYYMMDD`, `datetime.date`, or `datetime.datetime`.
|
|
38
|
-
- IDs accept lists or comma-separated strings. `None` returns all records;
|
|
39
|
-
`[]` or a blank string returns none.
|
|
40
|
-
- Stock prices use first-listing IDs by default. `stable_id=False` uses the
|
|
41
|
-
ticker on the requested date.
|
|
42
|
-
- Market data returns Pydantic models with friendly fields such as `close`,
|
|
43
|
-
`volume`, and `display_id`; `time` is a `YYYY-MM-DD` string. Models accept
|
|
44
|
-
friendly names and API aliases. `model_dump(by_alias=True)` exports API names.
|
|
45
|
-
- Use `AsyncWebDataClient` with `await` for the same methods.
|
|
46
|
-
|
|
47
|
-
See the [OpenAPI schema](https://yjdata-api.yaojingriver.internal/openapi.json)
|
|
48
|
-
for endpoint and field details.
|
|
49
|
-
|
|
50
|
-
## Database adapters
|
|
51
|
-
|
|
52
|
-
`MysqlAdapter` (MySQL 8.0+) and `PostgresAdapter` support
|
|
53
|
-
`select_last_of_group(table, group_by=..., sort_by=...)` and
|
|
54
|
-
`select_last_of_group_polars(...)`, returning dictionaries or a Polars DataFrame.
|
|
55
|
-
|
|
56
|
-
These methods select the last complete row per group in SQL. Use `ascending`
|
|
57
|
-
to control sort direction, `filter` before selection, `post_filter` afterward,
|
|
58
|
-
and `columns` for projection. NULLs sort below non-NULL values; include a unique
|
|
59
|
-
tie-breaker in `sort_by` for deterministic selection. Group output order is
|
|
60
|
-
unspecified.
|
|
61
|
-
|
|
62
|
-
## Tests
|
|
63
|
-
|
|
64
|
-
```sh
|
|
65
|
-
PYTHONPATH=src python -m unittest discover -s tests -v
|
|
66
|
-
```
|
yjdata-0.2.4/README.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# yjdata
|
|
2
|
-
|
|
3
|
-
Python SDK for the YJData web API, MySQL/PostgreSQL adapters, and Parquet utilities.
|
|
4
|
-
|
|
5
|
-
## Web API
|
|
6
|
-
|
|
7
|
-
```python
|
|
8
|
-
from yjdata import WebDataClient
|
|
9
|
-
|
|
10
|
-
client = WebDataClient()
|
|
11
|
-
prices = client.cn_stock.stk_eod_md("2026-11-06", ids="000001.XSHE")
|
|
12
|
-
for price in prices:
|
|
13
|
-
print(price.id, price.close)
|
|
14
|
-
|
|
15
|
-
trading_days = client.calendar.range("2026-11-01", "2026-11-06")
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
| Method | Data |
|
|
19
|
-
| --- | --- |
|
|
20
|
-
| `cn_stock.stk_eod_md(date, ids=None, stable_id=True)` | Stock end-of-day prices |
|
|
21
|
-
| `cn_stock.stk_sod_ref(date, ids=None)` | Stock pre-market reference data |
|
|
22
|
-
| `cn_future.fut_eod_md(date, ids=None)` | Futures end-of-day prices |
|
|
23
|
-
| `cn_future.fut_sod_ref(date, ids=None)` | Futures pre-market reference data |
|
|
24
|
-
| `calendar.next_n(start, n)`, `last_n(end, n)`, `range(start, end)`, `is_trading_day(date)` | Trading calendar; optional `calendar="XSHG"` |
|
|
25
|
-
|
|
26
|
-
- Dates accept `YYYY-MM-DD`, `YYYYMMDD`, `datetime.date`, or `datetime.datetime`.
|
|
27
|
-
- IDs accept lists or comma-separated strings. `None` returns all records;
|
|
28
|
-
`[]` or a blank string returns none.
|
|
29
|
-
- Stock prices use first-listing IDs by default. `stable_id=False` uses the
|
|
30
|
-
ticker on the requested date.
|
|
31
|
-
- Market data returns Pydantic models with friendly fields such as `close`,
|
|
32
|
-
`volume`, and `display_id`; `time` is a `YYYY-MM-DD` string. Models accept
|
|
33
|
-
friendly names and API aliases. `model_dump(by_alias=True)` exports API names.
|
|
34
|
-
- Use `AsyncWebDataClient` with `await` for the same methods.
|
|
35
|
-
|
|
36
|
-
See the [OpenAPI schema](https://yjdata-api.yaojingriver.internal/openapi.json)
|
|
37
|
-
for endpoint and field details.
|
|
38
|
-
|
|
39
|
-
## Database adapters
|
|
40
|
-
|
|
41
|
-
`MysqlAdapter` (MySQL 8.0+) and `PostgresAdapter` support
|
|
42
|
-
`select_last_of_group(table, group_by=..., sort_by=...)` and
|
|
43
|
-
`select_last_of_group_polars(...)`, returning dictionaries or a Polars DataFrame.
|
|
44
|
-
|
|
45
|
-
These methods select the last complete row per group in SQL. Use `ascending`
|
|
46
|
-
to control sort direction, `filter` before selection, `post_filter` afterward,
|
|
47
|
-
and `columns` for projection. NULLs sort below non-NULL values; include a unique
|
|
48
|
-
tie-breaker in `sort_by` for deterministic selection. Group output order is
|
|
49
|
-
unspecified.
|
|
50
|
-
|
|
51
|
-
## Tests
|
|
52
|
-
|
|
53
|
-
```sh
|
|
54
|
-
PYTHONPATH=src python -m unittest discover -s tests -v
|
|
55
|
-
```
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
from typing import Awaitable, List, Union
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, ConfigDict, Field
|
|
4
|
-
|
|
5
|
-
from ._context import RequestContext
|
|
6
|
-
from ._input import DateStrArgType, StrListArgType, parse_date_str_arg, parse_str_list_arg
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__all__ = ['CnStockWebClient', 'StkEodMd', 'StkSodRef']
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class StkEodMd(BaseModel):
|
|
13
|
-
"""Stock end-of-day prices, volume and turnover."""
|
|
14
|
-
|
|
15
|
-
model_config = ConfigDict(validate_by_name=True)
|
|
16
|
-
|
|
17
|
-
id: str
|
|
18
|
-
time: str = Field(alias='date')
|
|
19
|
-
pre_close: float = Field(alias='pc')
|
|
20
|
-
open: float = Field(alias='o')
|
|
21
|
-
high: float = Field(alias='h')
|
|
22
|
-
low: float = Field(alias='l')
|
|
23
|
-
close: float = Field(alias='c')
|
|
24
|
-
volume: int = Field(alias='vol')
|
|
25
|
-
amount: float = Field(alias='amt')
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class StkSodRef(BaseModel):
|
|
29
|
-
"""Stock pre-market reference data. IDs use the first listing ticker."""
|
|
30
|
-
|
|
31
|
-
model_config = ConfigDict(validate_by_name=True)
|
|
32
|
-
|
|
33
|
-
id: str
|
|
34
|
-
time: str = Field(alias='date')
|
|
35
|
-
name: str
|
|
36
|
-
display_id: str = Field(alias='dispId')
|
|
37
|
-
ticker: str
|
|
38
|
-
trading_status: str = Field(alias='status')
|
|
39
|
-
st_status: str = Field(alias='st')
|
|
40
|
-
pre_close: float = Field(alias='pc')
|
|
41
|
-
prior_close: float = Field(alias='prc')
|
|
42
|
-
upper_limit: float = Field(alias='ul')
|
|
43
|
-
lower_limit: float = Field(alias='ll')
|
|
44
|
-
auct_hours: str = Field(alias='auct')
|
|
45
|
-
cont_hours: str = Field(alias='cont')
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
class CnStockWebClient:
|
|
49
|
-
|
|
50
|
-
def __init__(self, host: str, context: RequestContext):
|
|
51
|
-
self._api_root = f'http://{host}/v1/cn_stock'
|
|
52
|
-
self._context = context
|
|
53
|
-
|
|
54
|
-
def stk_eod_md(
|
|
55
|
-
self,
|
|
56
|
-
date: DateStrArgType,
|
|
57
|
-
ids: StrListArgType = None,
|
|
58
|
-
stable_id: bool = True
|
|
59
|
-
) -> Union[List[StkEodMd], Awaitable[List[StkEodMd]]]:
|
|
60
|
-
"""Get stock end-of-day market data for a trading date.
|
|
61
|
-
|
|
62
|
-
Parameters
|
|
63
|
-
----------
|
|
64
|
-
date : str, datetime.date or datetime.datetime
|
|
65
|
-
Trading date; strings accept YYYY-MM-DD or YYYYMMDD.
|
|
66
|
-
ids : str or list[str], optional
|
|
67
|
-
IDs as a list or comma-separated string. None returns all records;
|
|
68
|
-
an empty list or blank string returns no records.
|
|
69
|
-
stable_id : bool, default: True
|
|
70
|
-
Use the first listing ticker plus exchange for both the ID filter
|
|
71
|
-
and returned IDs. False uses the ticker on the requested date.
|
|
72
|
-
|
|
73
|
-
Returns
|
|
74
|
-
-------
|
|
75
|
-
list[StkEodMd] or Awaitable[list[StkEodMd]]
|
|
76
|
-
Validated records; await the result with AsyncWebDataClient.
|
|
77
|
-
"""
|
|
78
|
-
return self._context.post_model_list(StkEodMd, f'{self._api_root}/stk-eod-md', payload={
|
|
79
|
-
'date': parse_date_str_arg(date, False),
|
|
80
|
-
'ids': None if ids is None else parse_str_list_arg(ids),
|
|
81
|
-
'stableId': stable_id
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
def stk_sod_ref(
|
|
85
|
-
self,
|
|
86
|
-
date: DateStrArgType,
|
|
87
|
-
ids: StrListArgType = None
|
|
88
|
-
) -> Union[List[StkSodRef], Awaitable[List[StkSodRef]]]:
|
|
89
|
-
"""Get stock pre-market reference data for a trading date.
|
|
90
|
-
|
|
91
|
-
Parameters
|
|
92
|
-
----------
|
|
93
|
-
date : str, datetime.date or datetime.datetime
|
|
94
|
-
Trading date; strings accept YYYY-MM-DD or YYYYMMDD.
|
|
95
|
-
ids : str or list[str], optional
|
|
96
|
-
IDs as a list or comma-separated string. None returns all records;
|
|
97
|
-
an empty list or blank string returns no records.
|
|
98
|
-
|
|
99
|
-
Returns
|
|
100
|
-
-------
|
|
101
|
-
list[StkSodRef] or Awaitable[list[StkSodRef]]
|
|
102
|
-
Validated records; await the result with AsyncWebDataClient.
|
|
103
|
-
Fields use backend Python names, such as display_id for dispId.
|
|
104
|
-
"""
|
|
105
|
-
return self._context.post_model_list(StkSodRef, f'{self._api_root}/stk-sod-ref', payload={
|
|
106
|
-
'date': parse_date_str_arg(date, False),
|
|
107
|
-
'ids': None if ids is None else parse_str_list_arg(ids)
|
|
108
|
-
})
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: yjdata
|
|
3
|
-
Version: 0.2.4
|
|
4
|
-
Summary: yjdata SDK for Python
|
|
5
|
-
Requires-Python: >=3.10
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: httpx>=0.25
|
|
8
|
-
Requires-Dist: polars>=1.30
|
|
9
|
-
Requires-Dist: pyarrow>=18
|
|
10
|
-
Requires-Dist: pydantic>=2.11
|
|
11
|
-
|
|
12
|
-
# yjdata
|
|
13
|
-
|
|
14
|
-
Python SDK for the YJData web API, MySQL/PostgreSQL adapters, and Parquet utilities.
|
|
15
|
-
|
|
16
|
-
## Web API
|
|
17
|
-
|
|
18
|
-
```python
|
|
19
|
-
from yjdata import WebDataClient
|
|
20
|
-
|
|
21
|
-
client = WebDataClient()
|
|
22
|
-
prices = client.cn_stock.stk_eod_md("2026-11-06", ids="000001.XSHE")
|
|
23
|
-
for price in prices:
|
|
24
|
-
print(price.id, price.close)
|
|
25
|
-
|
|
26
|
-
trading_days = client.calendar.range("2026-11-01", "2026-11-06")
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
| Method | Data |
|
|
30
|
-
| --- | --- |
|
|
31
|
-
| `cn_stock.stk_eod_md(date, ids=None, stable_id=True)` | Stock end-of-day prices |
|
|
32
|
-
| `cn_stock.stk_sod_ref(date, ids=None)` | Stock pre-market reference data |
|
|
33
|
-
| `cn_future.fut_eod_md(date, ids=None)` | Futures end-of-day prices |
|
|
34
|
-
| `cn_future.fut_sod_ref(date, ids=None)` | Futures pre-market reference data |
|
|
35
|
-
| `calendar.next_n(start, n)`, `last_n(end, n)`, `range(start, end)`, `is_trading_day(date)` | Trading calendar; optional `calendar="XSHG"` |
|
|
36
|
-
|
|
37
|
-
- Dates accept `YYYY-MM-DD`, `YYYYMMDD`, `datetime.date`, or `datetime.datetime`.
|
|
38
|
-
- IDs accept lists or comma-separated strings. `None` returns all records;
|
|
39
|
-
`[]` or a blank string returns none.
|
|
40
|
-
- Stock prices use first-listing IDs by default. `stable_id=False` uses the
|
|
41
|
-
ticker on the requested date.
|
|
42
|
-
- Market data returns Pydantic models with friendly fields such as `close`,
|
|
43
|
-
`volume`, and `display_id`; `time` is a `YYYY-MM-DD` string. Models accept
|
|
44
|
-
friendly names and API aliases. `model_dump(by_alias=True)` exports API names.
|
|
45
|
-
- Use `AsyncWebDataClient` with `await` for the same methods.
|
|
46
|
-
|
|
47
|
-
See the [OpenAPI schema](https://yjdata-api.yaojingriver.internal/openapi.json)
|
|
48
|
-
for endpoint and field details.
|
|
49
|
-
|
|
50
|
-
## Database adapters
|
|
51
|
-
|
|
52
|
-
`MysqlAdapter` (MySQL 8.0+) and `PostgresAdapter` support
|
|
53
|
-
`select_last_of_group(table, group_by=..., sort_by=...)` and
|
|
54
|
-
`select_last_of_group_polars(...)`, returning dictionaries or a Polars DataFrame.
|
|
55
|
-
|
|
56
|
-
These methods select the last complete row per group in SQL. Use `ascending`
|
|
57
|
-
to control sort direction, `filter` before selection, `post_filter` afterward,
|
|
58
|
-
and `columns` for projection. NULLs sort below non-NULL values; include a unique
|
|
59
|
-
tie-breaker in `sort_by` for deterministic selection. Group output order is
|
|
60
|
-
unspecified.
|
|
61
|
-
|
|
62
|
-
## Tests
|
|
63
|
-
|
|
64
|
-
```sh
|
|
65
|
-
PYTHONPATH=src python -m unittest discover -s tests -v
|
|
66
|
-
```
|
|
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
|