feat(notify): Slack message for reconcile-booked closes (realized P&L)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was canceled

Entries, deferrals and rejections posted to #trading-bot, but exits booked by the reconcile loop (bracket stop/take-profit legs that fill at Alpaca) were silent — the two Jun 9 stop-outs produced no message. Viktor asked for a Slack message on each position execution.

- move SlackNotifier to shared/ (now used by trade-executor AND api-gateway)

- add notify_close (ticker/qty/price/realized P&L/reason, win-loss emoji)

- reconcile loop notifies on each booked close, fail-soft; api-gateway config gains slack fields (channel defaults to trading-bot since the env carries only the bot token; chat:write.public covers posting)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Viktor Barzin 2026-06-10 20:44:35 +00:00
parent c6ad39310c
commit 6fec9963fb
6 changed files with 516 additions and 25 deletions

View file

@ -21,7 +21,7 @@ from sqlalchemy.ext.asyncio import async_sessionmaker
from services.trade_executor.config import TradeExecutorConfig
from services.trade_executor.deferred_queue import DeferredSignalQueue
from services.trade_executor.risk_manager import RiskManager
from services.trade_executor.slack_notifier import SlackNotifier
from shared.slack_notifier import SlackNotifier
from shared.broker.alpaca_broker import AlpacaBroker
from shared.db import create_db
from shared.models.trading import Trade as TradeModel