Small stylistic fixes

This commit is contained in:
Matthias 2019-11-16 14:47:44 +01:00
parent 79891671e9
commit 37f8139432
4 changed files with 20 additions and 14 deletions

View File

@ -3,14 +3,18 @@
from functools import reduce from functools import reduce
from typing import Any, Callable, Dict, List from typing import Any, Callable, Dict, List
import numpy as np # noqa
import talib.abstract as ta
from pandas import DataFrame from pandas import DataFrame
import pandas as pd # noqa
import numpy as np # noqa
from skopt.space import Categorical, Dimension, Integer, Real # noqa from skopt.space import Categorical, Dimension, Integer, Real # noqa
import freqtrade.vendor.qtpylib.indicators as qtpylib
from freqtrade.optimize.hyperopt_interface import IHyperOpt from freqtrade.optimize.hyperopt_interface import IHyperOpt
# --------------------------------
# Add your lib to import here
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
class {{ hyperopt }}(IHyperOpt): class {{ hyperopt }}(IHyperOpt):
""" """

View File

@ -2,18 +2,18 @@
# --- Do not remove these libs --- # --- Do not remove these libs ---
from freqtrade.strategy.interface import IStrategy from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame from pandas import DataFrame
import pandas as pd import pandas as pd # noqa
import numpy as np # noqa
# -------------------------------- # --------------------------------
# Add your lib to import here # Add your lib to import here
import talib.abstract as ta import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib import freqtrade.vendor.qtpylib.indicators as qtpylib
import numpy as np # noqa
class {{ strategy }}(IStrategy): class {{ strategy }}(IStrategy):
""" """
This is a strategy template to get you started.. This is a strategy template to get you started.
More information in https://github.com/freqtrade/freqtrade/blob/develop/docs/bot-optimization.md More information in https://github.com/freqtrade/freqtrade/blob/develop/docs/bot-optimization.md
You can: You can:
@ -107,16 +107,15 @@ class {{ strategy }}(IStrategy):
# RSI # RSI
dataframe['rsi'] = ta.RSI(dataframe) dataframe['rsi'] = ta.RSI(dataframe)
"""
# ADX # ADX
dataframe['adx'] = ta.ADX(dataframe) dataframe['adx'] = ta.ADX(dataframe)
"""
# Awesome oscillator # Awesome oscillator
dataframe['ao'] = qtpylib.awesome_oscillator(dataframe) dataframe['ao'] = qtpylib.awesome_oscillator(dataframe)
# Commodity Channel Index: values Oversold:<-100, Overbought:>100 # Commodity Channel Index: values Oversold:<-100, Overbought:>100
dataframe['cci'] = ta.CCI(dataframe) dataframe['cci'] = ta.CCI(dataframe)
"""
# MACD # MACD
macd = ta.MACD(dataframe) macd = ta.MACD(dataframe)
dataframe['macd'] = macd['macd'] dataframe['macd'] = macd['macd']
@ -126,6 +125,7 @@ class {{ strategy }}(IStrategy):
# MFI # MFI
dataframe['mfi'] = ta.MFI(dataframe) dataframe['mfi'] = ta.MFI(dataframe)
"""
# Minus Directional Indicator / Movement # Minus Directional Indicator / Movement
dataframe['minus_dm'] = ta.MINUS_DM(dataframe) dataframe['minus_dm'] = ta.MINUS_DM(dataframe)
dataframe['minus_di'] = ta.MINUS_DI(dataframe) dataframe['minus_di'] = ta.MINUS_DI(dataframe)
@ -149,12 +149,13 @@ class {{ strategy }}(IStrategy):
stoch = ta.STOCH(dataframe) stoch = ta.STOCH(dataframe)
dataframe['slowd'] = stoch['slowd'] dataframe['slowd'] = stoch['slowd']
dataframe['slowk'] = stoch['slowk'] dataframe['slowk'] = stoch['slowk']
"""
# Stoch fast # Stoch fast
stoch_fast = ta.STOCHF(dataframe) stoch_fast = ta.STOCHF(dataframe)
dataframe['fastd'] = stoch_fast['fastd'] dataframe['fastd'] = stoch_fast['fastd']
dataframe['fastk'] = stoch_fast['fastk'] dataframe['fastk'] = stoch_fast['fastk']
"""
# Stoch RSI # Stoch RSI
stoch_rsi = ta.STOCHRSI(dataframe) stoch_rsi = ta.STOCHRSI(dataframe)
dataframe['fastd_rsi'] = stoch_rsi['fastd'] dataframe['fastd_rsi'] = stoch_rsi['fastd']
@ -178,12 +179,11 @@ class {{ strategy }}(IStrategy):
dataframe['ema50'] = ta.EMA(dataframe, timeperiod=50) dataframe['ema50'] = ta.EMA(dataframe, timeperiod=50)
dataframe['ema100'] = ta.EMA(dataframe, timeperiod=100) dataframe['ema100'] = ta.EMA(dataframe, timeperiod=100)
# SAR Parabol
dataframe['sar'] = ta.SAR(dataframe)
# SMA - Simple Moving Average # SMA - Simple Moving Average
dataframe['sma'] = ta.SMA(dataframe, timeperiod=40) dataframe['sma'] = ta.SMA(dataframe, timeperiod=40)
""" """
# SAR Parabol
dataframe['sar'] = ta.SAR(dataframe)
# TEMA - Triple Exponential Moving Average # TEMA - Triple Exponential Moving Average
dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9) dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9)

View File

@ -56,7 +56,7 @@ def test_load_strategy_base64(result, caplog, default_conf):
def test_load_strategy_invalid_directory(result, caplog, default_conf): def test_load_strategy_invalid_directory(result, caplog, default_conf):
default_conf['strategy'] = 'SampleStrategy' default_conf['strategy'] = 'DefaultStrategy'
resolver = StrategyResolver(default_conf) resolver = StrategyResolver(default_conf)
extra_dir = Path.cwd() / 'some/path' extra_dir = Path.cwd() / 'some/path'
resolver._load_strategy('DefaultStrategy', config=default_conf, extra_dir=extra_dir) resolver._load_strategy('DefaultStrategy', config=default_conf, extra_dir=extra_dir)

View File

@ -457,6 +457,8 @@ def test_create_datadir(caplog, mocker):
def test_start_new_strategy(mocker, caplog): def test_start_new_strategy(mocker, caplog):
wt_mock = mocker.patch.object(Path, "write_text", MagicMock()) wt_mock = mocker.patch.object(Path, "write_text", MagicMock())
mocker.patch.object(Path, "exists", MagicMock(return_value=False))
args = [ args = [
"new-strategy", "new-strategy",
"--strategy", "--strategy",