Some final polish to configurable_side

This commit is contained in:
Matthias 2020-02-26 19:49:54 +01:00
parent 3c5e716d8f
commit 0fea3a7ea7
3 changed files with 4 additions and 5 deletions

View File

@ -526,7 +526,7 @@ In line with that, if `ask_strategy.price_side` is set to `"bid"`, then the bot
When selling with the orderbook enabled (`ask_strategy.use_order_book=True`), Freqtrade fetches the `ask_strategy.order_book_max` entries in the orderbook. Then each of the orderbook steps between `ask_strategy.order_book_min` and `ask_strategy.order_book_max` on the configured orderbook side are validated for a profitable sell-possibility based on the strategy configuration and the sell order is placed at the first profitable spot. When selling with the orderbook enabled (`ask_strategy.use_order_book=True`), Freqtrade fetches the `ask_strategy.order_book_max` entries in the orderbook. Then each of the orderbook steps between `ask_strategy.order_book_min` and `ask_strategy.order_book_max` on the configured orderbook side are validated for a profitable sell-possibility based on the strategy configuration and the sell order is placed at the first profitable spot.
!!! Note: !!! Note
Using `order_book_max` higher than `order_book_min` only makes sense when ask_strategy.price_side is set to `"ask"`. Using `order_book_max` higher than `order_book_min` only makes sense when ask_strategy.price_side is set to `"ask"`.
The idea here is to place the sell order early, to be ahead in the queue. The idea here is to place the sell order early, to be ahead in the queue.

View File

@ -647,12 +647,10 @@ class FreqtradeBot:
config_ask_strategy = self.config.get('ask_strategy', {}) config_ask_strategy = self.config.get('ask_strategy', {})
if config_ask_strategy.get('use_order_book', False): if config_ask_strategy.get('use_order_book', False):
# This code is only used for notifications, selling uses the generator directly
logger.debug('Using order book to get sell rate') logger.debug('Using order book to get sell rate')
rate = next(self._order_book_gen(pair, f"{config_ask_strategy['price_side']}s")) rate = next(self._order_book_gen(pair, f"{config_ask_strategy['price_side']}s"))
# order_book = self.exchange.get_order_book(pair, 1)
# rate = order_book[f"{config_ask_strategy['price_side']}s"][0][0]
else: else:
rate = self.exchange.fetch_ticker(pair)[config_ask_strategy['price_side']] rate = self.exchange.fetch_ticker(pair)[config_ask_strategy['price_side']]
self._sell_rate_cache[pair] = rate self._sell_rate_cache[pair] = rate

View File

@ -922,7 +922,8 @@ def test_process_informative_pairs_added(default_conf, ticker, mocker) -> None:
('bid', 4, 5, 10, 1.0, 5), # last bigger than bid ('bid', 4, 5, 10, 1.0, 5), # last bigger than bid
('bid', 4, 5, 10, 0.5, 5), # last bigger than bid ('bid', 4, 5, 10, 0.5, 5), # last bigger than bid
]) ])
def test_get_buy_rate(mocker, default_conf, caplog, side, ask, bid, last, last_ab, expected) -> None: def test_get_buy_rate(mocker, default_conf, caplog, side, ask, bid,
last, last_ab, expected) -> None:
default_conf['bid_strategy']['ask_last_balance'] = last_ab default_conf['bid_strategy']['ask_last_balance'] = last_ab
default_conf['bid_strategy']['price_side'] = side default_conf['bid_strategy']['price_side'] = side
freqtrade = get_patched_freqtradebot(mocker, default_conf) freqtrade = get_patched_freqtradebot(mocker, default_conf)