Backends.ContractMaturity

Classes

ContractMaturity(month: int, year: int) Container class representing the notion of a futures contract maturity.
date date(year, month, day) –> date object
class Backends.ContractMaturity.ContractMaturity(month: int, year: int)[source]

Container class representing the notion of a futures contract maturity.

Parameters:

month : int

Month index in the year.

year : int

Year of the maturity of the contract.

Examples

>>> from Backends.ContractMaturity import ContractMaturity
>>> contract_maturity = ContractMaturity(6,2018)
>>> print(contract_maturity)
Contract Maturity: Jun-18

Attributes

month
year

Methods

to_date(() -> datetime.date) Convert the contract maturity to a date.
to_date() → datetime.date[source]

Convert the contract maturity to a date.

Returns:

d : date

Date representation of the maturity assuming that it is on the first day of the month.

Examples

>>> from Backends.ContractMaturity import ContractMaturity
>>> contract_maturity = ContractMaturity(6,2018)
>>> contract_maturity.to_date()
datetime.date(2018, 6, 1)