From a57c0d81e0b4c7ac11d3e1b3f3c18522af9d8480 Mon Sep 17 00:00:00 2001 From: Davide Casale Date: Thu, 14 Nov 2024 05:55:06 +0100 Subject: [PATCH] Add support for endpoint: GET /auth/r/ledgets/hist. --- bfxapi/rest/_interfaces/rest_auth_endpoints.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bfxapi/rest/_interfaces/rest_auth_endpoints.py b/bfxapi/rest/_interfaces/rest_auth_endpoints.py index 8b01f45..ad3b806 100644 --- a/bfxapi/rest/_interfaces/rest_auth_endpoints.py +++ b/bfxapi/rest/_interfaces/rest_auth_endpoints.py @@ -232,18 +232,23 @@ class RestAuthEndpoints(Interface): def get_ledgers( self, - currency: str, + currency: Optional[str] = None, *, category: Optional[int] = None, start: Optional[str] = None, end: Optional[str] = None, limit: Optional[int] = None, ) -> List[Ledger]: + if currency is None: + endpoint = "auth/r/ledgers/hist" + else: + endpoint = f"auth/r/ledgers/{currency}/hist" + body = {"category": category, "start": start, "end": end, "limit": limit} return [ serializers.Ledger.parse(*sub_data) - for sub_data in self._m.post(f"auth/r/ledgers/{currency}/hist", body=body) + for sub_data in self._m.post(endpoint, body=body) ] def get_base_margin_info(self) -> BaseMarginInfo: