Improve dry-run calculations
This commit is contained in:
@@ -54,21 +54,20 @@ class Wallets:
|
||||
def _update_dry(self) -> None:
|
||||
""" Update from database in dry-run mode"""
|
||||
closed_trades = Trade.get_trades(Trade.is_open.is_(False)).all()
|
||||
|
||||
open_trades = Trade.get_trades(Trade.is_open.is_(True)).all()
|
||||
tot_profit = sum([trade.calc_profit() for trade in closed_trades])
|
||||
tot_in_trades = sum([trade.stake_amount for trade in open_trades])
|
||||
|
||||
current_stake = self.start_cap + tot_profit
|
||||
current_stake = self.start_cap + tot_profit - tot_in_trades
|
||||
self._wallets[self._config['stake_currency']] = Wallet(
|
||||
self._config['stake_currency'],
|
||||
current_stake,
|
||||
0,
|
||||
current_stake
|
||||
)
|
||||
open_trades = Trade.get_trades(Trade.is_open.is_(True)).all()
|
||||
|
||||
for trade in open_trades:
|
||||
curr = trade.pair.split('/')[0]
|
||||
trade.amount
|
||||
self._wallets[curr] = Wallet(
|
||||
curr,
|
||||
trade.amount,
|
||||
|
Reference in New Issue
Block a user