mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Add stake_currency to strategy, fix documentation typo
This commit is contained in:
parent
6312d785d8
commit
06f4e627fc
|
@ -278,13 +278,13 @@ Please always check if the `DataProvider` is available to avoid failures during
|
|||
|
||||
``` python
|
||||
if self.dp:
|
||||
if dp.runmode == 'live':
|
||||
if ('ETH/BTC', ticker_interval) in self.dp.available_pairs:
|
||||
data_eth = self.dp.ohlcv(pair='ETH/BTC',
|
||||
ticker_interval=ticker_interval)
|
||||
if self.dp.runmode == 'live':
|
||||
if (f'{self.stake_currency}/BTC', self.ticker_interval) in self.dp.available_pairs:
|
||||
data_eth = self.dp.ohlcv(pair='{self.stake_currency}/BTC',
|
||||
ticker_interval=self.ticker_interval)
|
||||
else:
|
||||
# Get historic ohlcv data (cached on disk).
|
||||
history_eth = self.dp.historic_ohlcv(pair='ETH/BTC',
|
||||
history_eth = self.dp.historic_ohlcv(pair='{self.stake_currency}/BTC',
|
||||
ticker_interval='1h')
|
||||
```
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@ class StrategyResolver(IResolver):
|
|||
("process_only_new_candles", None, False),
|
||||
("order_types", None, False),
|
||||
("order_time_in_force", None, False),
|
||||
("stake_currency", None, False),
|
||||
("stake_amount", None, False),
|
||||
("use_sell_signal", False, True),
|
||||
("sell_profit_only", False, True),
|
||||
("ignore_roi_if_buy_signal", False, True),
|
||||
|
|
|
@ -194,11 +194,13 @@ def test_strategy_override_ticker_interval(caplog):
|
|||
|
||||
config = {
|
||||
'strategy': 'DefaultStrategy',
|
||||
'ticker_interval': 60
|
||||
'ticker_interval': 60,
|
||||
'stake_currency': 'ETH'
|
||||
}
|
||||
resolver = StrategyResolver(config)
|
||||
|
||||
assert resolver.strategy.ticker_interval == 60
|
||||
assert resolver.strategy.stake_currency == 'ETH'
|
||||
assert ('freqtrade.resolvers.strategy_resolver',
|
||||
logging.INFO,
|
||||
"Override strategy 'ticker_interval' with value in config file: 60."
|
||||
|
|
Loading…
Reference in New Issue
Block a user