Simplify wallet code
This commit is contained in:
parent
f65092459a
commit
324b9dbdff
@ -115,8 +115,7 @@ class Backtesting:
|
|||||||
if self.config.get('enable_protections', False):
|
if self.config.get('enable_protections', False):
|
||||||
self.protections = ProtectionManager(self.config)
|
self.protections = ProtectionManager(self.config)
|
||||||
|
|
||||||
self.wallets = Wallets(self.config, self.exchange)
|
self.wallets = Wallets(self.config, self.exchange, log=False)
|
||||||
self.wallets._log = False
|
|
||||||
|
|
||||||
# Get maximum required startup period
|
# Get maximum required startup period
|
||||||
self.required_startup = max([strat.startup_candle_count for strat in self.strategylist])
|
self.required_startup = max([strat.startup_candle_count for strat in self.strategylist])
|
||||||
|
@ -27,15 +27,14 @@ class Wallet(NamedTuple):
|
|||||||
|
|
||||||
class Wallets:
|
class Wallets:
|
||||||
|
|
||||||
def __init__(self, config: dict, exchange: Exchange, skip_update: bool = False) -> None:
|
def __init__(self, config: dict, exchange: Exchange, log: bool = True) -> None:
|
||||||
self._config = config
|
self._config = config
|
||||||
self._log = True
|
self._log = log
|
||||||
self._exchange = exchange
|
self._exchange = exchange
|
||||||
self._wallets: Dict[str, Wallet] = {}
|
self._wallets: Dict[str, Wallet] = {}
|
||||||
self.start_cap = config['dry_run_wallet']
|
self.start_cap = config['dry_run_wallet']
|
||||||
self._last_wallet_refresh = 0
|
self._last_wallet_refresh = 0
|
||||||
if not skip_update:
|
self.update()
|
||||||
self.update()
|
|
||||||
|
|
||||||
def get_free(self, currency: str) -> float:
|
def get_free(self, currency: str) -> float:
|
||||||
balance = self._wallets.get(currency)
|
balance = self._wallets.get(currency)
|
||||||
|
Loading…
Reference in New Issue
Block a user