Skip to content

Commit

Permalink
fix: raising Exception when service is unavailable after 1 hour of at…
Browse files Browse the repository at this point in the history
…tempts
  • Loading branch information
AntonioVentilii committed Apr 4, 2024
1 parent bdcb6f9 commit 0359bc4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

This Python script provides a comprehensive client for interacting with the Deribit API.
This Python script provides a comprehensive client for interacting with the [Deribit API](https://docs.deribit.com/).
It encapsulates functionality for both public and private endpoints, covering market data, account information, trading
operations, and more.
It supports both the production and test environments, making it suitable for developers at all stages of application
Expand Down
4 changes: 4 additions & 0 deletions deribit_wrapper/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def _request(self, uri: str, params: dict[str:str | int | float], give_results:
print(f'Temporarily unavailable. Waiting 1 minute [{i + 1}/{max_attempts}]...')
time.sleep(60)
ret = self._request(uri, params, give_results=give_results)
if ret.get('code') != 13028:
break
if ret.get('code') == 13028:
raise Exception('Service temporarily unavailable.')
else:
print(f'Error code {error_code} for request {uri} with params {params}.')
print(ret)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='deribit_wrapper',
version='0.2.5',
version='0.2.6',
packages=find_packages(),
description='A Python wrapper for seamless integration with Deribit\'s trading API, offering easy access to '
'market data, account management, and trading operations.',
Expand Down

0 comments on commit 0359bc4

Please sign in to comment.