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):
|
# Within populate indicators (or populate_buy):
|
||||||
if self.config['runmode'].value in ('live', 'dry_run'):
|
if self.config['runmode'].value in ('live', 'dry_run'):
|
||||||
# fetch closed trades for the last 2 days
|
# fetch closed trades for the last 2 days
|
||||||
trades = Trade.get_trades([Trade.pair == metadata['pair'],
|
trades = Trade.get_trades_proxy(
|
||||||
Trade.open_date > datetime.utcnow() - timedelta(days=2),
|
pair=metadata['pair'], is_open=False,
|
||||||
Trade.is_open.is_(False),
|
open_date=datetime.now(timezone.utc) - timedelta(days=2))
|
||||||
]).all()
|
|
||||||
# Analyze the conditions you'd like to lock the pair .... will probably be different for every strategy
|
# 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)
|
sumprofit = sum(trade.close_profit for trade in trades)
|
||||||
if sumprofit < 0:
|
if sumprofit < 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user