TradeTime
TradeTime是针对交易开发的日期时间工具,在计算上和python标准库datetime完美结合,可以灵活对日期时间进行运算操作。
- 支持和
datetime结合使用; - 目前只支持A股交易日期和交易时间,可自行导入交易日历或任意工作日历;
- 当前A股交易时间为:09:30-11:30为早盘,11:30-13:00为盘中休市,13:00-15:00为午盘;
- 具体使用,可查看说明文档;
TradeTime is a date and time tool developed for trading. It is computationally integrated with the Python standard library datetime, allowing flexible operation of date and time.
- Combination with
datetime; - Currently, only Chinese trading datetime is supported, but you are allowed to import your own trading calendar or any working calendar;
- For details, see the documentation;
安装 Install
pip install tradetime
导入 Import
# import datetime and tradetime
import datetime
import tradetime
快速使用 Quick Start!
- 获取今日交易日期
>>> tradetime.date()
date(year=2022, month=5, day=19, freq='D')
- 获取昨日交易日期
>>> tradetime.date() - 1
date(year=2022, month=5, day=18, freq='D')
- 获取当前周频的结束日期
>>> tradetime.date().close('W')
date(year=2022, month=5, day=20, freq='W')
- 获取上周周频结束日期
>>> tradetime.date().close('W') - 1
date(year=2022, month=5, day=13, freq='W')
- 格式化
>>> str(tradetime.date().close('W') + 1)
'2022-05-27'
链接 Link
SandQuant公众号
Metadata
Release files for TradeTime 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| TradeTime-1.1.0.tar.gz | 22.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| TradeTime-1.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 47.8 kB
Release files / TradeTime-1.1.0.tar.gz
| Download URL | TradeTime-1.1.0.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e156628696f790cfb285e00d38083eb1ba51b70f79ef11e34c39b908e452aea4
|
|
BLAKE2b-256 checksum How to use checksums |
b52473f38c90309fba9af6b916e274580e198bcb87ec666856aba42397f84247
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.5
|
Release files / TradeTime-1.1.0-py2.py3-none-any.whl
| Download URL | TradeTime-1.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 25.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ad1c38975dbb889259c91e5dadd59753a75c953683f49d8d77706349d936871e
|
|
BLAKE2b-256 checksum How to use checksums |
c410cef758c0ec3cdbc91df7b87903a97df5a42204ffcf1a58968bb5d7b0f09e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.5
|