Skip to content

Commit

Permalink
Fixes issue #129 (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
stabacco authored Aug 20, 2021
1 parent bd76d98 commit 558a588
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions stake/ratings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ class Rating(pydantic.BaseModel):
url_news: Optional[str] = None
analyst_name: Optional[str] = None

@pydantic.validator("pt_prior", "rating_prior", pre=True)
def pt_prior_blank_string(value, field):
if value == "":
return None
return value


class RatingsClient(BaseClient):
"""This client is in charge listing the experts' ratings for symbols."""
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/tests.test_ratings.test_list_ratings.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"rating_current": "Buy",
"pt_current": "310.0000",
"rating_prior": "",
"pt_prior": "285.0000",
"pt_prior": "",
"url_calendar": "https://www.benzinga.com/stock/MSFT/ratings",
"url_news": "https://www.benzinga.com/stock-articles/MSFT/analyst-ratings",
"analyst_name": "Gregg Moskowitz"
Expand Down

0 comments on commit 558a588

Please sign in to comment.