QuantConnect / QuantConnect/Lean

Tax Model

Open
#7,348 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C#
Stars
21.7k
Forks
5.3k
Avg merge
2d 22h
Merged PRs (30d)
34

Description

Taxes are overwhelmingly my top expense.

There doesn't appear to be any builtin support for tax calculations.

Proposal: Add a Tax Model (SetTaxModel()) that would estimate taxes and adjust algo results based on factors such as:

  • Geographic location {Puerto Rico, California, New York}
  • Account type {taxable brokerage, roth IRA, HSA}
  • Gross income outside the trading algorithm
  • Marriage status, filing jointly or separately
  • Estimated tax payment date and when+whether those taxes should be extracted from my balance
  • Long vs short term capital gains taxes
  • etc.

We could start with a SimpleLongVsShortTermTaxModel.

Tax information could appear as:

  • Tax events in backtest and live reports
  • Tax column in orders report

TODO: List potential APIs for collecting tax constants.


Update from Jared in Discord:

"We might be able to make something simple. We've intentionality ignored them till now."

This makes sense, taxes are remarkably complex and highly individual.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by narrowing the proposed SimpleLongVsShortTermTaxModel and deciding which tax inputs, extraction timing, reports, and order fields are in scope. Done would require an agreed API and defined behavior for the selected scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
fintech-quant
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.