Skip to content

Commit dfce2ec

Browse files
committed
feat: method aliases
1 parent 06f1117 commit dfce2ec

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

cryptomarket/client.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def __init__(self, api_key: Optional[str] = None, secret_key: Optional[str] = No
3535
self.create_new_spot_order = self.create_spot_order
3636

3737
def close(self):
38+
"""Closes the underlying http connection
39+
"""
3840
self.httpClient.close_session()
3941

4042
def _get(self, endpoint: str, params=None):
@@ -450,7 +452,7 @@ def get_candles_of_symbol(
450452
:param limit: Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1000
451453
:param offset: Optional. Default is 0. Min is 0. Max is 100000
452454
453-
:returns: A list of candles of a symbol
455+
:returns: A class with the target_currency and data with a dict with a list of candles for each symbol of the query. indexed by symbol
454456
"""
455457
params = args.DictBuilder().period(period).sort(sort).since(
456458
since).till(till).limit(limit).offset(offset).build()
@@ -493,7 +495,7 @@ def get_converted_candles(
493495
:param till: Optional. Last value of the queried interval. As DateTime
494496
:param limit: Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1000
495497
496-
:returns: A list of candles of a symbol
498+
:returns: A class with the target_currency and data with a list of candles for the symbol of the query.
497499
"""
498500
params = args.DictBuilder().target_currency(target_currency).symbols(symbols).period(period).sort(sort).since(
499501
since).till(till).limit(limit).build()
@@ -1444,3 +1446,32 @@ def get_sub_account_crypto_address(self, sub_account_id: str, currency: str) ->
14441446
response = self._get(
14451447
endpoint=f'sub-account/crypto/address/{sub_account_id}/{currency}')
14461448
return from_dict(data_class=Address, data=response["result"]["address"])
1449+
1450+
###########
1451+
# ALIASES #
1452+
###########
1453+
1454+
# market data
1455+
get_ticker_by_symbol = get_ticker
1456+
get_ticker_of_symbol = get_ticker
1457+
get_ticker_last_price = get_ticker_last_price_of_symbol
1458+
get_ticker_last_price_by_symbol = get_ticker_last_price_of_symbol
1459+
get_trades_by_symbol = get_trades_of_symbol
1460+
get_order_book_by_symbol = get_order_book_of_symbol
1461+
get_order_book = get_order_book_of_symbol
1462+
get_order_book_volume_by_symbol = get_order_book_volume_of_symbol
1463+
get_order_book_volume = get_order_book_volume_of_symbol
1464+
get_candles_by_symbol = get_order_book_volume_of_symbol
1465+
get_converted_candles_by_symbol = get_converted_candles_of_symbol
1466+
1467+
# spot trading
1468+
get_spot_trading_balance_by_currency = get_spot_trading_balance_of_currency
1469+
get_spot_trading_balance = get_spot_trading_balance_of_currency
1470+
get_trading_commission_by_symbol = get_trading_commission
1471+
get_trading_commission_of_symbol = get_trading_commission
1472+
1473+
# wallet management
1474+
get_wallet_balance = get_wallet_balance_of_currency
1475+
get_wallet_balance_by_currency = get_wallet_balance_of_currency
1476+
get_deposit_crypto_address = get_deposit_crypto_address_of_currency
1477+
get_deposit_crypto_address_by_currency = get_deposit_crypto_address_of_currency

cryptomarket/websockets/trading_client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,3 +463,12 @@ def intercept_result(err, response):
463463
callback(None, result)
464464
params = args.DictBuilder().symbol(symbol).build()
465465
self._send_by_id('spot_fee', callback=intercept_result, params=params)
466+
467+
###########
468+
# ALIASES #
469+
###########
470+
471+
get_spot_trading_balance = get_spot_trading_balance_of_currency
472+
get_spot_trading_balance_by_currency = get_spot_trading_balance_of_currency
473+
get_spot_commision = get_spot_commision_of_symbol
474+
get_spot_commision_by_symbol = get_spot_commision_of_symbol

cryptomarket/websockets/wallet_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,10 @@ def intercept_response(err, response):
243243
callback=intercept_response,
244244
params=params
245245
)
246+
247+
###########
248+
# ALIASES #
249+
###########
250+
251+
get_wallet_balance_by_currency = get_wallet_balance_of_currency
252+
get_wallet_balance = get_wallet_balance_of_currency

0 commit comments

Comments
 (0)