Name | a-trade-calendar JSON |
Version |
2026.2.13.1
JSON |
| download |
home_page | |
Summary | 适用于A股,一款简单、纯粹的交易日历工具包。来自[西海岸量化工作室]。 |
upload_time | 2024-02-17 09:42:07 |
maintainer | |
docs_url | None |
author | |
requires_python | |
license | BSD 2-Clause License |
keywords |
a股
日历
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# a_trade_calendar
一款简单、纯粹,适用于A股的交易日历工具包。来自[西海岸量化工作室]。
# 安装
## 全新安装
```
pip install a-trade-calendar
```
## 升级安装
```
pip install --upgrade a-trade-calendar
```
# 使用
声明:日期范围从2005.1.1期 到2025-08-15 日止。
将来日期后续会保持更新,日期将到会自动提示更新。
## 1、获取A股最新交易日日期
```
import a_trade_calendar
latest_trade_dt = a_trade_calendar.get_latest_trade_date()
print(latest_trade_dt)
```
## 2、判断某个日期是否是A股交易日
```
import a_trade_calendar
dt = '2023-09-01'
is_trade_date = a_trade_calendar.is_trade_date(dt)
print(is_trade_date)
```
## 3、获取A股前面n个交易日对应的日期
```
import a_trade_calendar
dt = '2023-09-01'
trade_date = a_trade_calendar.get_pre_trade_date(dt, 3)
print(trade_date)
```
## 4、获取A股后面n个交易日对应的日期
```
import a_trade_calendar
dt = '2023-09-01'
trade_date = a_trade_calendar.get_next_trade_date(dt, 3)
print(trade_date)
```
## 5、获取A股两个日期相隔的交易日天数,不包括 from_dt 和 to_dt
```
import a_trade_calendar
from_dt = '2023-08-21'
to_dt = '2023-09-01'
trade_days = a_trade_calendar.get_trade_days_interval(from_dt, to_dt)
print(trade_days)
```
## 6、获取A股两个日期相隔的交易日天数,包括 from_dt 和 to_dt
```
import a_trade_calendar
from_dt = '2023-08-21'
to_dt = '2023-09-01'
trade_days = a_trade_calendar.get_trade_count(from_dt, to_dt)
print(trade_days)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "a-trade-calendar",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "a\u80a1,\u65e5\u5386",
"author": "",
"author_email": "",
"download_url": "",
"platform": null,
"description": "# a_trade_calendar\n\n\u4e00\u6b3e\u7b80\u5355\u3001\u7eaf\u7cb9\uff0c\u9002\u7528\u4e8eA\u80a1\u7684\u4ea4\u6613\u65e5\u5386\u5de5\u5177\u5305\u3002\u6765\u81ea[\u897f\u6d77\u5cb8\u91cf\u5316\u5de5\u4f5c\u5ba4]\u3002\n\n# \u5b89\u88c5\n\n## \u5168\u65b0\u5b89\u88c5\n\n```\npip install a-trade-calendar\n```\n\n## \u5347\u7ea7\u5b89\u88c5\n\n```\npip install --upgrade a-trade-calendar\n```\n\n# \u4f7f\u7528\n\n\u58f0\u660e\uff1a\u65e5\u671f\u8303\u56f4\u4ece2005.1.1\u671f \u52302025-08-15 \u65e5\u6b62\u3002\n\u5c06\u6765\u65e5\u671f\u540e\u7eed\u4f1a\u4fdd\u6301\u66f4\u65b0\uff0c\u65e5\u671f\u5c06\u5230\u4f1a\u81ea\u52a8\u63d0\u793a\u66f4\u65b0\u3002\n\n## 1\u3001\u83b7\u53d6A\u80a1\u6700\u65b0\u4ea4\u6613\u65e5\u65e5\u671f\n\n```\nimport a_trade_calendar\nlatest_trade_dt = a_trade_calendar.get_latest_trade_date()\n\nprint(latest_trade_dt)\n```\n\n## 2\u3001\u5224\u65ad\u67d0\u4e2a\u65e5\u671f\u662f\u5426\u662fA\u80a1\u4ea4\u6613\u65e5\n\n```\nimport a_trade_calendar\ndt = '2023-09-01'\nis_trade_date = a_trade_calendar.is_trade_date(dt)\n\nprint(is_trade_date)\n```\n\n## 3\u3001\u83b7\u53d6A\u80a1\u524d\u9762n\u4e2a\u4ea4\u6613\u65e5\u5bf9\u5e94\u7684\u65e5\u671f\n\n```\nimport a_trade_calendar\ndt = '2023-09-01'\ntrade_date = a_trade_calendar.get_pre_trade_date(dt, 3)\n\nprint(trade_date)\n```\n\n## 4\u3001\u83b7\u53d6A\u80a1\u540e\u9762n\u4e2a\u4ea4\u6613\u65e5\u5bf9\u5e94\u7684\u65e5\u671f\n\n```\nimport a_trade_calendar\ndt = '2023-09-01'\ntrade_date = a_trade_calendar.get_next_trade_date(dt, 3)\n\nprint(trade_date)\n```\n\n## 5\u3001\u83b7\u53d6A\u80a1\u4e24\u4e2a\u65e5\u671f\u76f8\u9694\u7684\u4ea4\u6613\u65e5\u5929\u6570\uff0c\u4e0d\u5305\u62ec from_dt \u548c to_dt\n\n```\nimport a_trade_calendar\n\nfrom_dt = '2023-08-21'\nto_dt = '2023-09-01'\n\ntrade_days = a_trade_calendar.get_trade_days_interval(from_dt, to_dt)\n\nprint(trade_days)\n```\n\n\n## 6\u3001\u83b7\u53d6A\u80a1\u4e24\u4e2a\u65e5\u671f\u76f8\u9694\u7684\u4ea4\u6613\u65e5\u5929\u6570\uff0c\u5305\u62ec from_dt \u548c to_dt\n\n```\nimport a_trade_calendar\n\nfrom_dt = '2023-08-21'\nto_dt = '2023-09-01'\n\ntrade_days = a_trade_calendar.get_trade_count(from_dt, to_dt)\n\nprint(trade_days)\n```\n",
"bugtrack_url": null,
"license": "BSD 2-Clause License",
"summary": "\u9002\u7528\u4e8eA\u80a1\uff0c\u4e00\u6b3e\u7b80\u5355\u3001\u7eaf\u7cb9\u7684\u4ea4\u6613\u65e5\u5386\u5de5\u5177\u5305\u3002\u6765\u81ea[\u897f\u6d77\u5cb8\u91cf\u5316\u5de5\u4f5c\u5ba4]\u3002",
"version": "2026.2.13.1",
"project_urls": null,
"split_keywords": [
"a\u80a1",
"\u65e5\u5386"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "de37a956e03e1da31e53d643e8dc9d1afbc9b9dbf7005c646b09b31f3f533e97",
"md5": "f161cc06f807f1073a7d56dbab1583f2",
"sha256": "962f48f61d179379328ce4496c3fa4d50fd781b1535948db083711a2a6c200ac"
},
"downloads": -1,
"filename": "a_trade_calendar-2026.2.13.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "f161cc06f807f1073a7d56dbab1583f2",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 14949,
"upload_time": "2024-02-17T09:42:07",
"upload_time_iso_8601": "2024-02-17T09:42:07.943493Z",
"url": "https://files.pythonhosted.org/packages/de/37/a956e03e1da31e53d643e8dc9d1afbc9b9dbf7005c646b09b31f3f533e97/a_trade_calendar-2026.2.13.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-17 09:42:07",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "a-trade-calendar"
}