@@ -54,7 +54,7 @@ def __init__(self):
5454
5555 try :
5656 props = config ['config' ]
57- self .bot_version = '1.4.7 '
57+ self .bot_version = '1.4.8 '
5858 self .exchange = str (props ['exchange' ]).strip ('"' ).lower ()
5959 self .api_key = str (props ['api_key' ]).strip ('"' )
6060 self .api_secret = str (props ['api_secret' ]).strip ('"' )
@@ -879,7 +879,11 @@ def get_margin_leverage():
879879 """
880880 try :
881881 if CONF .exchange == 'bitmex' :
882- return float (EXCHANGE .fetch_balance ()['info' ][0 ]['marginLeverage' ])
882+ asset = CONF .base if CONF .base != 'BTC' else 'XBt'
883+ balances = EXCHANGE .fetch_balance ()['info' ]
884+ for bal in balances :
885+ if bal ['currency' ] == asset :
886+ return float (bal ['marginLeverage' ])
883887 if CONF .exchange == 'kraken' :
884888 result = EXCHANGE .private_post_tradebalance ()['result' ]
885889 if hasattr (result , 'ml' ):
@@ -946,7 +950,11 @@ def get_wallet_balance(price: float):
946950 """
947951 try :
948952 if CONF .exchange == 'bitmex' :
949- return float (EXCHANGE .fetch_balance ()['info' ][0 ]['walletBalance' ]) * CONF .satoshi_factor
953+ asset = CONF .base if CONF .base != 'BTC' else 'XBt'
954+ balances = EXCHANGE .fetch_balance ()['info' ]
955+ for bal in balances :
956+ if bal ['currency' ] == asset :
957+ return float (bal ['walletBalance' ]) * CONF .satoshi_factor
950958 if CONF .exchange == 'kraken' :
951959 asset = CONF .base if CONF .base != 'BTC' else 'XBt'
952960 return float (EXCHANGE .private_post_tradebalance ({'asset' : asset })['result' ]['tb' ])
@@ -979,7 +987,11 @@ def get_balances():
979987 """
980988 try :
981989 if CONF .exchange == 'bitmex' :
982- return EXCHANGE .fetch_balance ()['info' ][0 ]
990+ asset = CONF .base if CONF .base != 'BTC' else 'XBt'
991+ balances = EXCHANGE .fetch_balance ()['info' ]
992+ for bal in balances :
993+ if bal ['currency' ] == asset :
994+ return bal
983995 LOG .warning (NOT_IMPLEMENTED_MESSAGE , 'get_balances()' , CONF .exchange )
984996 return None
985997
0 commit comments