From de48a697b0a5abdee5b012f2b5b919d0fe06cb9a Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 23 Feb 2020 14:06:42 +0100 Subject: [PATCH] Use price_side for get_sell_rate --- freqtrade/constants.py | 3 +++ freqtrade/freqtradebot.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/freqtrade/constants.py b/freqtrade/constants.py index 743070196..ac1a8a6a9 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -115,6 +115,7 @@ CONF_SCHEMA = { 'maximum': 1, 'exclusiveMaximum': False, }, + 'price_side': {'type': 'string', 'enum': ORDERBOOK_SIDES, 'default': 'bid'}, 'use_order_book': {'type': 'boolean'}, 'order_book_top': {'type': 'integer', 'maximum': 20, 'minimum': 1}, 'check_depth_of_market': { @@ -130,6 +131,7 @@ CONF_SCHEMA = { 'ask_strategy': { 'type': 'object', 'properties': { + 'price_side': {'type': 'string', 'enum': ORDERBOOK_SIDES, 'default': 'ask'}, 'use_order_book': {'type': 'boolean'}, 'order_book_min': {'type': 'integer', 'minimum': 1}, 'order_book_max': {'type': 'integer', 'minimum': 1, 'maximum': 50}, @@ -300,6 +302,7 @@ SCHEMA_TRADE_REQUIRED = [ 'last_stake_amount_min_ratio', 'dry_run', 'dry_run_wallet', + 'ask_strategy', 'bid_strategy', 'unfilledtimeout', 'stoploss', diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index dffec940c..5e8f1cc98 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -639,10 +639,10 @@ class FreqtradeBot: logger.debug('Using order book to get sell rate') 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: - rate = self.exchange.fetch_ticker(pair)['bid'] + rate = self.exchange.fetch_ticker(pair)[config_ask_strategy['price_side']] self._sell_rate_cache[pair] = rate return rate