diff --git a/CHANGELOG.md b/CHANGELOG.md index 28826f5..19c84c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased + +## [5.2.0] - 2023-04-18 +### Added +- New asset endpoints: `set_deposit_account()`, `get_internal_deposit_records()`, `get_withdrawable_amount()` + +### Fixed - Ensure that `legacy` submodule is packaged by `setup.py` - Fix non-UTA (normal account) spot margin trading endpoints +- Fix wrong request method for `set_dcp()` ## [5.1.1] - 2023-04-06 diff --git a/pybit/__init__.py b/pybit/__init__.py index e804153..221603a 100644 --- a/pybit/__init__.py +++ b/pybit/__init__.py @@ -1 +1 @@ -VERSION = "5.1.1" +VERSION = "5.2.0" diff --git a/pybit/_v5_asset.py b/pybit/_v5_asset.py index 74e3da0..b66dd08 100644 --- a/pybit/_v5_asset.py +++ b/pybit/_v5_asset.py @@ -267,6 +267,25 @@ def get_allowed_deposit_coin_info(self, **kwargs): auth=True, ) + def set_deposit_account(self, **kwargs): + """Set auto transfer account after deposit. The same function as the setting for Deposit on web GUI + + Required args: + accountType (string): Account type: UNIFIED,SPOT,OPTION,CONTRACT,FUND + + Returns: + Request results as dictionary. + + Additional information: + https://bybit-exchange.github.io/docs/v5/asset/set-deposit-acct + """ + return self._submit_request( + method="POST", + path=f"{self.endpoint}{Asset.SET_DEPOSIT_ACCOUNT}", + query=kwargs, + auth=True, + ) + def get_deposit_records(self, **kwargs): """Query deposit records. @@ -302,6 +321,22 @@ def get_sub_deposit_records(self, **kwargs): auth=True, ) + def get_internal_deposit_records(self, **kwargs): + """Query deposit records within the Bybit platform. These transactions are not on the blockchain. + + Returns: + Request results as dictionary. + + Additional information: + https://bybit-exchange.github.io/docs/v5/asset/internal-deposit-record + """ + return self._submit_request( + method="GET", + path=f"{self.endpoint}{Asset.GET_INTERNAL_DEPOSIT_RECORDS}", + query=kwargs, + auth=True, + ) + def get_master_deposit_address(self, **kwargs): """Query the deposit address information of MASTER account. @@ -373,6 +408,25 @@ def get_withdrawal_records(self, **kwargs): auth=True, ) + def get_withdrawable_amount(self, **kwargs): + """Get withdrawable amount + + Required args: + coin (string): Coin name + + Returns: + Request results as dictionary. + + Additional information: + https://bybit-exchange.github.io/docs/v5/asset/delay-amount + """ + return self._submit_request( + method="GET", + path=f"{self.endpoint}{Asset.GET_WITHDRAWABLE_AMOUNT}", + query=kwargs, + auth=True, + ) + def withdraw(self, **kwargs): """Withdraw assets from your Bybit account. You can make an off-chain transfer if the target wallet address is from Bybit. This means that no blockchain fee will be charged. diff --git a/pybit/_v5_trade.py b/pybit/_v5_trade.py index 9659f58..35f6806 100644 --- a/pybit/_v5_trade.py +++ b/pybit/_v5_trade.py @@ -237,7 +237,7 @@ def set_dcp(self, **kwargs): https://bybit-exchange.github.io/docs/v5/order/dcp """ return self._submit_request( - method="GET", + method="POST", path=f"{self.endpoint}{Trade.SET_DCP}", query=kwargs, auth=True, diff --git a/pybit/asset.py b/pybit/asset.py index 2ecb762..a21a8ef 100644 --- a/pybit/asset.py +++ b/pybit/asset.py @@ -20,14 +20,17 @@ class Asset(str, Enum): "/v5/asset/transfer/query-universal-transfer-list" ) GET_ALLOWED_DEPOSIT_COIN_INFO = "/v5/asset/deposit/query-allowed-list" + SET_DEPOSIT_ACCOUNT = "/v5/asset/deposit/deposit-to-account" GET_DEPOSIT_RECORDS = "/v5/asset/deposit/query-record" GET_SUB_ACCOUNT_DEPOSIT_RECORDS = ( "/v5/asset/deposit/query-sub-member-record" ) + GET_INTERNAL_DEPOSIT_RECORDS = "/v5/asset/deposit/query-internal-record" GET_MASTER_DEPOSIT_ADDRESS = "/v5/asset/deposit/query-address" GET_SUB_DEPOSIT_ADDRESS = "/v5/asset/deposit/query-sub-member-address" GET_COIN_INFO = "/v5/asset/coin/query-info" GET_WITHDRAWAL_RECORDS = "/v5/asset/withdraw/query-record" + GET_WITHDRAWABLE_AMOUNT = "/v5/asset/withdraw/withdrawable-amount" WITHDRAW = "/v5/asset/withdraw/create" CANCEL_WITHDRAWAL = "/v5/asset/withdraw/cancel" diff --git a/setup.py b/setup.py index 836fabe..2d7414d 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='pybit', - version='5.1.1', + version='5.2.0', description='Python3 Bybit HTTP/WebSocket API Connector', long_description=long_description, long_description_content_type="text/markdown",