Use price_side for get_sell_rate

This commit is contained in:
Matthias 2020-02-23 14:06:42 +01:00
parent f91d7beaa1
commit de48a697b0
2 changed files with 5 additions and 2 deletions

View File

@ -115,6 +115,7 @@ CONF_SCHEMA = {
'maximum': 1, 'maximum': 1,
'exclusiveMaximum': False, 'exclusiveMaximum': False,
}, },
'price_side': {'type': 'string', 'enum': ORDERBOOK_SIDES, 'default': 'bid'},
'use_order_book': {'type': 'boolean'}, 'use_order_book': {'type': 'boolean'},
'order_book_top': {'type': 'integer', 'maximum': 20, 'minimum': 1}, 'order_book_top': {'type': 'integer', 'maximum': 20, 'minimum': 1},
'check_depth_of_market': { 'check_depth_of_market': {
@ -130,6 +131,7 @@ CONF_SCHEMA = {
'ask_strategy': { 'ask_strategy': {
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'price_side': {'type': 'string', 'enum': ORDERBOOK_SIDES, 'default': 'ask'},
'use_order_book': {'type': 'boolean'}, 'use_order_book': {'type': 'boolean'},
'order_book_min': {'type': 'integer', 'minimum': 1}, 'order_book_min': {'type': 'integer', 'minimum': 1},
'order_book_max': {'type': 'integer', 'minimum': 1, 'maximum': 50}, 'order_book_max': {'type': 'integer', 'minimum': 1, 'maximum': 50},
@ -300,6 +302,7 @@ SCHEMA_TRADE_REQUIRED = [
'last_stake_amount_min_ratio', 'last_stake_amount_min_ratio',
'dry_run', 'dry_run',
'dry_run_wallet', 'dry_run_wallet',
'ask_strategy',
'bid_strategy', 'bid_strategy',
'unfilledtimeout', 'unfilledtimeout',
'stoploss', 'stoploss',

View File

@ -639,10 +639,10 @@ class FreqtradeBot:
logger.debug('Using order book to get sell rate') logger.debug('Using order book to get sell rate')
order_book = self.exchange.get_order_book(pair, 1) order_book = self.exchange.get_order_book(pair, 1)
rate = order_book['bids'][0][0] rate = order_book[f"{config_ask_strategy['price_side']}s"][0][0]
else: else:
rate = self.exchange.fetch_ticker(pair)['bid'] rate = self.exchange.fetch_ticker(pair)[config_ask_strategy['price_side']]
self._sell_rate_cache[pair] = rate self._sell_rate_cache[pair] = rate
return rate return rate