Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

margin-management

БесплатноБез исполняемых скриптовНе проверен

Monitor the margin-living strategy from the live DB snapshot. Refreshes the local database first, then reads margin balance, interest costs, dividend coverage…

AojdevStudioот AojdevStudio★ 336 звёзд на GitHub18 установок в других каталогах

Об этом скилле

Margin Management

Purpose

Monitor and manage margin-living strategy by tracking margin balances, interest costs, dividend coverage ratios, and portfolio-to-margin safety thresholds. Provides data-driven scaling recommendations based on strategy milestones.

Step 0: Refresh (sync-first, mandatory)

This skill reads margin facts from the local DB, and the DB is refreshed FIRST so it can never be stale. Follow the shared Sync-First + DB-Read pattern. Minimum for this skill (positions + balances into the balances table):

uv run python -m src.integrations.snaptrade.sync_db   # or: refresh_all

Completion criterion: the balances table carries this run's synced_at before any margin number is read.

When to Use

Use this skill when:

  • Syncing live margin balances from SnapTrade
  • Updating margin balance or interest rate
  • Calculating coverage ratio (dividends ÷ interest)
  • User mentions: "margin dashboard", "margin balance", "coverage ratio", "margin strategy"
  • Assessing margin scaling decisions
  • Checking safety thresholds

Personal Strategy Inputs

Static private assumptions come from .env (see .env.example). Current portfolio facts come from the local DB balances snapshot (refreshed sync-first in Step 0), then src/analysis/margin_metrics.py derives ratios/costs at runtime. Do not hardcode personal numbers in this skill. Fallbacks: --source snaptrade reads the API live, --source csv reads the legacy Fidelity balances CSV.

Required .env values

  • FG_STRATEGY_START_DATE
  • FG_MARGIN_INTEREST_RATE, FG_MARGIN_INTEREST_RATE_DECIMAL
  • FG_MARGIN_JUMP_ALERT_THRESHOLD
  • FG_CURRENT_MONTHLY_DRAW, FG_MONTH6_DRAW_TARGET, FG_MONTH12_DRAW_TARGET, FG_MONTH18_DRAW_TARGET
  • FG_BUSINESS_INCOME_MONTHLY, FG_BUSINESS_INJECTION_RED, FG_BUSINESS_INJECTION_CRITICAL
  • Live facts are not .env values: portfolio value, margin balance, interest cost, dividend income, coverage ratio, and portfolio-to-margin ratio must be read/calculated at runtime.

Core Workflow

1. Read Margin Balances (local DB snapshot)

After Step 0's refresh, run uv run python -m src.analysis.margin_metrics --pretty. It loads .env, reads the latest balances row from family_office.db (the db source is the default), and emits current JSON metrics. Fallbacks if needed: --source snaptrade (live API) or --source csv (latest Balances_for_Account_*.csv).

Source: the balances table, written by the Step 0 sync from the enabled+routed SnapTrade account in config/snaptrade-accounts.yaml (enabled: true, role set). Requires SNAPTRADE_* keys in .env for the refresh.

Key JSON fields the tool emits:

  • portfolio_value → net account equity (account_equity) → Portfolio Value
  • margin_balance → derived margin debt (gross market value minus net equity) → Margin Balance
  • monthly_interest_cost → Balance × Rate ÷ 12 (the primary interest figure)
  • margin_interest_accrued_this_month → null on the DB and SnapTrade paths (the broker does not expose accrued interest; it is only present via --source csv)

Calculations:

  • Margin Balance: Derived margin debt = {live.margin_balance} (tracks Fidelity "Net debit" within ~0.1%)
  • Interest Rate: Default ${FG_MARGIN_INTEREST_RATE} (Fidelity $1k-$24.9k tier) unless specified
  • Monthly Interest Cost: Balance × Rate ÷ 12 = {live.margin_balance} × ${FG_MARGIN_INTEREST_RATE_DECIMAL} ÷ 12 = {derived.monthly_interest_cost}

2. Safety Check: Margin Jump Alert

Rule: If new margin balance > previous balance + ${FG_MARGIN_JUMP_ALERT_THRESHOLD}, STOP

Reason: Large draws should be intentional per margin-living strategy

Example:

Previous: {live.margin_balance}
Current: {example.margin_current} (+{derived.margin_increase}) → 🚨 ALERT - Confirm intentional draw

Action:

  • Alert user immediately
  • Show diff: "Margin increased by {derived.margin_increase} - Confirm this was intentional"
  • Wait for user confirmation before proceeding

3. Report the current snapshot

There is nowhere to write an entry: balances is a current-state table keyed on account_id, so each sync overwrites the prior row and no ledger accumulates. Report the snapshot in the response instead.

  • Date: current date (use date +"%Y-%m-%d")
  • Margin Balance: margin_debt from the balances row
  • Interest Rate: ${FG_MARGIN_INTEREST_RATE}
  • Monthly Interest Cost: Balance × Rate ÷ 12
  • Elapsed: months since ${FG_STRATEGY_START_DATE}, which selects the scaling tier below

4. Derived metrics

Monthly Interest Cost

margin_debt × ${FG_MARGIN_INTEREST_RATE} ÷ 12

Annual Interest Cost

monthly_interest_cost × 12

Dividend Income

Quote monthly_dividend_income from margin_metrics_cli with its dividend_income source and calendar window. The ledger fallback uses the routed taxable-margin account's three closed months of USD divi

Полный SKILL.md на GitHub

Установить margin-management в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл margin-management?

Monitor the margin-living strategy from the live DB snapshot. Refreshes the local database first, then reads margin balance, interest costs, dividend coverage ratio, and portfolio-to-margin thresholds. Triggers safety alerts for large draws and gives time-based scaling recommendations. Use when updating margin, balances, coverage ratio, or margin strategy analysis.

Как установить скилл margin-management?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл margin-management запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить margin-management с