Update numpy imports in sample strategies

This commit is contained in:
Matthias 2019-11-02 15:34:09 +01:00
parent 8c2ff2f46e
commit 8a1d02e185
2 changed files with 6 additions and 5 deletions

View File

@ -2,15 +2,15 @@
# --- 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
# -------------------------------- # --------------------------------
# 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 # noqa import numpy as np # noqa
# This class is a sample. Feel free to customize it.
class {{ strategy }}(IStrategy): class {{ strategy }}(IStrategy):
""" """
This is a strategy template to get you started.. This is a strategy template to get you started..
@ -140,7 +140,7 @@ class {{ strategy }}(IStrategy):
# Inverse Fisher transform on RSI, values [-1.0, 1.0] (https://goo.gl/2JGGoy) # Inverse Fisher transform on RSI, values [-1.0, 1.0] (https://goo.gl/2JGGoy)
rsi = 0.1 * (dataframe['rsi'] - 50) rsi = 0.1 * (dataframe['rsi'] - 50)
dataframe['fisher_rsi'] = (numpy.exp(2 * rsi) - 1) / (numpy.exp(2 * rsi) + 1) dataframe['fisher_rsi'] = (np.exp(2 * rsi) - 1) / (np.exp(2 * rsi) + 1)
# Inverse Fisher transform on RSI normalized, value [0.0, 100.0] (https://goo.gl/2JGGoy) # Inverse Fisher transform on RSI normalized, value [0.0, 100.0] (https://goo.gl/2JGGoy)
dataframe['fisher_rsi_norma'] = 50 * (dataframe['fisher_rsi'] + 1) dataframe['fisher_rsi_norma'] = 50 * (dataframe['fisher_rsi'] + 1)

View File

@ -7,7 +7,8 @@ from pandas import DataFrame
# 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 # noqa import pandas as pd # noqa
import numpy as np # noqa
# This class is a sample. Feel free to customize it. # This class is a sample. Feel free to customize it.
@ -147,7 +148,7 @@ class SampleStrategy(IStrategy):
# Inverse Fisher transform on RSI, values [-1.0, 1.0] (https://goo.gl/2JGGoy) # Inverse Fisher transform on RSI, values [-1.0, 1.0] (https://goo.gl/2JGGoy)
rsi = 0.1 * (dataframe['rsi'] - 50) rsi = 0.1 * (dataframe['rsi'] - 50)
dataframe['fisher_rsi'] = (numpy.exp(2 * rsi) - 1) / (numpy.exp(2 * rsi) + 1) dataframe['fisher_rsi'] = (np.exp(2 * rsi) - 1) / (np.exp(2 * rsi) + 1)
# Inverse Fisher transform on RSI normalized, value [0.0, 100.0] (https://goo.gl/2JGGoy) # Inverse Fisher transform on RSI normalized, value [0.0, 100.0] (https://goo.gl/2JGGoy)
dataframe['fisher_rsi_norma'] = 50 * (dataframe['fisher_rsi'] + 1) dataframe['fisher_rsi_norma'] = 50 * (dataframe['fisher_rsi'] + 1)