Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions polygon/rest/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,12 @@ def _get_params(
elif isinstance(val, datetime):
val = int(val.timestamp() * self.time_mult(datetime_res))
if val is not None:
if (
argname.endswith("_lt")
or argname.endswith("_lte")
or argname.endswith("_gt")
or argname.endswith("_gte")
or argname.endswith("_any_of")
):
argname = ".".join(argname.split("_", 1))
for ext in ["lt", "lte", "gt", "gte", "any_of"]:
if argname.endswith(f"_{ext}"):
# lop off ext, then rebuild argname with ext,
# using ., and not _ (removesuffix would work)
# but that is python 3.9+
argname = argname[: -len(f"_{ext}")] + f".{ext}"
if argname.endswith("any_of"):
val = ",".join(val)
params[argname] = val
Expand Down