Skip to content

Commit fd3dbb6

Browse files
authored
- Added some comments with tax law basis (#182)
1 parent 3983cf1 commit fd3dbb6

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/pl.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ fn is_non_working_day(date: &chrono::NaiveDate) -> Result<bool, String> {
5656
.map_err(|_| format!("Error checking if given date: {date} is holiday"))
5757
}
5858

59+
// We search a exchange rate from a working day preceeding given date (settlement date for
60+
// etrade)
61+
//Art. 11a ust. 1 (Dz.U. 2024 poz. 226):
62+
// Przychody w walutach obcych przelicza się na złote według kursu średniego walut obcych ogłaszanego przez Narodowy Bank Polski z ostatniego dnia roboczego poprzedzającego dzień uzyskania przychodu.
5963
// Iterate through dates and find where value is None
6064
// and then try to get for that specific date from cache
6165
fn get_exchange_rates_from_cache(
@@ -81,6 +85,7 @@ fn get_exchange_rates_from_cache(
8185
let mut converted_date = chrono::NaiveDate::parse_from_str(&date, "%m/%d/%y")
8286
.map_err(|_| format!("Error parsing date: {date}"))?;
8387
let mut is_working_day = false;
88+
8489
while is_working_day == false {
8590
converted_date = converted_date
8691
.checked_sub_signed(chrono::Duration::days(1))
@@ -135,6 +140,10 @@ fn get_exchange_rates_from_cache(
135140
}
136141

137142
impl etradeTaxReturnHelper::Residency for PL {
143+
// We search a exchange rate from a working day preceeding given date (settlement date for
144+
// etrade)
145+
//Art. 11a ust. 1 (Dz.U. 2024 poz. 226):
146+
// Przychody w walutach obcych przelicza się na złote według kursu średniego walut obcych ogłaszanego przez Narodowy Bank Polski z ostatniego dnia roboczego poprzedzającego dzień uzyskania przychodu.
138147
fn get_exchange_rates(
139148
&self,
140149
dates: &mut std::collections::HashMap<

src/transactions.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@ pub fn verify_transactions<T>(
9999
/// Trade date is when transaction was trigerred.
100100
/// fees and commission are applied at the moment of settlement date so
101101
/// we ignore those and use net income rather than principal
102-
/// Actual Tax is to be paid from settlement_date
102+
/// Actual Tax duty is to be paid using settlement_date
103+
/// Basis: Art. 17 ust. 1ab pkt 1 PIT
104+
/// 1ab. Przychód określony w ust. 1 pkt 6:
105+
/// 1) z odpłatnego zbycia udziałów (akcji), udziałów w spółdzielni oraz papierów wartościowych powstaje w momencie przeniesienia na nabywcę własności udziałów (akcji), udziałów w spółdzielni oraz papierów wartościowych;
106+
/// (jczaja): I have spoken with etrade support and they told me that ownership of stocks is
107+
/// transfered on settlement date
108+
103109
pub fn reconstruct_sold_transactions(
104110
sold_transactions: &Vec<(String, String, f32, f32, f32, Option<String>)>,
105111
gains_and_losses: &Vec<(String, String, f32, f32, f32)>,

0 commit comments

Comments
 (0)