financialdatapy.date module

This module parses and converts objects to date format objects

financialdatapy.date.validate_date(period: str, start: bool = False) → Timestamp[source]

Validate the format of date passed as a string.

Parameters:
  • period (str) – Date in string. If None, date of today is assigned.

  • start (bool, optional) – Whether argument passed is a starting date or an ending date, defaults to False.

Raises:

IntegerDateInputError – If integer type object is passed.

Returns:

Date with format YYYY-MM-DD, YY-MM-DD, or YYYY.

Return type:

pandas.Timestamp

financialdatapy.date.date_to_timestamp(period: Timestamp) → int[source]

Parse date passed in into a timestamp.

Parameters:

period (pandas.Timestamp) – Date object.

Returns:

The timestamp value equivalent to the date passed.

Return type:

int

financialdatapy.date.convert_date_format(period: Timestamp, format: str) → str[source]

Convert date object to desired date format.

Parameters:
  • period (pandas.Timestamp) – Date object.

  • format (str) – Desired date format to convert to.

Returns:

Converted date in string.

Return type:

str