Merge pull request #1269 from freqtrade/feat/force_buy

add /forcebuy to telgram handler
This commit is contained in:
Matthias
2018-11-04 09:25:13 +01:00
committed by GitHub
13 changed files with 291 additions and 6 deletions

View File

@@ -427,7 +427,7 @@ class FreqtradeBot(object):
return True
return False
def execute_buy(self, pair: str, stake_amount: float) -> bool:
def execute_buy(self, pair: str, stake_amount: float, price: Optional[float] = None) -> bool:
"""
Executes a limit buy for the given pair
:param pair: pair for which we want to create a LIMIT_BUY
@@ -438,8 +438,11 @@ class FreqtradeBot(object):
stake_currency = self.config['stake_currency']
fiat_currency = self.config.get('fiat_display_currency', None)
# Calculate amount
buy_limit = self.get_target_bid(pair, self.exchange.get_ticker(pair))
if price:
buy_limit = price
else:
# Calculate amount
buy_limit = self.get_target_bid(pair, self.exchange.get_ticker(pair))
min_stake_amount = self._get_min_pair_stake_amount(pair_s, buy_limit)
if min_stake_amount is not None and min_stake_amount > stake_amount: