sangreal-calendar
由于开源数据不稳定,现改为需要自行注入
安装
pip install sangreal-calendar
交易日处理函数
from sangreal_calenadr import *
# 获取历史交易日
tmp_series = get_xxx() -> pd.Series
CALENDAR.inject(tmp_series)
# 获取交易日列表
get_trade_dts(begin_dt='20180101', end_dt='20180201')
['20180102', '20180103', ..., '20180201']
# 获取交易日DataFrame
get_trade_dts(begin_dt='20180101', end_dt='20180201', astype='pd')
trade_dt
6613 20180102
6614 20180103
6615 20180104
6616 20180105
6617 20180108
# 调整非交易日至之前的最近一个交易日
adjust_trade_dt('20180101')
'20171229'
# 调整非交易日至之前的最后一个交易日
adjust_trade_dt('20180101', 'next')
'20180102'
# 往后step 1个交易日
# 注意,对于非交易日的输入,会自动将其adjust至之后的最近一个交易日
# 本质上是 step_trade_dt('20180102', 1)
step_trade_dt('20180101', 1)
'20180103'
# 往后step 1个交易日
step_trade_dt('20180101', -1)
'20171229'
# 计算两个日期间的交易日长度
delta_trade_dt('20180101', '20180305')
40
时间频率处理函数
支持weekly biweekly monthly quarterly reportly halfyearly yearly
以weekly为例
# 返回每周的第一个交易日
# 格式为Series 及 datetime
Weekly(1).get('20180101', '20190101')
6613 20180102
6617 20180108
6622 20180115
6627 20180122
6632 20180129
6637 20180205
# 返回每周的最后一个交易日
Weekly(-1).get('20180101', '20190101')
6621 20180112
6626 20180119
6631 20180126
6636 20180202
6641 20180209
6644 20180214
# 返回每周的第一个及最后一个交易日
Weekly(1, -1).get('20180101', '20190101')
6613 20180102
6617 20180108
6621 20180112
6622 20180115
6626 20180119
6627 20180122
Monthly() BiWeekly() Quarterly() ....
Metadata
Release files for sangreal-calendar 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sangreal_calendar-0.1.5.tar.gz | 25.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sangreal_calendar-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.3 kB
Release files / sangreal_calendar-0.1.5.tar.gz
| Download URL | sangreal_calendar-0.1.5.tar.gz |
|---|---|
| Size | 25.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d348af431047241980163dc6a346c3aac32e54a55f836d995589b2a61274d8d9
|
|
BLAKE2b-256 checksum How to use checksums |
cf72ce186138a3e54ff24fa582ccee8f2224fb5c4f518f7e26bdd27bd9d28f25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Release files / sangreal_calendar-0.1.5-py3-none-any.whl
| Download URL | sangreal_calendar-0.1.5-py3-none-any.whl |
|---|---|
| Size | 26.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90b12119030eccd7474473515af09bdda0646b965afe5ba591ba763fe686d9bd
|
|
BLAKE2b-256 checksum How to use checksums |
7cc74523a7af31737d3b858b42b8c9773192a0c9a9169f4f44fd71a798059610
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Security for sangreal-calendar 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.