Skip to content

Commit

Permalink
move value check up the sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
deeleeramone committed May 23, 2024
1 parent 40347ea commit 3ebd0d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ def transform_data(
for i in range(0, items - 4):
eps_estimates: Dict = {}
eps_estimates["symbol"] = ticker
period = seek_object["eps_normalized_num_of_estimates"][str(i)][0].get(
"period", {}
)
num_estimates = seek_object["eps_normalized_num_of_estimates"].get(str(i))
if not num_estimates:
continue
period = num_estimates[0].get("period", {})
if period:
period_type = period.get("periodtypeid")
eps_estimates["calendar_year"] = period.get("calendaryear")
Expand All @@ -150,9 +151,6 @@ def transform_data(
if period_type == "quarterly"
else "FY"
)
num_estimates = seek_object["revenue_num_of_estimates"].get(str(i))
if not num_estimates:
continue
eps_estimates["number_of_analysts"] = num_estimates[0].get(
"dataitemvalue"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ def transform_data(
for i in range(0, items - 4):
rev_estimates: Dict = {}
rev_estimates["symbol"] = ticker
period = seek_object["revenue_num_of_estimates"][str(i)][0].get(
"period", {}
)
num_estimates = seek_object["revenue_num_of_estimates"].get(str(i))
if not num_estimates:
continue
period = num_estimates[0].get("period", {})
if period:
period_type = period.get("periodtypeid")
rev_estimates["calendar_year"] = period.get("calendaryear")
Expand All @@ -132,9 +133,6 @@ def transform_data(
if period_type == "quarterly"
else "FY"
)
num_estimates = seek_object["revenue_num_of_estimates"].get(str(i))
if not num_estimates:
continue
rev_estimates["number_of_analysts"] = num_estimates[0].get(
"dataitemvalue"
)
Expand Down

0 comments on commit 3ebd0d9

Please sign in to comment.