Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 1.49 KB

index.rst

File metadata and controls

56 lines (39 loc) · 1.49 KB

doubledate

doubledate exposes a set of 20+ utility functions as well as an immutable Calendar object representing a sorted-set of dates.

Installation

doubledate is written in pure Python. Installing doubledate is simple with pip: :

$ pip install doubledate

Quickstart

Using doubledate is also easy :

>>> import datetime
>>> import doubledate as dtwo

>>> trade = datetime.date(2020, 6, 17)

>>> dtwo.quarter(trade), dtwo.quarter(trade, base=0)
(2, 1)

>>> dtwo.eom(trade) #end-of-month
datetime.date(2020, 6, 30)

>>> dtwo.offset(trade, weekdays=3)
datetime.date(2020, 6, 22) #Wednesday + 3 weekdays is Monday

>>> dtwo.offset(datetime.datetime(2020, 3, 31), months=-1)
datetime.datetime(2020, 2, 29) #2020 is a leap year

>>> dtwo.offset(datetime.datetime(2020, 3, 31), months=1, handle=lambda eom, gap: 1)
datetime.datetime(2020, 5, 1) #handle function returned 1... i.e. eom + 1 day

source/installation source/utils/doubledate.utils source/Calendar/doubledate.Calendar source/diem/doubledate.diem source/BD/doubledate.BD source/Collection/doubledate.Collection source/changelog

Documentation

Complete documentation for doubledate is available at https://doubledate.readthedocs.io