Logo di Trade Accounting

Trade Accounting

Community
agiprolabs
trade-accounting

Contabilità in partita doppia per le operazioni di trading, con gestione del libro mastro, rendiconti di profitti e perdite, bilanci e report sui flussi di cassa

Add to TypingMind

Panoramica

Pubblicato daagiprolabs
Repositoryclaude-trading-skills
Nome della skilltrade-accounting
Stelle
434
Fork
85
File inclusi
2
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 2

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da agiprolabs su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Trade Accounting in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/agiprolabs/claude-trading-skills/tree/main/skills/trade-accounting
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/agiprolabs/claude-trading-skills.git /tmp/claude-trading-skills
mkdir -p .claude/skills
cp -r /tmp/claude-trading-skills/skills/trade-accounting .claude/skills/trade-accounting
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Trade Accounting in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Trade Accounting non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Trade Accounting non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Trade Accounting

Run your trading operation like a business. Every SOL spent, every token acquired, every fee paid, every gain realized — tracked with double-entry bookkeeping so your books always balance. Whether you trade through a personal wallet or an LLC, proper accounting turns chaos into clarity.

Core principle: Every transaction touches at least two accounts. Buy a token? Cash goes down, token holdings go up — by the same amount. This double-entry constraint catches errors automatically: if debits do not equal credits, something is wrong.

Why Traders Need Accounting

Most traders track P&L loosely — "I started with 50 SOL and now I have 62 SOL." That tells you nothing about:

  • How much came from realized trades vs unrealized positions
  • What you paid in cumulative fees (gas, priority fees, swap fees)
  • Whether your staking and LP income covers your operating costs
  • Your actual cost basis for each holding (critical for taxes)
  • Cash flow timing — are you profitable but illiquid?

Proper accounting answers all of these. It also separates trading P&L (mark-to-market, useful for strategy evaluation) from tax P&L (realized gains using a specific cost basis method, required for compliance).


Account Types

A trading operation uses four account categories following standard accounting:

CategoryNormal BalanceExamples
AssetsDebitCash (SOL/USDC), token holdings, LP positions, staking deposits, receivables
LiabilitiesCreditMargin borrowing, accrued taxes payable
IncomeCreditRealized trading gains, staking rewards, airdrop income, LP fee income
ExpensesDebitTrading fees, gas/priority fees, subscription costs, data feeds
EquityCreditOwner capital contributions, retained earnings, withdrawals (contra)

Chart of Accounts

See references/planned_features.md for a full chart of accounts. A minimal setup:

1000  Assets
  1010  Cash – SOL
  1020  Cash – USDC
  1100  Token Holdings (one sub-account per token)
  1200  LP Positions
  1300  Staking Deposits

3000  Income
  3010  Realized Trading Gains
  3020  Staking Rewards
  3030  Airdrop Income
  3040  LP Fee Income

4000  Expenses
  4010  Trading Fees (DEX swap fees)
  4020  Gas & Priority Fees
  4030  Slippage Cost

5000  Equity
  5010  Owner Capital
  5020  Retained Earnings
  5030  Owner Withdrawals (contra-equity)

Double-Entry Bookkeeping

Every transaction records equal debits and credits. Debits increase asset and expense accounts; credits increase liability, income, and equity accounts.

Entry Examples

Buy 1000 BONK for 0.5 SOL (0.001 SOL gas fee):

AccountDebitCredit
Token Holdings – BONK0.501 SOL
Cash – SOL0.501 SOL

Or with the fee broken out explicitly:

AccountDebitCredit
Token Holdings – BONK0.5 SOL
Gas & Priority Fees0.001 SOL
Cash – SOL0.501 SOL

Sell 1000 BONK for 0.8 SOL (cost basis was 0.5 SOL, 0.001 SOL gas):

AccountDebitCredit
Cash – SOL0.799 SOL
Gas & Priority Fees0.001 SOL
Token Holdings – BONK0.5 SOL
Realized Trading Gains0.3 SOL

Receive staking rewards of 0.05 SOL:

AccountDebitCredit
Cash – SOL0.05 SOL
Staking Rewards0.05 SOL

Receive airdrop of 5000 JUP (valued at 2.1 SOL at receipt):

AccountDebitCredit
Token Holdings – JUP2.1 SOL
Airdrop Income2.1 SOL

Collect LP fees of 0.03 SOL:

AccountDebitCredit
Cash – SOL0.03 SOL
LP Fee Income0.03 SOL

Partial close — sell half a position:

If you hold 2000 BONK at cost basis 1.0 SOL and sell 1000 for 0.7 SOL:

AccountDebitCredit
Cash – SOL0.699 SOL
Gas & Priority Fees0.001 SOL
Token Holdings – BONK0.5 SOL
Realized Trading Gains0.2 SOL

The cost basis of the sold portion (0.5 SOL = half of 1.0 SOL) is removed from the asset account.


Transaction Types

The ledger handles these trading flows:

FlowAccounts Touched
Fund accountCash (debit), Owner Capital (credit)
Withdraw fundsOwner Withdrawals (debit), Cash (credit)
Buy tokenToken Holdings (debit), Cash (credit), Gas Expense (debit)
Sell tokenCash (debit), Token Holdings (credit), Realized Gains (credit or debit for loss), Gas Expense (debit)
Partial closeSame as sell, pro-rated cost basis
Swap token for tokenToken B (debit), Token A (credit), fees
Staking depositStaking Deposits (debit), Cash (credit)
Staking rewardCash (debit), Staking Rewards (credit)
Airdrop receivedToken Holdings (debit), Airdrop Income (credit)
LP fee collectedCash (debit), LP Fee Income (credit)
Trading feeTrading Fees (debit), Cash (credit)
Gas/priority feeGas & Priority Fees (debit), Cash (credit)

Reports

Profit & Loss Statement

Shows income minus expenses for a period:

═══════════════════════════════════════════
  P&L Statement: 2026-02-01 to 2026-02-28
═══════════════════════════════════════════
INCOME
  Realized Trading Gains ........  4.200 SOL
  Staking Rewards ...............  0.150 SOL
  Airdrop Income ................  2.100 SOL
  LP Fee Income .................  0.090 SOL
                                  ─────────
  Total Income                     6.540 SOL

EXPENSES
  Trading Fees ..................  0.120 SOL
  Gas & Priority Fees ...........  0.045 SOL
  Slippage Cost .................  0.030 SOL
                                  ─────────
  Total Expenses                   0.195 SOL

═══════════════════════════════════════════
  NET INCOME                       6.345 SOL
═══════════════════════════════════════════

Balance Sheet

Shows the accounting equation: Assets = Liabilities + Equity.

═══════════════════════════════════════════
  Balance Sheet: 2026-02-28
═══════════════════════════════════════════
ASSETS
  Cash – SOL ....................  32.450 SOL
  Cash – USDC ...................   0.000 SOL
  Token Holdings ................  12.300 SOL
  LP Positions ..................   5.000 SOL
  Staking Deposits ..............  10.000 SOL
                                  ─────────
  Total Assets                    59.750 SOL

EQUITY
  Owner Capital .................  50.000 SOL
  Retained Earnings .............   3.405 SOL
  Net Income (current period) ...   6.345 SOL
                                  ─────────
  Total Equity                    59.750 SOL

═══════════════════════════════════════════
  Assets - Equity = 0.000 SOL  ✓ Balanced
═══════════════════════════════════════════

Cash Flow Statement

Tracks where cash came from and where it went:

═══════════════════════════════════════════
  Cash Flow: 2026-02-01 to 2026-02-28
═══════════════════════════════════════════
OPERATING ACTIVITIES
  Trading proceeds ..............  8.500 SOL
  Token purchases ...............  (4.300) SOL
  Fees paid .....................  (0.195) SOL
  Staking rewards received ......  0.150 SOL
  LP fees received ..............  0.090 SOL
                                  ─────────
  Net Operating Cash Flow        4.245 SOL

INVESTING ACTIVITIES
  LP deposits ...................  (5.000) SOL
  Staking deposits ..............  (2.000) SOL
                                  ─────────
  Net Investing Cash Flow       (7.000) SOL

FINANCING ACTIVITIES
  Capital contributions .........  10.000 SOL
  Withdrawals ...................  (1.000) SOL
                                  ─────────
  Net Financing Cash Flow        9.000 SOL

═══════════════════════════════════════════
  Net Change in Cash              6.245 SOL
  Beginning Cash Balance         26.205 SOL
  Ending Cash Balance            32.450 SOL
═══════════════════════════════════════════

Trading P&L vs Tax P&L

These are different numbers and serve different purposes:

AspectTrading P&LTax P&L
PurposeStrategy evaluationCompliance, filing
Unrealized gainsIncluded (mark-to-market)Excluded (until realized)
Cost basis methodAverage cost (simple)FIFO, LIFO, or specific ID (jurisdiction-dependent)
TimingReal-timeAt disposal event
AirdropsValued at receiptOrdinary income at FMV on receipt
LP ILTracked as unrealized lossNot a taxable event until withdrawal

The ledger in scripts/trading_ledger.py tracks realized gains using FIFO by default. For trading P&L, you can overlay mark-to-market valuations on open positions.

See references/planned_features.md for detailed worked examples of how the same trades produce different P&L under FIFO vs average cost.


Entity Considerations

Traders operating through an LLC or S-Corp should track additional accounts:

  • Management fees — if the entity charges a management fee
  • Distributions — payments from entity to owner (not the same as withdrawals from a trading account)
  • Payroll expenses — S-Corp officer salary
  • Tax provisions — estimated quarterly tax payments

The accounting principles are identical; the chart of accounts simply expands. The scripts in this skill focus on the trading-level ledger, which is the foundation for entity-level reporting.


Quick Start

python
from trading_ledger import Ledger, Amount

ledger = Ledger(base_currency="SOL")

# Fund the account
ledger.record_funding(amount=50.0, memo="Initial capital")

# Buy a token
ledger.record_buy(
    token="BONK",
    quantity=100_000,
    cost_sol=0.5,
    fee_sol=0.001,
    memo="Entry on volume spike"
)

# Sell for profit
ledger.record_sell(
    token="BONK",
    quantity=100_000,
    proceeds_sol=0.8,
    fee_sol=0.001,
    memo="Target hit"
)

# Record staking reward
ledger.record_income(
    income_type="staking",
    amount_sol=0.05,
    memo="Epoch 580 rewards"
)

# Generate reports
ledger.print_pnl(start="2026-02-01", end="2026-02-28")
ledger.print_balance_sheet(as_of="2026-02-28")

Run the demo script to see a full month of trading activity with all report types:

bash
python scripts/trading_ledger.py --demo

Use Cases

  1. Track real P&L — Know exactly how much you made after all fees, not just entry/exit prices
  2. Tax preparation — Hand your accountant a clean ledger with cost basis and realized gains
  3. Fee analysis — Discover that gas and priority fees are eating 3% of your gross profits
  4. Strategy comparison — Compare net P&L across strategies, not just win rates
  5. Cash flow planning — Know if you have enough liquid SOL for the next trade
  6. Audit trail — Every number traces back to a dated, memo-tagged journal entry

Prerequisites

  • Python 3.10+
  • No external dependencies (the ledger uses only the standard library)

Files

FileDescription
references/planned_features.mdChart of accounts, double-entry examples, report formats, trading vs tax P&L
scripts/trading_ledger.pyDouble-entry ledger with P&L, balance sheet, and demo mode

Disclaimer: This skill provides accounting structure and calculations for informational and organizational purposes only. It is not tax advice, legal advice, or financial advice. Consult a qualified tax professional or CPA for guidance on your specific tax obligations. Cryptocurrency tax treatment varies by jurisdiction and changes frequently.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Trade Accounting?

Contabilità in partita doppia per le operazioni di trading, con gestione del libro mastro, rendiconti di profitti e perdite, bilanci e report sui flussi di cassa

Perché usare Trade Accounting su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Trade Accounting è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Trade Accounting in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/agiprolabs/claude-trading-skills/tree/main/skills/trade-accounting. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Trade Accounting?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Trade Accounting?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Trade Accounting: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Trade Accounting è gratuita?

Sì. È pubblicata su GitHub da agiprolabs con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇