Skip to content

Commit

Permalink
Fix: Update historicals url construction #229 (#230)
Browse files Browse the repository at this point in the history
Fixes #230
  • Loading branch information
samueleishion authored Apr 24, 2020
1 parent 0113d31 commit 522d683
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions newsfragments/229.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated the .get_historical_quotes() to use the URL method .with_query() in order to build a URL with params.
17 changes: 7 additions & 10 deletions pyrh/robinhood.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,13 @@ def get_historical_quotes(self, stock, interval, span, bounds=Bounds.REGULAR):
if isinstance(bounds, str): # recast to Enum
bounds = Bounds(bounds)

historicals = (
urls.HISTORICALS
+ "/?symbols="
+ ",".join(stock).upper()
+ "&interval="
+ interval
+ "&span="
+ span
+ "&bounds="
+ bounds.name.lower()
historicals = urls.HISTORICALS.with_query(
[
("symbols", ",".join(stock).upper()),
("interval", interval),
("span", span),
("bounds", bounds.name.lower()),
]
)

return self.get(historicals)
Expand Down

0 comments on commit 522d683

Please sign in to comment.