Wallets should not recalculate close_profit for closed trades
This commit is contained in:
parent
f367375e5b
commit
37d7d2afd5
@ -69,7 +69,7 @@ class Wallets:
|
||||
_wallets = {}
|
||||
closed_trades = Trade.get_trades_proxy(is_open=False)
|
||||
open_trades = Trade.get_trades_proxy(is_open=True)
|
||||
tot_profit = sum([trade.calc_profit() for trade in closed_trades])
|
||||
tot_profit = sum([trade.close_profit_abs for trade in closed_trades])
|
||||
tot_in_trades = sum([trade.stake_amount for trade in open_trades])
|
||||
|
||||
current_stake = self.start_cap + tot_profit - tot_in_trades
|
||||
|
@ -82,6 +82,7 @@ def mock_trade_2(fee):
|
||||
open_rate=0.123,
|
||||
close_rate=0.128,
|
||||
close_profit=0.005,
|
||||
close_profit_abs=0.000584127,
|
||||
exchange='bittrex',
|
||||
is_open=False,
|
||||
open_order_id='dry_run_sell_12345',
|
||||
@ -141,6 +142,7 @@ def mock_trade_3(fee):
|
||||
open_rate=0.05,
|
||||
close_rate=0.06,
|
||||
close_profit=0.01,
|
||||
close_profit_abs=0.000155,
|
||||
exchange='bittrex',
|
||||
is_open=False,
|
||||
strategy='DefaultStrategy',
|
||||
|
@ -2243,6 +2243,7 @@ def test_check_handle_timedout_sell_usercustom(default_conf, ticker, limit_sell_
|
||||
|
||||
open_trade.open_date = arrow.utcnow().shift(hours=-5).datetime
|
||||
open_trade.close_date = arrow.utcnow().shift(minutes=-601).datetime
|
||||
open_trade.close_profit_abs = 0.001
|
||||
open_trade.is_open = False
|
||||
|
||||
Trade.session.add(open_trade)
|
||||
@ -2290,6 +2291,7 @@ def test_check_handle_timedout_sell(default_conf, ticker, limit_sell_order_old,
|
||||
|
||||
open_trade.open_date = arrow.utcnow().shift(hours=-5).datetime
|
||||
open_trade.close_date = arrow.utcnow().shift(minutes=-601).datetime
|
||||
open_trade.close_profit_abs = 0.001
|
||||
open_trade.is_open = False
|
||||
|
||||
Trade.session.add(open_trade)
|
||||
|
Loading…
Reference in New Issue
Block a user