auto-convert them into strings of YYYY-MM-DD format.
This is the same thing that happens in list_aggs and get_aggs, but they actually get type hinting for datetime.date objects. It's a small inconsistency.
Given that it works in all cases, the linting is misleading/inaccurate:
Argument of type "date" cannot be assigned to parameter "date" of type "str" in function "get_daily_open_close_agg"
"date" is incompatible with "str"
Solution
I'm aware neither get_grouped_daily_aggs nor get_daily_open_close_agg can support datetime.datetime objects or UNIX Timestamps since their endpoints don't support it, but type hinting should be added for datetime.date objects.
date: Union[str, date],
It's obviously a very, very small problem, but it's annoying me 😭 A fix would be nice so that #type: ignore isn't needed to keep the linter quiet. It's also helpful for people who don't know that string formatting converts datetime.date objects into YYYY-MM-DD format.
Inconsistent Type Hinting for Aggregate Date Parameters
Context
list_aggs
andget_aggs
type hintUnion[str, int, datetime, date]
for theirfrom_
andto
parameters:get_grouped_daily_aggs
andget_daily_open_close_agg
only type hintstr
for theirdate
parameters:Problem:
get_grouped_daily_aggs
andget_daily_open_close_agg
are missing the type hints they deservedatetime.date
objects can already be passed toget_grouped_daily_aggs
andget_daily_open_close_agg
sinceand
auto-convert them into strings of
YYYY-MM-DD
format.This is the same thing that happens in
list_aggs
andget_aggs
, but they actually get type hinting fordatetime.date
objects. It's a small inconsistency.Given that it works in all cases, the linting is misleading/inaccurate:
Solution
I'm aware neither
get_grouped_daily_aggs
norget_daily_open_close_agg
can supportdatetime.datetime
objects or UNIX Timestamps since their endpoints don't support it, but type hinting should be added fordatetime.date
objects.It's obviously a very, very small problem, but it's annoying me 😭 A fix would be nice so that
#type: ignore
isn't needed to keep the linter quiet. It's also helpful for people who don't know that string formatting convertsdatetime.date
objects intoYYYY-MM-DD
format.Super quick fix. I'll have a PR in a few minutes.