Update example to use get_trades_proxy
This commit is contained in:
parent
8f29312c9e
commit
7e08e3a59a
@ -1041,10 +1041,9 @@ from datetime import timedelta, datetime, timezone
|
||||
# Within populate indicators (or populate_buy):
|
||||
if self.config['runmode'].value in ('live', 'dry_run'):
|
||||
# fetch closed trades for the last 2 days
|
||||
trades = Trade.get_trades([Trade.pair == metadata['pair'],
|
||||
Trade.open_date > datetime.utcnow() - timedelta(days=2),
|
||||
Trade.is_open.is_(False),
|
||||
]).all()
|
||||
trades = Trade.get_trades_proxy(
|
||||
pair=metadata['pair'], is_open=False,
|
||||
open_date=datetime.now(timezone.utc) - timedelta(days=2))
|
||||
# Analyze the conditions you'd like to lock the pair .... will probably be different for every strategy
|
||||
sumprofit = sum(trade.close_profit for trade in trades)
|
||||
if sumprofit < 0:
|
||||
|
Loading…
Reference in New Issue
Block a user