avoid calling exchange.get_fee inside loop

This commit is contained in:
Janne Sinivirta 2018-06-22 21:04:07 +03:00
parent 98cd8970f9
commit a68c90c512
1 changed files with 3 additions and 3 deletions

View File

@ -62,6 +62,7 @@ class Backtesting(object):
self.config['exchange']['uid'] = ''
self.config['dry_run'] = True
self.exchange = Exchange(self.config)
self.fee = self.exchange.get_fee()
@staticmethod
def get_timeframe(data: Dict[str, DataFrame]) -> Tuple[arrow.Arrow, arrow.Arrow]:
@ -130,14 +131,13 @@ class Backtesting(object):
stake_amount = args['stake_amount']
max_open_trades = args.get('max_open_trades', 0)
fee = self.exchange.get_fee()
trade = Trade(
open_rate=buy_row.close,
open_date=buy_row.date,
stake_amount=stake_amount,
amount=stake_amount / buy_row.open,
fee_open=fee,
fee_close=fee
fee_open=self.fee,
fee_close=self.fee
)
# calculate win/lose forwards from buy point