SkatteguruSkatteguru2.6 Beta
How It WorksPricingFAQHelpNews
Start For Free

Product

  • Pricing
  • News
  • Reviews

Contact

  • Help Center
  • Contact Us
  • Report an Issue
  • Follow on X

Legal

  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Cookie Settings
© 2026 Skatteguru
    1. Home
    2. Help Center
    3. How It Works
    4. Data Pipeline

    From Documents to Capital Gains Tax Calculation

    This page provides an overview of how Skatteguru transforms your uploaded documents into accurate capital gains taxes. Understanding this pipeline can help you troubleshoot issues and make informed decisions when editing your data.

    Overview

    The data pipeline consists of six main stages that transform your raw documents into a complete Swedish tax declaration:

    1. Document Upload & Classification - Files are identified and categorized
    2. Text Extraction & Parsing - Structured data is extracted from documents
    3. Financial Event Generation - Parsed data becomes standardized financial events
    4. User Overrides - Manual corrections for e.g. FX rates (optional)
    5. Processing - Events are organized and profit/loss and capital gains tax is calculated
    6. Capital Gains Tax Calculation - Final capital gains tax liability is produced

    Visual Data Flow

    Here's a visual representation of the entire pipeline from document upload to RSU file:

    1

    Document Upload & Classification

    PDF Files
    Excel
    Images
    Classification
    Document Type (E*TRADE, Avanza, etc.)
    2

    Text Extraction & Parsing

    Raw Document
    Specialized Parsers
    Parsed Data Structure
    parsedData: {
      metadata: { parserId, version, ... },
      events: [
        { type, symbol, date, time, shares, price, fee, ... }
      ]
    }
    3

    Financial Event Generation

    Parsed Data
    Normalization
    Financial Event Objects
    4

    User Overrides

    5

    Processing

    Financial Events
    Group
    Create Trade Ledgers

    Processing Strategies:

    • 1. Remove Duplicates
    • 2. Add Special Events (splits/mergers)
    • 3. Collapse Events
    • 4. Apply FX Overrides

    Average Cost Method (Genomsnittsmetoden):

    • Events sorted by date/time
    • avg_cost = total_cost ÷ total_shares_owned
    • profit = (sale_price × shares) - (avg_cost × shares)
    6

    Tax Calculation

    Processed Events
    Calculate Tax
    K4 Form + SRU File

    Tax Methods (Choose lowest):

    • Standard: profit = sale_price - cost
    • Schablon (20%): Always allowed for shares

    K4 Form Fields:

    3100:Quantity
    3102:Sale Price (SEK)
    3103:Acquisition Cost (SEK)
    3104/3105:Profit/Loss

    How the dashboard 'Capital Gains Tax' estimate is calculated

    The “Capital Gains Tax (Estimated liability)” figure shown next to Gross Profit is a K4-only estimate intended to help you anticipate the impact on your residual tax.

    It applies the 30% rate after taking into account the documented Swedish rule for section D:

    • Net gains and losses in sections A and C are included at 100%.
    • Net losses in section D are included at 70% (the normal deductibility rate).
    • Net gains in section D are included at 100%.

    This is still only the K4 portion. Your final capital income tax on Inkomstdeklaration 1 also depends on interest, dividends, other capital items, and any carry-forwards Skatteguru does not see. Use the per-section declaration values + SRU file for the authoritative reporting numbers, and the residual tax calculator for further refinement.

    Related Articles

    • Why You Need Transaction-Level Data — Why broker gains & losses summaries aren't enough for K4
    • Currency Conversion Rules — How we handle exchange rates for foreign stocks
    • Same-Day Stock Sales — Why execution time matters for same-day transactions
    • How We Process Your Documents — Details on our document parsing pipeline
    Skatteguru mascot

    We're Here to Help

    Have questions or feedback? We'd love to hear from you. Get in touch.