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…
Об этом скилле
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_DATEFG_MARGIN_INTEREST_RATE,FG_MARGIN_INTEREST_RATE_DECIMALFG_MARGIN_JUMP_ALERT_THRESHOLDFG_CURRENT_MONTHLY_DRAW,FG_MONTH6_DRAW_TARGET,FG_MONTH12_DRAW_TARGET,FG_MONTH18_DRAW_TARGETFG_BUSINESS_INCOME_MONTHLY,FG_BUSINESS_INJECTION_RED,FG_BUSINESS_INJECTION_CRITICAL- Live facts are not
.envvalues: 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 Valuemargin_balance→ derived margin debt (gross market value minus net equity) → Margin Balancemonthly_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_debtfrom thebalancesrow - 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
Установить 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), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic