Skip to content

Commit a57c0d8

Browse files
Add support for endpoint: GET /auth/r/ledgets/hist.
1 parent e5d0abb commit a57c0d8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bfxapi/rest/_interfaces/rest_auth_endpoints.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,23 @@ def get_trades_history(
232232

233233
def get_ledgers(
234234
self,
235-
currency: str,
235+
currency: Optional[str] = None,
236236
*,
237237
category: Optional[int] = None,
238238
start: Optional[str] = None,
239239
end: Optional[str] = None,
240240
limit: Optional[int] = None,
241241
) -> List[Ledger]:
242+
if currency is None:
243+
endpoint = "auth/r/ledgers/hist"
244+
else:
245+
endpoint = f"auth/r/ledgers/{currency}/hist"
246+
242247
body = {"category": category, "start": start, "end": end, "limit": limit}
243248

244249
return [
245250
serializers.Ledger.parse(*sub_data)
246-
for sub_data in self._m.post(f"auth/r/ledgers/{currency}/hist", body=body)
251+
for sub_data in self._m.post(endpoint, body=body)
247252
]
248253

249254
def get_base_margin_info(self) -> BaseMarginInfo:

0 commit comments

Comments
 (0)