Reafcotring Create Trade

This commit is contained in:
Jean-Baptiste LE STANG 2018-07-10 15:10:56 +02:00
parent b4be3c2499
commit 773fb5953b

View File

@ -305,9 +305,6 @@ class FreqtradeBot(object):
if not stake_amount: if not stake_amount:
return False return False
stake_currency = self.config['stake_currency']
fiat_currency = self.config['fiat_display_currency']
exc_name = self.exchange.name
logger.info( logger.info(
'Checking buy signals to create a new trade with stake_amount: %f ...', 'Checking buy signals to create a new trade with stake_amount: %f ...',
@ -328,12 +325,20 @@ class FreqtradeBot(object):
for _pair in whitelist: for _pair in whitelist:
(buy, sell) = self.analyze.get_signal(self.exchange, _pair, interval) (buy, sell) = self.analyze.get_signal(self.exchange, _pair, interval)
if buy and not sell: if buy and not sell:
pair = _pair return self.execute_buy(_pair, stake_amount)
break return False
else:
return False def execute_buy(self, pair: str, stake_amount: float) -> bool:
"""
Executes a limit buy for the given pair
:param pair: pair for which we want to create a LIMIT_BUY
:return: None
"""
pair_s = pair.replace('_', '/') pair_s = pair.replace('_', '/')
pair_url = self.exchange.get_pair_detail_url(pair) pair_url = self.exchange.get_pair_detail_url(pair)
stake_currency = self.config['stake_currency']
fiat_currency = self.config['fiat_display_currency']
exc_name = self.exchange.name
# Calculate amount # Calculate amount
buy_limit = self.get_target_bid(self.exchange.get_ticker(pair)) buy_limit = self.get_target_bid(self.exchange.get_ticker(pair))