Reduce usage of arrow
This commit is contained in:
@@ -3,10 +3,9 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
from datetime import datetime
|
||||||
from typing import Dict, NamedTuple, Optional
|
from typing import Dict, NamedTuple, Optional
|
||||||
|
|
||||||
import arrow
|
|
||||||
|
|
||||||
from freqtrade.constants import UNLIMITED_STAKE_AMOUNT, Config
|
from freqtrade.constants import UNLIMITED_STAKE_AMOUNT, Config
|
||||||
from freqtrade.enums import RunMode, TradingMode
|
from freqtrade.enums import RunMode, TradingMode
|
||||||
from freqtrade.exceptions import DependencyException
|
from freqtrade.exceptions import DependencyException
|
||||||
@@ -166,14 +165,15 @@ class Wallets:
|
|||||||
for trading operations, the latest balance is needed.
|
for trading operations, the latest balance is needed.
|
||||||
:param require_update: Allow skipping an update if balances were recently refreshed
|
:param require_update: Allow skipping an update if balances were recently refreshed
|
||||||
"""
|
"""
|
||||||
if (require_update or (self._last_wallet_refresh + 3600 < arrow.utcnow().int_timestamp)):
|
now = datetime.now().timestamp()
|
||||||
|
if (require_update or (self._last_wallet_refresh + 3600 < now)):
|
||||||
if (not self._config['dry_run'] or self._config.get('runmode') == RunMode.LIVE):
|
if (not self._config['dry_run'] or self._config.get('runmode') == RunMode.LIVE):
|
||||||
self._update_live()
|
self._update_live()
|
||||||
else:
|
else:
|
||||||
self._update_dry()
|
self._update_dry()
|
||||||
if self._log:
|
if self._log:
|
||||||
logger.info('Wallets synced.')
|
logger.info('Wallets synced.')
|
||||||
self._last_wallet_refresh = arrow.utcnow().int_timestamp
|
self._last_wallet_refresh = datetime.now().timestamp()
|
||||||
|
|
||||||
def get_all_balances(self) -> Dict[str, Wallet]:
|
def get_all_balances(self) -> Dict[str, Wallet]:
|
||||||
return self._wallets
|
return self._wallets
|
||||||
|
|||||||
Reference in New Issue
Block a user