Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fetching all currencies ledgers #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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