Bitcoin favicon, more strategies, default timeframe 5m
- Add an SVG Bitcoin favicon and link it in index.html. - New indicators: macd() and roc(). - Five new strategies: macd_trend, bollinger_reversion, donchian_breakout, ema_cross, momentum (plus the existing sma_cross, rsi_reversion). - Default TIMEFRAME is now 5m (config, .env.example, compose, workflow, UI).
This commit is contained in:
1 parent
186a6949ee
commit
c500fb7572
18 files changed
+488
-11
No files matched your search
@@ -5,7 +5,7 @@ from collections.abc import Sequence
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, ClassVar, Literal, Protocol
|
||||
|
||||
from app.engine.indicators import atr, ema, rolling_std, rsi, sma
|
||||
from app.engine.indicators import atr, ema, macd, roc, rolling_std, rsi, sma
|
||||
from app.models import PositionSide
|
||||
from app.schemas import Candle, ParamSpec, StrategyOut
|
||||
|
||||
@@ -106,6 +106,15 @@ class StrategyContext:
|
||||
def std(self, period: int = 20) -> float | None:
|
||||
return rolling_std(self.closes, period)[-1]
|
||||
|
||||
def macd(
|
||||
self, fast: int = 12, slow: int = 26, signal: int = 9
|
||||
) -> tuple[float | None, float | None, float | None]:
|
||||
macd_line, signal_line, histogram = macd(self.closes, fast, slow, signal)
|
||||
return macd_line[-1], signal_line[-1], histogram[-1]
|
||||
|
||||
def roc(self, period: int = 10) -> float | None:
|
||||
return roc(self.closes, period)[-1]
|
||||
|
||||
# --- order intents ------------------------------------------------
|
||||
def enter_long(
|
||||
self,
|
||||
|
||||
Reference in new issue
Block a user