fixes, old way to handle strategies
This commit is contained in:
@ -6,8 +6,10 @@ class SingleSmaStrategy(BaseStrategy):
|
||||
"""
|
||||
A strategy based on the price crossing a single Simple Moving Average (SMA).
|
||||
"""
|
||||
def __init__(self, strategy_name: str, params: dict):
|
||||
super().__init__(strategy_name, params)
|
||||
# --- FIX: Added trade_signal_queue to the constructor ---
|
||||
def __init__(self, strategy_name: str, params: dict, trade_signal_queue):
|
||||
# --- FIX: Passed trade_signal_queue to the parent class ---
|
||||
super().__init__(strategy_name, params, trade_signal_queue)
|
||||
self.sma_period = self.params.get('sma_period', 0)
|
||||
|
||||
def calculate_signals(self, df: pd.DataFrame) -> pd.DataFrame:
|
||||
@ -23,4 +25,3 @@ class SingleSmaStrategy(BaseStrategy):
|
||||
df.loc[df['close'] < df['sma'], 'signal'] = -1
|
||||
|
||||
return df
|
||||
|
||||
|
||||
Reference in New Issue
Block a user