mirror of
https://github.com/silencesdg/mt5_python_ea_suite.git
synced 2026-08-15 11:48:12 +00:00
重构项目架构,新增 MT5 代理服务
- 重构核心模块:DataProvider 依赖注入、RiskController 门面、信号注册表 - 新增 FastAPI 代理服务 (run/server.py),支持局域网远程调用 MT5 - 新增 RemoteDataProvider + AttrDict,远端无缝替代 LiveDataProvider - 新增序列化模块,MT5 对象转 JSON 兼容格式 - 重构入口点至 run/ 包,支持 python -m run.realtime/server/backtest/optimize - 更新 CLAUDE.md 文档 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
co-authored by
Claude
Happy
parent
e8226edd96
commit
4cb4f4a15e
+7
-4
@@ -18,10 +18,13 @@ class RSIStrategy(BaseStrategy):
|
||||
|
||||
df = pd.DataFrame(rates)
|
||||
delta = df['close'].diff()
|
||||
gain = (delta.where(delta > 0, 0)).rolling(window=self.period).mean()
|
||||
loss = (-delta.where(delta < 0, 0)).rolling(window=self.period).mean()
|
||||
|
||||
rs = gain / loss
|
||||
gain = delta.where(delta > 0, 0)
|
||||
loss = -delta.where(delta < 0, 0)
|
||||
|
||||
avg_gain = gain.ewm(com=self.period - 1, min_periods=self.period).mean()
|
||||
avg_loss = loss.ewm(com=self.period - 1, min_periods=self.period).mean()
|
||||
|
||||
rs = avg_gain / avg_loss
|
||||
rsi = 100 - (100 / (1 + rs))
|
||||
|
||||
latest_rsi = rsi.iloc[-1]
|
||||
|
||||
Reference in New Issue
Block a user