Merge branch 'pair-to-strat' into wohlgemuth
This commit is contained in:
commit
584f588de1
@ -2,11 +2,11 @@
|
|||||||
IStrategy interface
|
IStrategy interface
|
||||||
This module defines the interface to apply for strategies
|
This module defines the interface to apply for strategies
|
||||||
"""
|
"""
|
||||||
from typing import Dict
|
|
||||||
from abc import ABC, abstractmethod
|
|
||||||
|
|
||||||
from pandas import DataFrame
|
|
||||||
import warnings
|
import warnings
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
|
from abc import ABC
|
||||||
|
from pandas import DataFrame
|
||||||
|
|
||||||
class IStrategy(ABC):
|
class IStrategy(ABC):
|
||||||
"""
|
"""
|
||||||
@ -28,9 +28,6 @@ class IStrategy(ABC):
|
|||||||
# associated ticker interval
|
# associated ticker interval
|
||||||
ticker_interval: str
|
ticker_interval: str
|
||||||
|
|
||||||
# configuration used, just in case the strategy want's to use it for something
|
|
||||||
config: dict = {}
|
|
||||||
|
|
||||||
def populate_indicators(self, dataframe: DataFrame) -> DataFrame:
|
def populate_indicators(self, dataframe: DataFrame) -> DataFrame:
|
||||||
"""
|
"""
|
||||||
Populate indicators that will be used in the Buy and Sell strategy
|
Populate indicators that will be used in the Buy and Sell strategy
|
||||||
@ -47,10 +44,7 @@ class IStrategy(ABC):
|
|||||||
:return: DataFrame with buy column
|
:return: DataFrame with buy column
|
||||||
"""
|
"""
|
||||||
warnings.warn("deprecated - please replace this method with advise_buy!", DeprecationWarning)
|
warnings.warn("deprecated - please replace this method with advise_buy!", DeprecationWarning)
|
||||||
dataframe.loc[
|
dataframe.loc[(), 'buy'] = 0
|
||||||
(
|
|
||||||
),
|
|
||||||
'buy'] = 0
|
|
||||||
return dataframe
|
return dataframe
|
||||||
|
|
||||||
def populate_sell_trend(self, dataframe: DataFrame) -> DataFrame:
|
def populate_sell_trend(self, dataframe: DataFrame) -> DataFrame:
|
||||||
@ -60,10 +54,7 @@ class IStrategy(ABC):
|
|||||||
:return: DataFrame with sell column
|
:return: DataFrame with sell column
|
||||||
"""
|
"""
|
||||||
warnings.warn("deprecated - please replace this method with advise_sell!", DeprecationWarning)
|
warnings.warn("deprecated - please replace this method with advise_sell!", DeprecationWarning)
|
||||||
dataframe.loc[
|
dataframe.loc[(), 'sell'] = 0
|
||||||
(
|
|
||||||
),
|
|
||||||
'sell'] = 0
|
|
||||||
return dataframe
|
return dataframe
|
||||||
|
|
||||||
def advise_indicators(self, dataframe: DataFrame, pair: str) -> DataFrame:
|
def advise_indicators(self, dataframe: DataFrame, pair: str) -> DataFrame:
|
||||||
|
@ -40,7 +40,6 @@ class StrategyResolver(object):
|
|||||||
self.strategy: IStrategy = self._load_strategy(strategy_name,
|
self.strategy: IStrategy = self._load_strategy(strategy_name,
|
||||||
extra_dir=config.get('strategy_path'))
|
extra_dir=config.get('strategy_path'))
|
||||||
|
|
||||||
self.strategy.config = config
|
|
||||||
|
|
||||||
# Set attributes
|
# Set attributes
|
||||||
# Check if we need to override configuration
|
# Check if we need to override configuration
|
||||||
|
Loading…
Reference in New Issue
Block a user