add ticker argumet to get_target_bid
This commit is contained in:
parent
24c587518a
commit
c36fa0c7e2
@ -206,7 +206,7 @@ class FreqtradeBot(object):
|
|||||||
self.state = State.STOPPED
|
self.state = State.STOPPED
|
||||||
return state_changed
|
return state_changed
|
||||||
|
|
||||||
def get_target_bid(self, pair: str) -> float:
|
def get_target_bid(self, pair: str, ticker: Dict = None) -> float:
|
||||||
"""
|
"""
|
||||||
Calculates bid target between current ask price and last price
|
Calculates bid target between current ask price and last price
|
||||||
:return: float: Price
|
:return: float: Price
|
||||||
@ -223,8 +223,9 @@ class FreqtradeBot(object):
|
|||||||
logger.info('...top %s order book buy rate %0.8f', order_book_top, order_book_rate)
|
logger.info('...top %s order book buy rate %0.8f', order_book_top, order_book_rate)
|
||||||
used_rate = order_book_rate
|
used_rate = order_book_rate
|
||||||
else:
|
else:
|
||||||
logger.info('Using Last Ask / Last Price')
|
if not ticker:
|
||||||
ticker = self.exchange.get_ticker(pair)
|
logger.info('Using Last Ask / Last Price')
|
||||||
|
ticker = self.exchange.get_ticker(pair)
|
||||||
if ticker['ask'] < ticker['last']:
|
if ticker['ask'] < ticker['last']:
|
||||||
ticker_rate = ticker['ask']
|
ticker_rate = ticker['ask']
|
||||||
else:
|
else:
|
||||||
@ -269,12 +270,10 @@ class FreqtradeBot(object):
|
|||||||
return stake_amount
|
return stake_amount
|
||||||
|
|
||||||
def _get_min_pair_stake_amount(self, pair: str, price: float) -> Optional[float]:
|
def _get_min_pair_stake_amount(self, pair: str, price: float) -> Optional[float]:
|
||||||
markets = self.exchange.get_markets()
|
try:
|
||||||
markets = [m for m in markets if m['symbol'] == pair]
|
market = self.exchange.markets[pair]
|
||||||
if not markets:
|
except KeyError:
|
||||||
raise ValueError(f'Can\'t get market information for symbol {pair}')
|
raise ValueError(f"Can't get market information for symbol {pair}")
|
||||||
|
|
||||||
market = markets[0]
|
|
||||||
|
|
||||||
if 'limits' not in market:
|
if 'limits' not in market:
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user