diff --git a/polygon/rest/base.py b/polygon/rest/base.py index dce4aed0..3507ed02 100644 --- a/polygon/rest/base.py +++ b/polygon/rest/base.py @@ -74,11 +74,6 @@ def _get( raw: bool = False, options: Optional[RequestOptionBuilder] = None, ) -> Any: - if params is None: - params = {} - params = {str(k): str(v) for k, v in params.items() if v is not None} - logger.debug("_get %s params %s", path, params) - option = options if options is not None else RequestOptionBuilder() resp = self.client.request( diff --git a/polygon/rest/quotes.py b/polygon/rest/quotes.py index 7dda6846..31f46047 100644 --- a/polygon/rest/quotes.py +++ b/polygon/rest/quotes.py @@ -115,7 +115,7 @@ def get_real_time_currency_conversion( self, from_: str, to: str, - amount: float, + amount: Optional[float] = None, precision: Union[int, Precision] = 2, params: Optional[Dict[str, Any]] = None, raw: bool = False, @@ -133,13 +133,10 @@ def get_real_time_currency_conversion( :return: Real-Time Currency Conversion """ url = f"/v1/conversion/{from_}/{to}" - if params is None: - params = {} - params["amount"] = amount - params["precision"] = precision + return self._get( path=url, - params=params, + params=self._get_params(self.get_real_time_currency_conversion, locals()), deserializer=RealTimeCurrencyConversion.from_dict, raw=raw, options=options, diff --git a/polygon/rest/reference.py b/polygon/rest/reference.py index 3c01c324..8741e8a0 100644 --- a/polygon/rest/reference.py +++ b/polygon/rest/reference.py @@ -152,7 +152,8 @@ def get_ticker_details( def get_ticker_events( self, - ticker: Optional[str] = None, + ticker: str, + types: Optional[str] = None, params: Optional[Dict[str, Any]] = None, raw: bool = False, options: Optional[RequestOptionBuilder] = None, @@ -169,7 +170,7 @@ def get_ticker_events( return self._get( path=url, - params=params, + params=self._get_params(self.get_ticker_events, locals()), deserializer=TickerChangeResults.from_dict, result_key="results", raw=raw, @@ -238,7 +239,7 @@ def get_ticker_types( return self._get( path=url, - params=params, + params=self._get_params(self.get_ticker_types, locals()), deserializer=TickerTypes.from_dict, raw=raw, result_key="results", @@ -451,7 +452,7 @@ def get_exchanges( return self._get( path=url, - params=params, + params=self._get_params(self.get_exchanges, locals()), deserializer=Exchange.from_dict, raw=raw, result_key="results", diff --git a/test_rest/mocks/vX/reference/tickers/META/events.json b/test_rest/mocks/vX/reference/tickers/META/events&types=ticker_change.json similarity index 100% rename from test_rest/mocks/vX/reference/tickers/META/events.json rename to test_rest/mocks/vX/reference/tickers/META/events&types=ticker_change.json diff --git a/test_rest/test_tickers.py b/test_rest/test_tickers.py index f45b487a..bac9eaa8 100644 --- a/test_rest/test_tickers.py +++ b/test_rest/test_tickers.py @@ -239,7 +239,7 @@ def test_get_ticker_types(self): self.assertEqual(types, expected) def test_get_ticker_events_ticker_change(self): - events = self.c.get_ticker_events(ticker="META") + events = self.c.get_ticker_events(ticker="META", types="ticker_change") expected = TickerChangeResults( name="Meta Platforms, Inc. Class A Common Stock", figi="BBG000MM2P62",