feat: ATR adaptive trailing stop and 2-decimal formatting

- monitor.py: replace fixed 1.5% stop with ATR-based adaptive stop
  recent 5x 1h candles avg range × 1.5 mult, clamped 1.0%~4.0%
  10min cache per ticker to minimize API calls
  all log numbers formatted to 2 decimal places
- notify.py: apply 2 decimal places to price, P&L, fee, cum_profit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
joungmin
2026-03-01 10:32:24 +09:00
parent 83a229dd26
commit b0f0b3e82a
2 changed files with 74 additions and 34 deletions

View File

@@ -38,9 +38,9 @@ def notify_buy(
)
_send(
f"📈 <b>[매수]</b> {ticker}\n"
f"가격: {price:,.0f}\n"
f"수량: {amount}\n"
f"투자금: {invested_krw:,}\n"
f"가격: {price:,.2f}\n"
f"수량: {amount:.8f}\n"
f"투자금: {invested_krw:,.2f}\n"
f"{budget_line}"
)
@@ -54,10 +54,10 @@ def notify_sell(
cum_emoji = "💚" if cum_profit >= 0 else "🔴"
_send(
f"{trade_emoji} <b>[매도]</b> {ticker}\n"
f"가격: {price:,.0f}\n"
f"가격: {price:,.2f}\n"
f"수익률: {pnl_pct:+.2f}%\n"
f"실손익: {krw_profit:+,.0f}원 (수수료 {fee_krw:,.0f}원)\n"
f"{cum_emoji} 누적손익: {cum_profit:+,.0f}\n"
f"실손익: {krw_profit:+,.2f}원 (수수료 {fee_krw:,.2f}원)\n"
f"{cum_emoji} 누적손익: {cum_profit:+,.2f}\n"
f"사유: {reason}"
)
@@ -120,9 +120,9 @@ def notify_status(
emoji = "📈" if pnl >= 0 else "📉"
lines.append(
f"{emoji} <b>{ticker}</b>\n"
f" 현재가: {current:,.0f}\n"
f" 현재가: {current:,.2f}\n"
f" 수익률: {pnl:+.2f}%\n"
f" 최고가 대비: -{drop:.1f}%\n"
f" 보유: {elapsed:.1f}h"
f" 최고가 대비: -{drop:.2f}%\n"
f" 보유: {elapsed:.2f}h"
)
_send("\n".join(lines))