Skip to content

Commit

Permalink
Support fetching all currencies ledgers
Browse files Browse the repository at this point in the history
  • Loading branch information
mnowotnik committed Sep 25, 2024
1 parent d536297 commit 251a4c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ This repository includes a pre-commit configuration file that defines the follow

To set up pre-commit use:
```console
python3 -m pre-commit install
python3 -m pre_commit install
```

These will ensure that isort, black and flake8 are run on each git commit.
Expand All @@ -353,7 +353,7 @@ These will ensure that isort, black and flake8 are run on each git commit.

You can also manually trigger the execution of all hooks with:
```console
python3 -m pre-commit run --all-files
python3 -m pre_commit run --all-files
```

## Before opening a PR
Expand Down
8 changes: 6 additions & 2 deletions bfxapi/rest/_interfaces/rest_auth_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,22 @@ def get_trades_history(

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]:
body = {"category": category, "start": start, "end": end, "limit": limit}
if currency:
endpoint = "auth/r/ledgers/{currency}/hist"
else:
endpoint = "auth/r/ledgers/hist"

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:
Expand Down

0 comments on commit 251a4c6

Please sign in to comment.