Skip to main content

Manages trade dates.

Project description

tradingdate

Manages trade dates.

Installation

$ pip install tradingdate

Requirements

chinesecalendar
numpy

Usage

Get the calendar

>>> import tradingdate as td
>>> cal = td.get_calendar("chinese") # by default "chinese"
>>> cal
TradingCalendar(20040102 ~ 20251231)
>>> list(cal)[:3]
[TradingDate(20040102), TradingDate(20040105), TradingDate(20040106)]

Get a trading date

>>> date = td.get_trading_date(20250116)
>>> date
TradingDate(20250116)
>>> print(date.year, date.month, date.day)
2025 01 16
>>> date - 20
TradingDate(20241218)
>>> date + 100
TradingDate(20250617)
>>> date.month.start, date.month.end
(TradingDate(20250102), TradingDate(20250127))
>>> date.year.start, date.year.end
(TradingDate(20250102), TradingDate(20251231))

Get trading dates

>>> list(td.get_trading_dates(20250101, 20250106))
[TradingDate(20250102), TradingDate(20250103), TradingDate(20250106)]

See Also

Github repository

PyPI project

License

This project falls under the BSD 3-Clause License.

History

v0.0.1

  • New methods TradingCalendar.get_year(), YearCalendar.get_month(), MonthCalendar.get_day().
  • Bugfix: TradingDate.__sub__().

v0.0.0

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tradingdate-0.0.1-py2.py3-none-any.whl (7.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file tradingdate-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: tradingdate-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.13

File hashes

Hashes for tradingdate-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 af7003a6127ee3fb8b06036d7aa5737d2329035bf0249a07eb01e51c2fb21f88
MD5 8a106934d4aa266ff75d93a3e5aadb6c
BLAKE2b-256 7aabebdefdcdf48d7a36954c0693a4c4583f5123a75e64ed1aca499f9c5359c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page