bugfix backtesting
This commit is contained in:
parent
fc862f5bb9
commit
dfdb58edff
@ -96,6 +96,7 @@ def backtest(stake_amount: float, processed: Dict[str, DataFrame],
|
|||||||
trade_count_lock[row.date] = trade_count_lock.get(row.date, 0) + 1
|
trade_count_lock[row.date] = trade_count_lock.get(row.date, 0) + 1
|
||||||
|
|
||||||
trade = Trade(
|
trade = Trade(
|
||||||
|
pair=pair,
|
||||||
open_rate=row.close,
|
open_rate=row.close,
|
||||||
open_date=row.date,
|
open_date=row.date,
|
||||||
stake_amount=stake_amount,
|
stake_amount=stake_amount,
|
||||||
|
@ -93,13 +93,12 @@ class Trade(_DECL_BASE):
|
|||||||
:param current_rate: current rate retrieved by exchange.get_ticker()
|
:param current_rate: current rate retrieved by exchange.get_ticker()
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
logger.info('Updating statistics for trade (id=%d) ...', self.id)
|
|
||||||
if not self.stat_min_rate or current_rate < self.stat_min_rate:
|
if not self.stat_min_rate or current_rate < self.stat_min_rate:
|
||||||
logger.info('Update stat_min_rate. %s -> %s' % (self.stat_min_rate, current_rate))
|
logger.debug('Update stat_min_rate. %s -> %s' % (self.stat_min_rate, current_rate))
|
||||||
self.stat_min_rate = current_rate
|
self.stat_min_rate = current_rate
|
||||||
self.stat_min_rate_date = datetime.utcnow()
|
self.stat_min_rate_date = datetime.utcnow()
|
||||||
if not self.stat_max_rate or current_rate > self.stat_max_rate:
|
if not self.stat_max_rate or current_rate > self.stat_max_rate:
|
||||||
logger.info('Update stat_max_rate. %s -> %s' % (self.stat_max_rate, current_rate))
|
logger.debug('Update stat_max_rate. %s -> %s' % (self.stat_max_rate, current_rate))
|
||||||
self.stat_max_rate = current_rate
|
self.stat_max_rate = current_rate
|
||||||
self.stat_max_rate_date = datetime.utcnow()
|
self.stat_max_rate_date = datetime.utcnow()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user