mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
Adding balance_available to the wallet (#132)
* Adding balance_available to the wallet * Refactoring bfx_rest.py/get_wallets to use the updated Wallet class, which has available_balance i it Co-authored-by: jon <fcmisc@gmail.com>
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
1.1.13
|
||||||
|
-) Adding balance_available to the Wallet.
|
||||||
|
|
||||||
1.1.12
|
1.1.12
|
||||||
-) Applied clientside fix to get_public_trades() (in case of multiple trades at the same timestamp they should be ordered by id)
|
-) Applied clientside fix to get_public_trades() (in case of multiple trades at the same timestamp they should be ordered by id)
|
||||||
-) Invalid orders are now removed from pending_orders
|
-) Invalid orders are now removed from pending_orders
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ class Wallet:
|
|||||||
currency
|
currency
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, wType, currency, balance, unsettled_interest):
|
def __init__(self, wType, currency, balance, unsettled_interest, balance_available):
|
||||||
self.type = wType
|
self.type = wType
|
||||||
self.currency = currency
|
self.currency = currency
|
||||||
self.balance = balance
|
self.balance = balance
|
||||||
|
self.balance_available = balance_available
|
||||||
self.unsettled_interest = unsettled_interest
|
self.unsettled_interest = unsettled_interest
|
||||||
self.key = "{}_{}".format(wType, currency)
|
self.key = "{}_{}".format(wType, currency)
|
||||||
|
|
||||||
@@ -29,5 +30,5 @@ class Wallet:
|
|||||||
self.unsettled_interest = data
|
self.unsettled_interest = data
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Wallet <'{}_{}' balance='{}' unsettled='{}'>".format(
|
return "Wallet <'{}_{}' balance='{}' balance_available='{}' unsettled='{}'>".format(
|
||||||
self.type, self.currency, self.balance, self.unsettled_interest)
|
self.type, self.currency, self.balance, self.balance_available, self.unsettled_interest)
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ class BfxRest:
|
|||||||
"""
|
"""
|
||||||
endpoint = "auth/r/wallets"
|
endpoint = "auth/r/wallets"
|
||||||
raw_wallets = await self.post(endpoint)
|
raw_wallets = await self.post(endpoint)
|
||||||
return [Wallet(*rw[:4]) for rw in raw_wallets]
|
return [Wallet(*rw[:5]) for rw in raw_wallets]
|
||||||
|
|
||||||
async def get_active_orders(self, symbol):
|
async def get_active_orders(self, symbol):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
This module contains the current version of the bfxapi lib
|
This module contains the current version of the bfxapi lib
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = '1.1.12'
|
__version__ = '1.1.13'
|
||||||
|
|||||||
@@ -17,13 +17,13 @@ class WalletManager:
|
|||||||
wData = raw_ws_data[2]
|
wData = raw_ws_data[2]
|
||||||
self.wallets = {}
|
self.wallets = {}
|
||||||
for wallet in wData:
|
for wallet in wData:
|
||||||
new_wallet = Wallet(wallet[0], wallet[1], wallet[2], wallet[3])
|
new_wallet = Wallet(wallet[0], wallet[1], wallet[2], wallet[3], wallet[4])
|
||||||
self.wallets[new_wallet.key] = new_wallet
|
self.wallets[new_wallet.key] = new_wallet
|
||||||
return self.get_wallets()
|
return self.get_wallets()
|
||||||
|
|
||||||
def _update_from_event(self, raw_ws_data):
|
def _update_from_event(self, raw_ws_data):
|
||||||
wallet = raw_ws_data[2]
|
wallet = raw_ws_data[2]
|
||||||
new_wallet = Wallet(wallet[0], wallet[1], wallet[2], wallet[3])
|
new_wallet = Wallet(wallet[0], wallet[1], wallet[2], wallet[3], wallet[4])
|
||||||
self.wallets[new_wallet.key] = new_wallet
|
self.wallets[new_wallet.key] = new_wallet
|
||||||
return new_wallet
|
return new_wallet
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user