Skip to content

Repository files navigation

Disclaimer

This is an unofficial open source project.

  • This project is not affiliated with or endorsed by E*TRADE, Morgan Stanley, the State Bank of India (SBI), the Reserve Bank of India (RBI), the Income Tax Department of India, or any other financial institution or government authority.
  • Historical exchange rates are obtained through the sbi-tt-rates package. For dates prior to 2020, where SBI TT data is unavailable, the library automatically falls back to historical USD/INR exchange rates from Yahoo Finance.
  • The library has only been tested with E*TRADE statement formats. Statements from other brokers are not currently supported.
  • The library has only been validated for FY 2025-26 (AY 2026-27). Future Income Tax portal formats, reporting requirements, or broker statement formats may require updates.
  • The generated Schedule FA should always be reviewed before filing your Income Tax Return. Users are responsible for verifying the accuracy of the generated data before submission.

The authors and contributors are not responsible for any incorrect tax filings, penalties, interest, or financial losses resulting from the use of this software.

itr-schedule-fa

Convert US broker statements into Schedule FA for the Indian Income Tax Return.

itr-schedule-fa is an open source Python library that converts broker statements into the Schedule FA format required by the Indian Income Tax portal.

The project currently supports E*TRADE statements and is designed so additional brokers can be added over time.


What it does

Preparing Schedule FA usually involves:

  • reconstructing historical holdings
  • calculating acquisition values
  • finding the peak value during the financial year
  • converting USD values into INR using historical exchange rates
  • creating dividen history in INR
  • listing short term, long term gains
  • Dividing the values as per quarter.
  • preparing the data in the format expected by the Income Tax portal

This library performs those calculations and generates a Schedule FA CSV from your broker statements.


Features

  • Parse E*TRADE holdings statements

  • Parse E*TRADE gain/loss statements

  • Reconstruct holdings for the reporting year

  • Calculate:

    • Initial investment value
    • Peak investment value
    • Closing balance
    • Gross sale proceeds
  • Convert USD values to INR using historical exchange rates

  • Generate Schedule FA CSV


Installation

pip install itr-schedule-fa

Supported brokers


Broker Status version
E*TRADE Supported 0.0.1

More brokers are planned.


Supported stocks

Currently the library supports multiple stocks** (if your broker is etrade)


Required files

The library accepts up to three input files.

File Required Description
holdings.xlsx Yes Current holdings exported from your broker
gnl_within.xlsx No Shares sold during the reporting financial year
gnl_after.xlsx No Shares sold after the reporting financial year

If there were no transactions in a category, simply omit that file. Note : All 3 files are needed in expanded view for the parsers to work.


E*TRADE Holdings Report

Holdings -> View By Status -> Download Expanded

E*TRADE Gain/Loss Reports

Download for current FY year and last year as well.

If filing for FY 2025-26 (AY 2026-27), download (Expanded View):

  • Gain & Loss report for 2025
  • Gain & Loss report for 2026

The purpose of the second Gain & Loss report is to reconstruct your holdings as of 31-Dec-2025.

For example, if you received an RSU in 2024 but sold it in January 2026, it will no longer appear in the holdings report downloaded during ITR filing season.

The transaction report is therefore used to add those shares back so that the holdings accurately reflect the position as of 31-Dec-2025.

Example

from pathlib import Path

from itr_schedule_fa import ScheduleFA
from itr_schedule_fa.factory import (
    supported_brokers,
    supported_tickers,
)

BROKER = "etrade"
TICKER = "QCOM"
REPORTING_YEAR = 2025  # a convention that fy 2025-26


def main():
    print(f"Broker         : {BROKER}")
    print(f"Ticker         : {TICKER}")
    print(f"Reporting Year : {REPORTING_YEAR}")

    if TICKER not in supported_tickers():
        raise ValueError(
            f"Unsupported ticker '{TICKER}'. Supported tickers: {', '.join(supported_tickers())}"
        )

    if BROKER not in supported_brokers():
        raise ValueError(
            f"Unsupported broker '{BROKER}'. Supported brokers: {', '.join(supported_brokers())}"
        )

    data_dir = Path(__file__).parent / "data"

    owned = data_dir / "holdings.xlsx"
    sold_within = data_dir / "gnl_within.xlsx"
    sold_after = data_dir / "gnl_after.xlsx"
    output_schedule_fa_path = data_dir / "schedule_fa.csv"
    output_gains_path = data_dir / "gains.csv"
    output_dividend_path = data_dir / "dividend.csv"
    if not owned.exists():
        raise FileNotFoundError(f"Missing holdings file: {owned}")

    fa = ScheduleFA(
        ticker=TICKER,
        year=REPORTING_YEAR,
        broker=BROKER,
    )

    fa.set_data(
        owned=owned,
        sold_within_reporting_year=(sold_within if sold_within.exists() else None),
        sold_after_reporting_year=(sold_after if sold_after.exists() else None),
    )

    fa.generate()

    fa.schedule_fa().to_csv(output_schedule_fa_path)  # writes FA
    fa.gains_table().to_csv(output_gains_path)  # writes gains
    fa.dividend_table().to_csv(output_dividend_path)  # writes dividends


if __name__ == "__main__":
    main()

How it works

Broker Statements
        │
        ▼
 Parse Holdings
        │
        ▼
 Parse Transactions
        │
        ▼
 Reconstruct Holdings
        │
        ▼
 Historical Stock Prices
        │
        ▼
 Historical Exchange Rates
        │
        ▼
 Schedule FA CSV

Exchange rates

The library uses historical SBI TT Buy exchange rates (SBITTR) through the sbi-tt-rates package. Link: https://github.com/jdecodes/sbi-tt-rates

Historical SBI TT data is available from 2020 onwards.

For acquisitions before 2020, the library automatically falls back to historical USD/INR exchange rates from Yahoo Finance and logs a warning.

Example:

WARNING: Falling back to Yahoo Finance for acquisition date 2019-08-19 (USD/INR=71.132) because SBI TT data is unavailable.

Dividends

Dividend calculations are done using https://github.com/jdecodes/fa-inrdata-api's dividend apis. Check project : https://github.com/jdecodes/fa-inrdata


Validation

The library validates the input before generating Schedule FA.

Some examples include:

  • unsupported broker
  • unsupported ticker
  • missing files
  • empty holdings file
  • missing required columns
  • mismatched ticker between statements
  • invalid input formats

Validation errors are reported with descriptive exceptions.


Roadmap

Planned improvements include:

  • additional US brokers
  • automatic broker detection

Companion projects

This project uses the following libraries:


Contributing

Bug reports, feature requests and pull requests are welcome.

If you'd like to add support for another US broker, feel free to open an issue before starting work so we can discuss the file formats and implementation.


License

MIT License. See the LICENSE file for details.

About

itr-schdule-fa is an open source Python library that converts broker statements into the Schedule FA format required by the Indian Income Tax portal. Under the hood it uses sbi-tt-rates project and broker statements to convert to desired format.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages