Skip to content

Things #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 1, 2025
Merged

Things #1

merged 8 commits into from
Apr 1, 2025

Conversation

stefanmoro
Copy link
Contributor

@stefanmoro stefanmoro commented Mar 26, 2025

  • Filter out order types not relevant for K4 (E.g. STC since they are form other countries)
  • Use exchange rates from files exported from riksbanken (No copy paste error & daily rates)
  • Support both yearly and daily exchange rates (allow optimizing for minimum gain and tax)

Hämta växelkurs från:
https://www.riksbank.se/sv/statistik/rantor-och-valutakurser/valutakurser-till-deklarationen/
Uppdatera `usd_sek_daily/yearly.xlsx` genom att exportera årlig/daglig USD/SEK som xlsx från
https://www.riksbank.se/sv/statistik/rantor-och-valutakurser/sok-rantor-och-valutakurser
Copy link
Owner

@tirsen tirsen Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you just pull this down with the script or is the URL not known?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can check that out when I get time. Worst case it's a "once per year" manual job (https://xkcd.com/1205/ :) )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha yeah good point but in that case, maybe we remove the local files and make it a flag instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That definitely works as well - no strong opinions!

The exports currently checked in are yearly respective daily rates for the timeperiod [2020-01-01,2024-12-31]. I checked them in for convenience. By having them checked in, someone would update them once a year, and everyone else would just pull the latest changes. and be able to calculate for the new year.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it use flags instead mostly so that I got a chance to play with cursor 😜

k4.py Outdated
@@ -5,6 +5,18 @@
from dataclasses import dataclass

SALES_PER_PAGE = 7
BLACKLISTED_ORDER_TYPES = ["RS STC"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are RS or STC?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it stands for "Restricted Stocks Sell To Cover"

Filter out order types not relevant for k4. E.g. exclude "RS
STC" from other countries and ESPP if added to the export.
* Use xlsx exports from riksbanken for exchange rates, reduce risk of
  incorrect rate
* Support both yearly/daily exchange rates, allowing user to choose the
  one that gives lowest gain (and hence tax)
@tirsen tirsen merged commit 9505de9 into tirsen:main Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants