Merge branch 'freqtrade:develop' into fix-docs
This commit is contained in:
commit
326ba46bf8
@ -173,7 +173,7 @@ Mandatory parameters are marked as **Required**, which means that they are requi
|
|||||||
| `dataformat_ohlcv` | Data format to use to store historical candle (OHLCV) data. <br> *Defaults to `json`*. <br> **Datatype:** String
|
| `dataformat_ohlcv` | Data format to use to store historical candle (OHLCV) data. <br> *Defaults to `json`*. <br> **Datatype:** String
|
||||||
| `dataformat_trades` | Data format to use to store historical trades data. <br> *Defaults to `jsongz`*. <br> **Datatype:** String
|
| `dataformat_trades` | Data format to use to store historical trades data. <br> *Defaults to `jsongz`*. <br> **Datatype:** String
|
||||||
| `position_adjustment_enable` | Enables the strategy to use position adjustments (additional buys or sells). [More information here](strategy-callbacks.md#adjust-trade-position). <br> [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.*<br> **Datatype:** Boolean
|
| `position_adjustment_enable` | Enables the strategy to use position adjustments (additional buys or sells). [More information here](strategy-callbacks.md#adjust-trade-position). <br> [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.*<br> **Datatype:** Boolean
|
||||||
| `max_entry_position_adjustment` | Maximum additional buy(s) for each open trade on top of the first entry Order. Set it to `-1` for unlimited additional additional orders. [More information here](strategy-callbacks.md#adjust-trade-position). <br> [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `-1`.*<br> **Datatype:** Positive Integer or -1
|
| `max_entry_position_adjustment` | Maximum additional order(s) for each open trade on top of the first entry Order. Set it to `-1` for unlimited additional orders. [More information here](strategy-callbacks.md#adjust-trade-position). <br> [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `-1`.*<br> **Datatype:** Positive Integer or -1
|
||||||
|
|
||||||
### Parameters in the strategy
|
### Parameters in the strategy
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ CONF_SCHEMA = {
|
|||||||
'enum': AVAILABLE_DATAHANDLERS,
|
'enum': AVAILABLE_DATAHANDLERS,
|
||||||
'default': 'jsongz'
|
'default': 'jsongz'
|
||||||
},
|
},
|
||||||
'position_adjustment_enable': {'type': 'boolean', 'default': False},
|
'position_adjustment_enable': {'type': 'boolean'},
|
||||||
'max_entry_position_adjustment': {'type': ['integer', 'number'], 'minimum': -1},
|
'max_entry_position_adjustment': {'type': ['integer', 'number'], 'minimum': -1},
|
||||||
},
|
},
|
||||||
'definitions': {
|
'definitions': {
|
||||||
|
@ -953,7 +953,7 @@ class Exchange:
|
|||||||
raise OperationalException(e) from e
|
raise OperationalException(e) from e
|
||||||
|
|
||||||
@retrier
|
@retrier
|
||||||
def get_tickers(self, cached: bool = False) -> Dict:
|
def get_tickers(self, symbols: List[str] = None, cached: bool = False) -> Dict:
|
||||||
"""
|
"""
|
||||||
:param cached: Allow cached result
|
:param cached: Allow cached result
|
||||||
:return: fetch_tickers result
|
:return: fetch_tickers result
|
||||||
@ -963,7 +963,7 @@ class Exchange:
|
|||||||
if tickers:
|
if tickers:
|
||||||
return tickers
|
return tickers
|
||||||
try:
|
try:
|
||||||
tickers = self._api.fetch_tickers()
|
tickers = self._api.fetch_tickers(symbols)
|
||||||
self._fetch_tickers_cache['fetch_tickers'] = tickers
|
self._fetch_tickers_cache['fetch_tickers'] = tickers
|
||||||
return tickers
|
return tickers
|
||||||
except ccxt.NotSupported as e:
|
except ccxt.NotSupported as e:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
""" Kraken exchange subclass """
|
""" Kraken exchange subclass """
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
import ccxt
|
import ccxt
|
||||||
|
|
||||||
@ -33,6 +33,12 @@ class Kraken(Exchange):
|
|||||||
return (parent_check and
|
return (parent_check and
|
||||||
market.get('darkpool', False) is False)
|
market.get('darkpool', False) is False)
|
||||||
|
|
||||||
|
def get_tickers(self, symbols: List[str] = None, cached: bool = False) -> Dict:
|
||||||
|
# Only fetch tickers for current stake currency
|
||||||
|
# Otherwise the request for kraken becomes too large.
|
||||||
|
symbols = list(self.get_markets(quote_currencies=[self._config['stake_currency']]))
|
||||||
|
return super().get_tickers(symbols=symbols, cached=cached)
|
||||||
|
|
||||||
@retrier
|
@retrier
|
||||||
def get_balances(self) -> dict:
|
def get_balances(self) -> dict:
|
||||||
if self._config['dry_run']:
|
if self._config['dry_run']:
|
||||||
|
@ -77,6 +77,9 @@ class CryptoToFiatConverter:
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
found = [x for x in self._coinlistings if x['symbol'] == crypto_symbol]
|
found = [x for x in self._coinlistings if x['symbol'] == crypto_symbol]
|
||||||
|
if crypto_symbol == 'eth':
|
||||||
|
found = [x for x in self._coinlistings if x['id'] == 'ethereum']
|
||||||
|
|
||||||
if len(found) == 1:
|
if len(found) == 1:
|
||||||
return found[0]['id']
|
return found[0]['id']
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ class RPC:
|
|||||||
'runmode': config['runmode'].value,
|
'runmode': config['runmode'].value,
|
||||||
'position_adjustment_enable': config.get('position_adjustment_enable', False),
|
'position_adjustment_enable': config.get('position_adjustment_enable', False),
|
||||||
'max_entry_position_adjustment': (
|
'max_entry_position_adjustment': (
|
||||||
config['max_entry_position_adjustment']
|
config.get('max_entry_position_adjustment', -1)
|
||||||
if config['max_entry_position_adjustment'] != float('inf')
|
if config.get('max_entry_position_adjustment') != float('inf')
|
||||||
else -1)
|
else -1)
|
||||||
}
|
}
|
||||||
return val
|
return val
|
||||||
@ -254,9 +254,11 @@ class RPC:
|
|||||||
profit_str
|
profit_str
|
||||||
]
|
]
|
||||||
if self._config.get('position_adjustment_enable', False):
|
if self._config.get('position_adjustment_enable', False):
|
||||||
max_buy = self._config['max_entry_position_adjustment'] + 1
|
max_buy_str = ''
|
||||||
|
if self._config.get('max_entry_position_adjustment', -1) > 0:
|
||||||
|
max_buy_str = f"/{self._config['max_entry_position_adjustment'] + 1}"
|
||||||
filled_buys = trade.nr_of_successful_buys
|
filled_buys = trade.nr_of_successful_buys
|
||||||
detail_trade.append(f"{filled_buys}/{max_buy}")
|
detail_trade.append(f"{filled_buys}{max_buy_str}")
|
||||||
trades_list.append(detail_trade)
|
trades_list.append(detail_trade)
|
||||||
profitcol = "Profit"
|
profitcol = "Profit"
|
||||||
if self._fiat_converter:
|
if self._fiat_converter:
|
||||||
|
@ -148,10 +148,13 @@ def test_fiat_multiple_coins(mocker, caplog):
|
|||||||
{'id': 'helium', 'symbol': 'hnt', 'name': 'Helium'},
|
{'id': 'helium', 'symbol': 'hnt', 'name': 'Helium'},
|
||||||
{'id': 'hymnode', 'symbol': 'hnt', 'name': 'Hymnode'},
|
{'id': 'hymnode', 'symbol': 'hnt', 'name': 'Hymnode'},
|
||||||
{'id': 'bitcoin', 'symbol': 'btc', 'name': 'Bitcoin'},
|
{'id': 'bitcoin', 'symbol': 'btc', 'name': 'Bitcoin'},
|
||||||
|
{'id': 'ethereum', 'symbol': 'eth', 'name': 'Ethereum'},
|
||||||
|
{'id': 'ethereum-wormhole', 'symbol': 'eth', 'name': 'Ethereum Wormhole'},
|
||||||
]
|
]
|
||||||
|
|
||||||
assert fiat_convert._get_gekko_id('btc') == 'bitcoin'
|
assert fiat_convert._get_gekko_id('btc') == 'bitcoin'
|
||||||
assert fiat_convert._get_gekko_id('hnt') is None
|
assert fiat_convert._get_gekko_id('hnt') is None
|
||||||
|
assert fiat_convert._get_gekko_id('eth') == 'ethereum'
|
||||||
|
|
||||||
assert log_has('Found multiple mappings in goingekko for hnt.', caplog)
|
assert log_has('Found multiple mappings in goingekko for hnt.', caplog)
|
||||||
|
|
||||||
|
@ -235,9 +235,13 @@ def test_rpc_status_table(default_conf, ticker, fee, mocker) -> None:
|
|||||||
assert '-0.06' == f'{fiat_profit_sum:.2f}'
|
assert '-0.06' == f'{fiat_profit_sum:.2f}'
|
||||||
|
|
||||||
rpc._config['position_adjustment_enable'] = True
|
rpc._config['position_adjustment_enable'] = True
|
||||||
|
rpc._config['max_entry_position_adjustment'] = 3
|
||||||
result, headers, fiat_profit_sum = rpc._rpc_status_table(default_conf['stake_currency'], 'USD')
|
result, headers, fiat_profit_sum = rpc._rpc_status_table(default_conf['stake_currency'], 'USD')
|
||||||
assert "# Buys" in headers
|
assert "# Buys" in headers
|
||||||
assert len(result[0]) == 5
|
assert len(result[0]) == 5
|
||||||
|
# 4th column should be 1/4 - as 1 order filled (a total of 4 is possible)
|
||||||
|
# 3 on top of the initial one.
|
||||||
|
assert result[0][4] == '1/4'
|
||||||
|
|
||||||
mocker.patch('freqtrade.exchange.Exchange.get_rate',
|
mocker.patch('freqtrade.exchange.Exchange.get_rate',
|
||||||
MagicMock(side_effect=ExchangeError("Pair 'ETH/BTC' not available")))
|
MagicMock(side_effect=ExchangeError("Pair 'ETH/BTC' not available")))
|
||||||
|
Loading…
Reference in New Issue
Block a user