-
Notifications
You must be signed in to change notification settings - Fork 3
/
FreqSignalsFollower.py
57 lines (43 loc) · 1.56 KB
/
FreqSignalsFollower.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import os
from pandas import DataFrame
from freqsignals import FreqSignalsStrategy
DATA_SET_ID = os.environ.get("FREQSIGNALS_DATA_SET_ID")
class FreqSignalsFollower(FreqSignalsStrategy):
freqsignals_data_set_names = {
# Mapping of a data set id to the name of the feature / column
DATA_SET_ID: "fs_signal"
}
minimal_roi = {
"0": 0.05
}
stoploss = -0.03
timeframe = '1m'
plot_config = {
"main_plot": {},
"subplots": {
"Signals": {
"fs_signal": {},
"fs_signal_last_move": {}
}
}
}
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# Set a default for if it's not found
dataframe['fs_signal'] = None
self.freqsignals_load_signal_history(metadata['pair'], DATA_SET_ID)
dataframe = self.freqsignals_add_pair_signals(dataframe, metadata['pair'], include_context=True)
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[(
(dataframe['fs_signal'] >= 0.01) &
(dataframe['volume'] > 0)
),
['enter_long', 'enter_tag']] = (1, 'bullish_signal')
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[(
(dataframe['fs_signal'] <= -0.01) &
(dataframe['volume'] > 0)
),
['exit_long', 'exit_tag']] = (1, 'bearish_signal')
return dataframe