Skip to content

Commit 5169693

Browse files
author
T. Ismael Verdugo
committed
fix: remove nones from sent data
1 parent 475c98b commit 5169693

File tree

5 files changed

+26
-24
lines changed

5 files changed

+26
-24
lines changed

cryptomarket/client.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ def get_whitelisted_addresses(self) -> List[WhitelistedAddress]:
947947
"""
948948
response = self._get(endpoint=f'wallet/crypto/address/white-list')
949949
return [from_dict(data_class=WhitelistedAddress, data=data) for data in response]
950-
950+
951951
def get_deposit_crypto_addresses(self) -> List[Address]:
952952
"""Get the current addresses of the user
953953
@@ -1123,7 +1123,9 @@ def get_estimate_withdrawal_fees(self, fee_requests: List[args.FeeRequest]) -> L
11231123
11241124
:return: A list of expected withdrawal fees
11251125
"""
1126-
params = [asdict(fee_request) for fee_request in fee_requests]
1126+
params = [args.clean_nones(asdict(fee_request))
1127+
for fee_request
1128+
in fee_requests]
11271129
result = self._post(
11281130
endpoint='wallet/crypto/fees/estimate', params=params)
11291131
return [Fee.from_dict(fee_data) for fee_data in result]
@@ -1137,24 +1139,24 @@ def get_bulk_estimate_withdrawal_fees(self, fee_requests: List[args.FeeRequest])
11371139
11381140
:return: A list of expected withdrawal fees
11391141
"""
1140-
params = [asdict(fee_request) for fee_request in fee_requests]
1142+
params = [args.clean_nones(asdict(fee_request))
1143+
for fee_request
1144+
in fee_requests]
11411145
result = self._post(
11421146
endpoint='wallet/crypto/fee/estimate/bulk', params=params)
11431147
return [Fee.from_dict(fee_data) for fee_data in result]
11441148

1145-
1146-
def get_withdrawal_fees_hash(self) -> str:
1149+
def get_withdrawal_fees_hash(self) -> str:
11471150
"""Gets the hash of withdrawal fees
1148-
1151+
11491152
Requires the "Payment information" API key Access Right
1150-
1153+
11511154
https://api.exchange.cryptomkt.com/#get-withdrawal-fees-hash
1152-
1155+
11531156
:return: the fees hash
11541157
"""
11551158
return self._get(endpoint='wallet/crypto/fee/withdraw/hash')['hash']
11561159

1157-
11581160
# def get_estimate_deposit_fee(self, currency: str, amount: str, network_code: Optional[str] = None) -> str:
11591161
# """Get an estimate of the Deposit fee
11601162

@@ -1470,17 +1472,17 @@ def transfer_funds(
14701472
amount).currency(currency).type(type).build()
14711473
return self._post(endpoint='sub-account/transfer', params=params)['result']
14721474

1473-
def transfer_to_super_account(self, amount:str, currency: str) ->str:
1475+
def transfer_to_super_account(self, amount: str, currency: str) -> str:
14741476
"""Creates and commits a transfer from a subaccount to its super account
1475-
1477+
14761478
Call is being sent by a subaccount
1477-
1479+
14781480
Created but not committed transfer will reserve pending amount on the sender
14791481
wallet affecting their ability to withdraw or transfer crypto to another
14801482
account. Incomplete withdrawals affect subaccount transfers the same way
1481-
1483+
14821484
Requires the "Withdraw cryptocurrencies" API key Access Right
1483-
1485+
14841486
https://api.exchange.cryptomkt.com/#transfer-to-super-account
14851487
14861488
:param amount: the amount of currency to transfer
@@ -1490,19 +1492,18 @@ def transfer_to_super_account(self, amount:str, currency: str) ->str:
14901492
params = args.DictBuilder().amount(amount).currency(currency).build()
14911493
return self._post(endpoint='sub-account/transfer/sub-to-super', params=params)['result']
14921494

1493-
1494-
def transfer_to_another_subaccount(sub_account_id: str, amount: str, currency: str)->str:
1495+
def transfer_to_another_subaccount(self, sub_account_id: str, amount: str, currency: str) -> str:
14951496
"""Creates and commits a transfer between the user (subaccount) and another
14961497
subaccount.
1497-
1498+
14981499
Call is being sent by a subaccount
1499-
1500+
15001501
Created but not committed transfer will reserve pending amount on the sender
15011502
wallet affecting their ability to withdraw or transfer crypto to another
15021503
account. Incomplete withdrawals affect subaccount transfers the same way
1503-
1504+
15041505
Requires the "Withdraw cryptocurrencies" API key Access Right
1505-
1506+
15061507
https://api.exchange.cryptomkt.com/#transfer-across-subaccounts
15071508
15081509
:param sub_account_id: Identifier of a subaccount
@@ -1514,7 +1515,6 @@ def transfer_to_another_subaccount(sub_account_id: str, amount: str, currency: s
15141515
amount).currency(currency).build()
15151516
return self._post(endpoint='sub-account/transfer/sub-to-sub', params=params)['result']
15161517

1517-
15181518
def get_ACL_settings(self, sub_account_ids: List[str]) -> List[ACLSettings]:
15191519
"""Get a list of withdrawal settings for all sub-accounts or for the specified sub-accounts
15201520

cryptomarket/dataclasses/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from .wsTrade import WSTrade
3232
from .wsPriceRate import WSPriceRate
3333
from .fee import Fee
34+
from .whitelistedAddress import WhitelistedAddress
3435
__all__ = [
3536
ACLSettings,
3637
Address,
@@ -66,4 +67,5 @@
6667
WSPriceRate,
6768
SubAccount,
6869
Fee,
70+
WhitelistedAddress
6971
]

cryptomarket/dataclasses/price.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
@dataclass
66
class Price:
7-
price: str
87
timestamp: str
8+
price: Optional[str] = None
99
currency: Optional[str] = None

cryptomarket/dataclasses/whitelistAddress.py renamed to cryptomarket/dataclasses/whitelistedAddress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
@dataclass
6-
class WhitelistAddress:
6+
class WhitelistedAddress:
77
address: str
88
currency: str
99
name: str

cryptomarket/websockets/trading_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def replace_spot_order(
335335
new_client_order_id: str,
336336
quantiy: str,
337337
price: str,
338-
stop_price: Optional[str]=None,
338+
stop_price: Optional[str] = None,
339339
strict_validate: Optional[bool] = None,
340340
callback: Optional[Callback[Report]] = None
341341
):

0 commit comments

Comments
 (0)