🔔 Notifier Expert Skill (Project Specific)
Fire-and-Forget (Background Tasks):
- Notifications should not delay the return of an API response.
- Use
asyncio.create_task()to send alerts in the background.
Rich Formatting:
- Use Embeds for trade signals (Green for Buy, Red for Sell).
- Include critical context: Time, Symbol, Price, Strategy Name.
Error Handling:
- If Discord is down, log the error and continue operation.
- Do not let a failed notification crash the trading bot.
import aiohttp import logging import asyncio
logger = logging.getLogger(name)
class AsyncDiscordNotifier: def init(self, webhook_url: str): self.webhook_url = webhook_url
async def send(self, content: str, embed: dict = None):
if not self.webhook_url:
return
payload = {"content": content, "embeds": [embed] if embed else []}
# Don't wait for response, just fire
asyncio.create_task(self._post(payload))
async def _post(self, payload: dict):
try:
async with aiohttp.ClientSession() as session:
async with session.post(self.webhook_url, json=payload) as resp:
if resp.status >= 400:
logger.error(f"Discord Value Error: {resp.status}")
except Exception as e:
logger.error(f"Discord Network Error: {e}")
</implementation_guide>
---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/dldnwls07) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-15 -->