MCPcopy Create free account
hub / github.com/danielecook/iex-api-python / parse_date

Function parse_date

iex/utils.py:48–62  ·  view source on GitHub ↗

Parses a date and returns it as YYYYMMDD If not parsable, returns False Args: date

(date)

Source from the content-addressed store, hash-verified

46
47
48def parse_date(date):
49 """
50 Parses a date and returns it as YYYYMMDD
51 If not parsable, returns False
52
53 Args:
54 date
55 """
56 try:
57 parsed_date = parse(str(date))
58 except ValueError:
59 return False
60 if (arrow.now().date() - parsed_date.date()).days < 0:
61 raise ValueError("Date cannot be set in the future")
62 return parsed_date.strftime("%Y%m%d")
63
64
65#============#

Callers 9

chartMethod · 0.90
historical_summaryMethod · 0.90
iex_corporate_actionsMethod · 0.90
iex_dividendsMethod · 0.90
iex_next_day_ex_dateMethod · 0.90
threshold_securitiesMethod · 0.90
short_interestMethod · 0.90
validate_range_setFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected