Address points stated in comments
This commit is contained in:
parent
fdd362299f
commit
6139239b86
@ -41,18 +41,21 @@ def start_list_exchanges(args: Dict[str, Any]) -> None:
|
|||||||
def _print_objs_tabular(objs: List, print_colorized: bool) -> None:
|
def _print_objs_tabular(objs: List, print_colorized: bool) -> None:
|
||||||
if print_colorized:
|
if print_colorized:
|
||||||
colorama_init(autoreset=True)
|
colorama_init(autoreset=True)
|
||||||
|
red = Fore.RED
|
||||||
|
yellow = Fore.YELLOW
|
||||||
|
reset = Style.RESET_ALL
|
||||||
|
else:
|
||||||
|
red = ''
|
||||||
|
yellow = ''
|
||||||
|
reset = ''
|
||||||
|
|
||||||
names = [s['name'] for s in objs]
|
names = [s['name'] for s in objs]
|
||||||
objss_to_print = [{
|
objss_to_print = [{
|
||||||
'name': s['name'] if s['name'] else "--",
|
'name': s['name'] if s['name'] else "--",
|
||||||
'location': s['location'].name,
|
'location': s['location'].name,
|
||||||
'status': (((Fore.RED if print_colorized else '') +
|
'status': (red + "LOAD FAILED" + reset if s['class'] is None
|
||||||
"LOAD FAILED" + (Style.RESET_ALL if print_colorized else ''))
|
|
||||||
if s['class'] is None
|
|
||||||
else "OK" if names.count(s['name']) == 1
|
else "OK" if names.count(s['name']) == 1
|
||||||
else ((Fore.YELLOW if print_colorized else '') +
|
else yellow + "DUPLICATE NAME" + reset)
|
||||||
"DUPLICATE NAME" +
|
|
||||||
(Style.RESET_ALL if print_colorized else '')))
|
|
||||||
} for s in objs]
|
} for s in objs]
|
||||||
|
|
||||||
print(tabulate(objss_to_print, headers='keys', tablefmt='pipe'))
|
print(tabulate(objss_to_print, headers='keys', tablefmt='pipe'))
|
||||||
|
@ -87,7 +87,7 @@ class IResolver:
|
|||||||
continue
|
continue
|
||||||
module_path = entry.resolve()
|
module_path = entry.resolve()
|
||||||
|
|
||||||
obj = next(cls._get_valid_object(module_path, object_name), None) # noqa
|
obj = next(cls._get_valid_object(module_path, object_name), None)
|
||||||
|
|
||||||
if obj:
|
if obj:
|
||||||
return (obj, module_path)
|
return (obj, module_path)
|
||||||
|
@ -1,87 +1,9 @@
|
|||||||
|
# The strategy which fails to load due to non-existent dependency
|
||||||
# --- Do not remove these libs ---
|
|
||||||
from freqtrade.strategy.interface import IStrategy
|
|
||||||
from pandas import DataFrame
|
|
||||||
# --------------------------------
|
|
||||||
|
|
||||||
# Add your lib to import here
|
|
||||||
import talib.abstract as ta
|
|
||||||
|
|
||||||
import nonexiting_module # noqa
|
import nonexiting_module # noqa
|
||||||
|
|
||||||
|
from freqtrade.strategy.interface import IStrategy
|
||||||
|
|
||||||
|
|
||||||
# This class is a sample. Feel free to customize it.
|
|
||||||
class TestStrategyLegacy(IStrategy):
|
class TestStrategyLegacy(IStrategy):
|
||||||
"""
|
pass
|
||||||
This is a test strategy using the legacy function headers, which will be
|
|
||||||
removed in a future update.
|
|
||||||
Please do not use this as a template, but refer to user_data/strategy/sample_strategy.py
|
|
||||||
for a uptodate version of this template.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Minimal ROI designed for the strategy.
|
|
||||||
# This attribute will be overridden if the config file contains "minimal_roi"
|
|
||||||
minimal_roi = {
|
|
||||||
"40": 0.0,
|
|
||||||
"30": 0.01,
|
|
||||||
"20": 0.02,
|
|
||||||
"0": 0.04
|
|
||||||
}
|
|
||||||
|
|
||||||
# Optimal stoploss designed for the strategy
|
|
||||||
# This attribute will be overridden if the config file contains "stoploss"
|
|
||||||
stoploss = -0.10
|
|
||||||
|
|
||||||
# Optimal ticker interval for the strategy
|
|
||||||
ticker_interval = '5m'
|
|
||||||
|
|
||||||
def populate_indicators(self, dataframe: DataFrame) -> DataFrame:
|
|
||||||
"""
|
|
||||||
Adds several different TA indicators to the given DataFrame
|
|
||||||
|
|
||||||
Performance Note: For the best performance be frugal on the number of indicators
|
|
||||||
you are using. Let uncomment only the indicator you are using in your strategies
|
|
||||||
or your hyperopt configuration, otherwise you will waste your memory and CPU usage.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Momentum Indicator
|
|
||||||
# ------------------------------------
|
|
||||||
|
|
||||||
# ADX
|
|
||||||
dataframe['adx'] = ta.ADX(dataframe)
|
|
||||||
|
|
||||||
# TEMA - Triple Exponential Moving Average
|
|
||||||
dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9)
|
|
||||||
|
|
||||||
return dataframe
|
|
||||||
|
|
||||||
def populate_buy_trend(self, dataframe: DataFrame) -> DataFrame:
|
|
||||||
"""
|
|
||||||
Based on TA indicators, populates the buy signal for the given dataframe
|
|
||||||
:param dataframe: DataFrame
|
|
||||||
:return: DataFrame with buy column
|
|
||||||
"""
|
|
||||||
dataframe.loc[
|
|
||||||
(
|
|
||||||
(dataframe['adx'] > 30) &
|
|
||||||
(dataframe['tema'] > dataframe['tema'].shift(1)) &
|
|
||||||
(dataframe['volume'] > 0)
|
|
||||||
),
|
|
||||||
'buy'] = 1
|
|
||||||
|
|
||||||
return dataframe
|
|
||||||
|
|
||||||
def populate_sell_trend(self, dataframe: DataFrame) -> DataFrame:
|
|
||||||
"""
|
|
||||||
Based on TA indicators, populates the sell signal for the given dataframe
|
|
||||||
:param dataframe: DataFrame
|
|
||||||
:return: DataFrame with buy column
|
|
||||||
"""
|
|
||||||
dataframe.loc[
|
|
||||||
(
|
|
||||||
(dataframe['adx'] > 70) &
|
|
||||||
(dataframe['tema'] < dataframe['tema'].shift(1)) &
|
|
||||||
(dataframe['volume'] > 0)
|
|
||||||
),
|
|
||||||
'sell'] = 1
|
|
||||||
return dataframe
|
|
||||||
|
Loading…
Reference in New Issue
Block a user