revised code

This commit is contained in:
Gert Wohlgemuth 2018-06-15 09:59:34 -07:00
parent 179b10e6e7
commit 77e46ebc56
2 changed files with 6 additions and 16 deletions

View File

@ -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):
@ -29,9 +29,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
@ -48,10 +45,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:
@ -61,10 +55,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:

View File

@ -35,7 +35,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