Add trend MACD spot strategy
This commit is contained in:
+19
-3
@@ -141,6 +141,7 @@ class CryptoSpotBot:
|
||||
self._entry_cooldown_until.pop(symbol, None)
|
||||
ticker = self.market.tickers.get(symbol)
|
||||
candles = self.market.candles.get(symbol, [])
|
||||
trend_candles = self.market.trend_candles.get(symbol, [])
|
||||
open_count = len(self.broker.positions_for_symbol(symbol))
|
||||
pattern = self.market.patterns.get(symbol, {})
|
||||
forecast = self.market.forecasts.get(symbol, {})
|
||||
@@ -166,7 +167,18 @@ class CryptoSpotBot:
|
||||
account=account,
|
||||
)
|
||||
).as_dict()
|
||||
signal = self.strategy.entry_signal(symbol, candles, ticker, open_count, pattern, learning, llm, forecast, account)
|
||||
signal = self.strategy.entry_signal(
|
||||
symbol,
|
||||
candles,
|
||||
ticker,
|
||||
open_count,
|
||||
pattern,
|
||||
learning,
|
||||
llm,
|
||||
forecast,
|
||||
account,
|
||||
trend_candles,
|
||||
)
|
||||
self.storage.insert_signal(signal)
|
||||
if signal.action == "BUY" and ticker is not None:
|
||||
self.broker.buy(
|
||||
@@ -204,7 +216,7 @@ class CryptoSpotBot:
|
||||
return worst.id
|
||||
|
||||
def _update_patterns(self) -> None:
|
||||
if not self.settings.pattern_analysis_enabled:
|
||||
if self.settings.strategy_mode == "trend_macd" or not self.settings.pattern_analysis_enabled:
|
||||
self.market.patterns = {}
|
||||
return
|
||||
patterns: dict[str, dict] = {}
|
||||
@@ -217,7 +229,11 @@ class CryptoSpotBot:
|
||||
self.market.patterns = patterns
|
||||
|
||||
def _update_forecasts(self) -> None:
|
||||
if self.forecaster is None or not self.settings.time_series_forecast_enabled:
|
||||
if (
|
||||
self.settings.strategy_mode == "trend_macd"
|
||||
or self.forecaster is None
|
||||
or not self.settings.time_series_forecast_enabled
|
||||
):
|
||||
self.market.forecasts = {}
|
||||
return
|
||||
forecasts: dict[str, dict] = {}
|
||||
|
||||
Reference in New Issue
Block a user