Fix HybridExample formatting
This commit is contained in:
parent
64b0834437
commit
6189aa817c
@ -1,13 +1,13 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import talib.abstract as ta
|
import talib.abstract as ta
|
||||||
from freqtrade.strategy import (DecimalParameter, IntParameter, IStrategy,
|
|
||||||
merge_informative_pair)
|
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
|
||||||
|
from freqtrade.strategy import IntParameter, IStrategy, merge_informative_pair
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ class FreqaiExampleHybridStrategy(IStrategy):
|
|||||||
sell_p2 = IntParameter(7, 21, default=10)
|
sell_p2 = IntParameter(7, 21, default=10)
|
||||||
sell_p3 = IntParameter(7, 21, default=10)
|
sell_p3 = IntParameter(7, 21, default=10)
|
||||||
|
|
||||||
# FreqAI required function, leave as is or add you additional informatives to existing structure.
|
# FreqAI required function, leave as is or add additional informatives to existing structure.
|
||||||
def informative_pairs(self):
|
def informative_pairs(self):
|
||||||
whitelist_pairs = self.dp.current_whitelist()
|
whitelist_pairs = self.dp.current_whitelist()
|
||||||
corr_pairs = self.config["freqai"]["feature_parameters"]["include_corr_pairlist"]
|
corr_pairs = self.config["freqai"]["feature_parameters"]["include_corr_pairlist"]
|
||||||
@ -177,6 +177,7 @@ class FreqaiExampleHybridStrategy(IStrategy):
|
|||||||
|
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
# flake8: noqa: C901
|
||||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||||
|
|
||||||
# User creates their own custom strat here. Present example is a supertrend
|
# User creates their own custom strat here. Present example is a supertrend
|
||||||
@ -280,12 +281,6 @@ class FreqaiExampleHybridStrategy(IStrategy):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def leverage(self, pair: str, current_time: datetime, current_rate: float,
|
|
||||||
proposed_leverage: float, max_leverage: float, entry_tag: Optional[str], side: str,
|
|
||||||
**kwargs) -> float:
|
|
||||||
|
|
||||||
return 1
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Supertrend Indicator; adapted for freqtrade, optimized by the math genius.
|
Supertrend Indicator; adapted for freqtrade, optimized by the math genius.
|
||||||
from: Perkmeister#2394
|
from: Perkmeister#2394
|
||||||
@ -312,10 +307,10 @@ class FreqaiExampleHybridStrategy(IStrategy):
|
|||||||
|
|
||||||
# Compute final upper and lower bands
|
# Compute final upper and lower bands
|
||||||
for i in range(period, last_row + 1):
|
for i in range(period, last_row + 1):
|
||||||
FINAL_UB[i] = BASIC_UB[i] if BASIC_UB[i] < FINAL_UB[i -
|
FINAL_UB[i] = (BASIC_UB[i] if BASIC_UB[i] < FINAL_UB[i - 1]
|
||||||
1] or CLOSE[i - 1] > FINAL_UB[i - 1] else FINAL_UB[i - 1]
|
or CLOSE[i - 1] > FINAL_UB[i - 1] else FINAL_UB[i - 1])
|
||||||
FINAL_LB[i] = BASIC_LB[i] if BASIC_LB[i] > FINAL_LB[i -
|
FINAL_LB[i] = (BASIC_LB[i] if BASIC_LB[i] > FINAL_LB[i - 1]
|
||||||
1] or CLOSE[i - 1] < FINAL_LB[i - 1] else FINAL_LB[i - 1]
|
or CLOSE[i - 1] < FINAL_LB[i - 1] else FINAL_LB[i - 1])
|
||||||
|
|
||||||
# Set the Supertrend value
|
# Set the Supertrend value
|
||||||
for i in range(period, last_row + 1):
|
for i in range(period, last_row + 1):
|
||||||
|
Loading…
Reference in New Issue
Block a user