Λογότυπο Broker Margin Interest Accrual Tracking

Broker Margin Interest Accrual Tracking

Κοινότητα
HimanshuJ16
broker-margin-interest-accrual-tracking

Χρησιμοποιήστε το όταν υπολογίζετε το καθαρό P&L για χαρτοφυλάκιο με μόχλευση ή θέσεις short: κλιμακωτά συνδυασμένα επιτόκια δανεισμού περιθωρίου, χρεώσεις δανεισμού για short με βάση την αξία των εξασφαλίσεων, υπολογισμό ημερών με βάση 360 ή 365 ημέρες και δεδουλευμένους τόκους ανά ημερολογιακή ημέρα, ακόμη και τα σαββατοκύριακα και τις αργίες.

Επισκόπηση

ΕκδότηςHimanshuJ16
ΑποθετήριοAlgo-Trading-Skills
Όνομα δεξιότηταςbroker-margin-interest-accrual-tracking
Αστέρια
50
Διακλαδώσεις
7
Συνοδευτικά αρχεία
5
Άδεια χρήσηςApache-2.0
Σύνδεσμοι
  • Οδηγίες σε Markdown

    Ένα αρχείο SKILL.md που το μοντέλο φορτώνει όταν χρειάζεται, ώστε να καταναλώνει token μόνο όταν ένα αίτημα είναι πράγματι σχετικό.

  • Λειτουργεί με οποιοδήποτε LLM

    Οι δεξιότητες AI είναι απλό Markdown, όχι κώδικας για συγκεκριμένο πάροχο, επομένως αυτή η δεξιότητα λειτουργεί με GPT, Claude, Gemini, Grok ή ένα τοπικό μοντέλο.

  • Συνοδευτικά αρχεία: 5

    Αρχεία script, πρότυπα και υλικό αναφοράς που μπορεί να διαβάζει το μοντέλο καθώς εργάζεται. Τα αρχεία είναι μόνο για ανάγνωση και δεν εκτελούνται ποτέ.

  • Ανοιχτού κώδικα

    Δημοσιεύτηκε στο GitHub από τον λογαριασμό HimanshuJ16. Ελέγξτε τα αρχεία της δεξιότητας στο αποθετήριο πριν την εγκαταστήσετε.

Εγκατάσταση

Εγκαταστήστε τη δεξιότητα AI Broker Margin Interest Accrual Tracking στο TypingMind για να τη χρησιμοποιείτε με οποιοδήποτε LLM ή προσθέστε τη σε άλλον πράκτορα AI που διαβάζει αρχεία SKILL.md.

1

Εγκατάσταση στο TypingMind

Το TypingMind εγκαθιστά μια δεξιότητα απευθείας από τον φάκελό της στο GitHub — διαβάζει το SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία σε πακέτο και αποθηκεύει το αποτέλεσμα τοπικά.

  1. Ανοίξτε την εφαρμογή και μεταβείτε στα Πρόσθετα → Δεξιότητες.
  2. Επιλέξτε «Εγκατάσταση από GitHub».
  3. Επικολλήστε το παρακάτω URL του φακέλου της δεξιότητας και επιβεβαιώστε.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/broker-margin-interest-accrual-tracking
  4. Ενεργοποιήστε τη δεξιότητα σε κάθε συνομιλία όπου θέλετε να είναι διαθέσιμη.
Πρόσθετα → Δεξιότητες → Προσθήκη δεξιότητας → Από URL του GitHub, έπειτα επικολλήστε το URL του φακέλου και πατήστε «Συνέχεια».
2

Εγκατάσταση σε άλλον πράκτορα AI

Κάθε πράκτορας AI που υποστηρίζει τη μορφή Agent Skills μπορεί να χρησιμοποιήσει αυτή τη δεξιότητα — αντιγράψτε τον φάκελο στον κατάλογο δεξιοτήτων του.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HimanshuJ16/Algo-Trading-Skills.git /tmp/Algo-Trading-Skills
mkdir -p .claude/skills
cp -r /tmp/Algo-Trading-Skills/skills/broker-margin-interest-accrual-tracking .claude/skills/broker-margin-interest-accrual-tracking
Επανεκκινήστε το Claude Code μετά την αντιγραφή, ώστε να εντοπίσει τη νέα δεξιότητα.

Χρησιμοποιήστε τη στο TypingMind

Ενεργοποιήστε τη δεξιότητα Broker Margin Interest Accrual Tracking σε οποιαδήποτε συνομιλία στο TypingMind και το μοντέλο αναλαμβάνει τα υπόλοιπα. Το όνομα και η περιγραφή της περιλαμβάνονται στην προτροπή συστήματος και, μόλις προκύψει ένα σχετικό αίτημα, το μοντέλο φορτώνει μόνο του τις πλήρεις οδηγίες — δεν χρειάζεται ποτέ να την καλείτε χειροκίνητα και δεν καταναλώνει token μέχρι να χρησιμοποιηθεί πραγματικά.

Το μοντέλο φορτώνει αυτόματα τη δεξιότητα Broker Margin Interest Accrual Tracking μόλις λάβει ένα σχετικό αίτημα.

Λειτουργεί με οποιοδήποτε μοντέλο AI

Οι δεξιότητες AI είναι οδηγίες σε απλό κείμενο Markdown και όχι κώδικας για συγκεκριμένο πάροχο, οπότε η δεξιότητα Broker Margin Interest Accrual Tracking δεν περιορίζεται στο μοντέλο για το οποίο γράφτηκε. Εγκαταστήστε τη μία φορά στο TypingMind και χρησιμοποιήστε τη με GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ή ένα τοπικό μοντέλο που εκτελείτε εσείς — πάντα με τα δικά σας κλειδιά API.

  • Φόρτωση μόνο όταν χρειάζεται

    Η προτροπή συστήματος περιλαμβάνει μόνο το όνομα και την περιγραφή. Οι οδηγίες ανακτώνται με το πρώτο σχετικό αίτημα, οπότε μια δεξιότητα που δεν χρησιμοποιείται δεν έχει κόστος.

  • Αλλάξτε μοντέλο κατά τη διάρκεια της συνομιλίας

    Επειδή η δεξιότητα αποτελείται από οδηγίες και όχι από κώδικα, η αλλαγή μοντέλου δεν επηρεάζει τη λειτουργία της — το επόμενο μοντέλο διαβάζει το ίδιο αρχείο SKILL.md.

Οδηγίες δεξιότητας

Αυτό είναι το περιεχόμενο του αρχείου SKILL.md που φορτώνει το μοντέλο. Διαβάστε το πριν από την εγκατάσταση — μια δεξιότητα αποτελείται από οδηγίες που θα ακολουθήσει το μοντέλο σας.

When to Use

Invoke this skill when computing net P&L for a strategy that borrows — one that runs leverage, carries positions overnight, or sells short. Backtests that ignore financing overstate returns and Sharpe by the entire cost of the leverage that produced them, and the overstatement scales with the benchmark rate: a book carrying a permanent debit at a 5% margin rate gives up 5% a year before it makes a single trading decision.

Use it to answer three questions with numbers rather than estimates: what does the debit balance cost under the broker's tiered schedule, what does the borrow cost on the short book, and what does gross P&L become once both are subtracted.

When NOT to Use

  • As a substitute for the broker's own interest statement. This computes an accrual from balances you supply. Reconcile it against the monthly posting before trusting it; a systematic gap usually means the collateral basis or the day-count is wrong.
  • To model multi-year compounding. Brokers accrue daily and post monthly (IBKR on the third business day of the following month), so interest starts earning interest only once posted. This module sums simple daily charges over the window. Negligible over weeks, material over years at high rates.
  • To get the net cost of a short. It reports the gross borrow fee. The economic cost is the fee less the rebate earned on short sale proceeds, which this does not model — so its short-side number is an upper bound, and for general-collateral names a loose one.
  • For intraday leverage. Only end-of-day balances accrue overnight financing. A position opened and closed inside the session contributes nothing here.
  • As a live rate source. Broker tiers are quoted as a spread over a benchmark and reprice with monetary policy. The bundled defaults are a dated illustration.

Prerequisites

  • Your broker's current margin schedule. IBKR publishes tiers as benchmark + spread (Fed Funds for USD), so absolute APRs drift — pull today's table, or build one with tiers_from_benchmark(benchmark_apr, spreads).
  • The correct day-count for the financing currency: 360 for USD and most currencies at IBKR, 365 for exceptions such as GBP.
  • Per-security short borrow rates, which are re-struck daily and can move hundreds of basis points overnight.
  • End-of-day debit balance and gross short market value per date — not an average.
  • The exchange holiday calendar, if you want the ledger's accrual blocks to line up with settlement days.

Workflow

  1. Configure the schedule, and let it reject bad input. Build tiers with tiers_from_benchmark or explicit MarginRateTier values. The constructor validates that brackets start at zero, are contiguous, and that the top tier is open-ended. That last check is not pedantry: a schedule capped at $100k silently prices everything above the cap at 0%, so a $200k balance reports 2.5% instead of 5% — half the true cost, with no error.

  2. Feed dates, not day counts. Call accrue_daily_balances(balances, through_date) with one EodBalance per observation. It derives the day count from the dates, so it cannot be handed a trading-day count by mistake. Use the scalar calculate_interest_accrual(start_date, holding_days, ...) only for a constant balance, and read holding_days as calendar days.

  3. Know why weekends cost three days. Not because settlement is slow — because the balance still exists on Saturday and Sunday and interest is computed on the daily balance. The consequence is the part people get wrong in both directions: the total depends only on the number of calendar days in the window. Batching Sat/Sun into Friday's ledger row changes granularity, never the total. Applying a weekend multiplier on top of a calendar-day count double-charges; feeding a trading-day count under-charges by roughly 2/7.

  4. Register holidays for ledger alignment, not for extra cost. add_holidays() makes the Friday before a holiday Monday carry one four-day block rather than a three-day block plus a row dated on a day the market was shut. The total is identical either way; what changes is whether the ledger reconciles line-by-line against the broker's.

  5. Charge the borrow fee on collateral, not market value. IBKR computes it as value x rate / 360 where value is 102% of the prior day's settlement price, rounded up to the next whole dollar, times shares. Set short_collateral_markup=1.02 to approximate it, or pass an exactly computed EodBalance.short_collateral_usd to match a statement. The default of 1.0 charges on raw market value and understates.

  6. Subtract both from gross P&L. adjusted_net_pnl_usd is gross less margin interest less borrow fees. Report it alongside gross, never instead of it — the gap between the two is the number that tells you whether the leverage was worth carrying.

Full procedure: see references/workflows.md. Sourced day-count, collateral and settlement conventions: see references/standards.md. Printable pre-flight checklist: see assets/checklist.md.

Common Pitfalls

  • Counting trading days. A position held from Monday's close to the following Monday's close costs seven days of financing, not five. Over a year of continuous carry this understates the cost by roughly 30% — about 2/7 for a weekday count, more once holidays are dropped as well.
  • Double-counting the weekend. The mirror-image error: taking a correct calendar-day count and then multiplying Fridays by three. Weekend batching is presentation.
  • Assuming the lowest tier's rate applies to the whole balance. Blended schedules price each slice in its own bracket, so the effective rate falls as the balance grows — and a flat-rate assumption misprices in whichever direction the schedule bends.
  • A tier schedule with a capped top bracket. Anything above the cap is priced at zero, and the shortfall grows with the size of the loan. This now raises RateScheduleError rather than returning a plausible-looking number.
  • Using 365 where the broker uses 360. It understates the charge by ~1.4% — small per day, systematic forever, and it will never reconcile against a statement.
  • Charging borrow on market value. Collateral is marked at 102% and rounded up, so the fee is at least 2% higher than a market-value calculation suggests.
  • Netting a credit cash balance against borrow fees. A credit balance earns interest under a separate, tiered, threshold-gated schedule this module does not model; treating it as negative margin interest invents income.
  • Letting NaN through. A single NaN balance turns net P&L into NaN silently, and a financing cost that defaults to zero is indistinguishable from an unlevered strategy — it flatters every metric derived from it. Unusable input raises FinancingDataError.
  • Hard-coding last year's APRs. Rates are benchmark-linked; a schedule copied from a 2023 screenshot was roughly 170bp too high by 2026.
  • Conflating borrow fees with margin interest. Shorting incurs a borrow fee on the short market value and, if the account's cash goes into deficit, margin interest on that deficit. They are separate charges with separate bases.

Verification

  • Run the unit suite and confirm every test passes: python -m unittest discover -s skills/broker-margin-interest-accrual-tracking/scripts
  • Accrue a constant $100k debit at 5% from a Monday for 7 calendar days and confirm $97.22 (100000 * 0.05 / 360 * 7), with the Friday row carrying days_accrued == 3.
  • Run the same balance for 14 days starting on a Monday and on a Friday and confirm the totals are identical — if they differ, weekend handling is double-counting.
  • Register a holiday Monday and confirm the preceding Friday yields a single four-day block and no accrual row is dated on the holiday.
  • Construct a tracker whose top tier is finite and confirm RateScheduleError; pass NaN as a balance and confirm FinancingDataError. A number coming back from either is a fail-open bug.
  • Feed a two-day schedule of $50k then $200k and confirm the effective APR is recomputed per day (5% then 4.5%) rather than averaged.
  • Reconcile a month of output against the broker's posted interest before relying on it.

Related Skills

  • short-selling-borrow-cost-and-availability-modeling
  • broker-account-margin-call-handling
  • multi-currency-pnl-and-fx-conversion
  • backtesting-ml-models-against-transaction-costs
  • execution-realistic-simulation

Συνοδευτικά αρχεία

Το μοντέλο τα διαβάζει όποτε χρειάζεται, όσο η δεξιότητα είναι φορτωμένη. Διατίθενται ως αρχεία για ανάγνωση και δεν εκτελούνται ποτέ.

Συχνές ερωτήσεις

Τι κάνει η δεξιότητα AI Broker Margin Interest Accrual Tracking;

Χρησιμοποιήστε το όταν υπολογίζετε το καθαρό P&L για χαρτοφυλάκιο με μόχλευση ή θέσεις short: κλιμακωτά συνδυασμένα επιτόκια δανεισμού περιθωρίου, χρεώσεις δανεισμού για short με βάση την αξία των εξασφαλίσεων, υπολογισμό ημερών με βάση 360 ή 365 ημέρες και δεδουλευμένους τόκους ανά ημερολογιακή ημέρα, ακόμη και τα σαββατοκύριακα και τις αργίες.

Γιατί να χρησιμοποιήσετε τη δεξιότητα Broker Margin Interest Accrual Tracking στο TypingMind;

Επειδή την εγκαθιστάτε μία φορά και τη χρησιμοποιείτε με οποιοδήποτε μοντέλο. Η Broker Margin Interest Accrual Tracking είναι απλό Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως η ίδια δεξιότητα λειτουργεί με GPT-5, Claude, Gemini, Grok ή ένα τοπικό μοντέλο — και μπορείτε να αλλάξετε μοντέλο κατά τη διάρκεια της συνομιλίας χωρίς να διακοπεί η λειτουργία της. Το TypingMind λειτουργεί με τα δικά σας κλειδιά API, οπότε πληρώνετε απευθείας τους παρόχους αντί για συνδρομή ανά θέση χρήστη, ενώ οι δεξιότητες και οι συνομιλίες σας παραμένουν στον δικό σας χώρο αποθήκευσης.

Πώς εγκαθιστώ τη δεξιότητα Broker Margin Interest Accrual Tracking στο TypingMind;

Στο TypingMind, ανοίξτε Πρόσθετα → Δεξιότητες → Εγκατάσταση από το GitHub και επικολλήστε τη διεύθυνση https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/broker-margin-interest-accrual-tracking. Το TypingMind διαβάζει το αρχείο SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία και εγκαθιστά τη δεξιότητα, την οποία μπορείτε να ενεργοποιείτε ανά συνομιλία.

Ποια μοντέλα AI μπορούν να χρησιμοποιήσουν τη δεξιότητα Broker Margin Interest Accrual Tracking;

Οποιοδήποτε μοντέλο συνδέετε στο TypingMind. Οι δεξιότητες AI είναι απλές οδηγίες Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως τα GPT, Claude, Gemini, Grok και τα τοπικά μοντέλα μπορούν όλα να φορτώσουν αυτή τη δεξιότητα όταν ένα αίτημα αντιστοιχεί σε αυτή.

Με πόσα μοντέλα AI μπορώ να χρησιμοποιήσω τη δεξιότητα Broker Margin Interest Accrual Tracking;

Με όσα θέλετε. Στο TypingMind μπορείτε να χρησιμοποιήσετε τη δεξιότητα Broker Margin Interest Accrual Tracking με οποιοδήποτε μοντέλο υποστηρίζει δεξιότητες, όπως τα GPT, Claude, Gemini, Grok, DeepSeek, Mistral και Llama, χρησιμοποιώντας τα δικά σας κλειδιά API.

Είναι δωρεάν η δεξιότητα AI Broker Margin Interest Accrual Tracking;

Ναι. Δημοσιεύεται στο GitHub από τον λογαριασμό HimanshuJ16 με την άδεια χρήσης Apache-2.0. Πληρώνετε μόνο τον δικό σας πάροχο AI για τα token που χρησιμοποιείτε.

Τι είναι οι δεξιότητες AI;

Μια δεξιότητα AI είναι ένα επαναχρησιμοποιήσιμο πακέτο οδηγιών που διδάσκει σε ένα μοντέλο AI πώς να εκτελεί μια συγκεκριμένη εργασία. Ακολουθεί την ανοιχτή μορφή Agent Skills: ένα αρχείο SKILL.md με όνομα και περιγραφή, μαζί με τυχόν σενάρια κώδικα, πρότυπα ή αρχεία αναφοράς που μπορεί να χρειαστεί το μοντέλο. Το μοντέλο διαβάζει τις οδηγίες μόνο όταν το αίτημά σας αντιστοιχεί στη δεξιότητα, οπότε μια εγκατεστημένη δεξιότητα δεν κοστίζει τίποτα μέχρι να χρησιμοποιηθεί.

Σε τι διαφέρουν οι δεξιότητες AI από τα πρόσθετα ή τους συνδέσμους MCP;

Ένα πρόσθετο ή ένας σύνδεσμος MCP παρέχει στο μοντέλο νέα εργαλεία που μπορεί να καλέσει — κώδικα που εκτελείται κάπου και επιστρέφει ένα αποτέλεσμα. Μια δεξιότητα AI παρέχει αντί γι’ αυτό γνώσεις και διαδικασίες στο μοντέλο: πώς να προσεγγίσει μια εργασία, ποια βήματα να ακολουθήσει και ποια χαρακτηριστικά έχει ένα καλό αποτέλεσμα. Οι δεξιότητες είναι απλό Markdown, επομένως δεν χρειάζονται διακομιστή, κλειδί API ή περιβάλλον εκτέλεσης και λειτουργούν με οποιοδήποτε μοντέλο.

Προβολή όλων

Δημιουργήστε τώρα τον δικό σας χώρο εργασίας AI

Εγγραφείτε στο ενημερωτικό μας δελτίο για να ενημερώνεστε για νέες λειτουργίες και μελλοντικές κληρώσεις δώρων 👇