Skip to content

push to remote #304

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

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion pybit/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "5.10.1"
VERSION = "5.10.2"
8 changes: 6 additions & 2 deletions pybit/_http_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class _V5HTTPManager:
log_requests: bool = field(default=False)
timeout: int = field(default=10)
recv_window: bool = field(default=5000)
force_retry: bool = field(default=False)
force_retry: bool = field(default=True)
retry_codes: defaultdict[dict] = field(default_factory=dict)
ignore_codes: dict = field(default_factory=dict)
max_retries: bool = field(default=3)
Expand Down Expand Up @@ -332,8 +332,12 @@ def _submit_request(self, method=None, path=None, query=None, auth=False):
ret_code = "retCode"
ret_msg = "retMsg"

if ret_code not in s_json:
logging.info(s_json)

# If Bybit returns an error, raise.
if s_json[ret_code]:
s_code = s_json[ret_code] if ret_code in s_json else s_json['ret_code']
if s_code:
# Generate error message.
error_msg = f"{s_json[ret_msg]} (ErrCode: {s_json[ret_code]})"

Expand Down
19 changes: 19 additions & 0 deletions pybit/_v5_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@ def get_wallet_balance(self, **kwargs):
auth=True,
)

def get_coin_withdrawal(self, **kwargs):
"""Query the available amount to transfer of a specific coin in the Unified wallet.

Required args:
coinName (string): Coin name, uppercase only

Returns:
Request results as dictionary.

Additional information:
https://bybit-exchange.github.io/docs/v5/account/unified-trans-amnt
"""
return self._submit_request(
method="GET",
path=f"{self.endpoint}{Account.GET_COIN_WITHDRAWAL}",
query=kwargs,
auth=True,
)

def get_transferable_amount(self, **kwargs):
"""Query the available amount to transfer of a specific coin in the Unified wallet.

Expand Down
1 change: 1 addition & 0 deletions pybit/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class Account(str, Enum):
GET_WALLET_BALANCE = "/v5/account/wallet-balance"
GET_COIN_WITHDRAWAL = "/v5/account/withdrawal"
GET_TRANSFERABLE_AMOUNT = "/v5/account/withdrawal"
UPGRADE_TO_UNIFIED_ACCOUNT = "/v5/account/upgrade-to-uta"
GET_BORROW_HISTORY = "/v5/account/borrow-history"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='pybit',
version='5.10.1',
version='5.10.6',
description='Python3 Bybit HTTP/WebSocket API Connector',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down