Skip to content

Commit

Permalink
support for english statement of revolut savings account added (#108)
Browse files Browse the repository at this point in the history
* - support for english statement of revolut savings account added

* - cosmetic fixes
  • Loading branch information
jczaja authored Apr 4, 2024
1 parent e732968 commit 437526b
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "etradeTaxReturnHelper"
version = "0.5.1"
version = "0.5.2"
edition = "2021"
description = "Parses etrade financial documents for transaction details (income, tax paid, cost basis) and compute total income and total tax paid according to chosen tax residency (currency)"
license = "BSD-3-Clause"
Expand Down
48 changes: 48 additions & 0 deletions revolut_data/revolut-savings-eng.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Completed Date,Product name,Description,Interest rate (p.a.),Money out,Money in,Balance
"1 Jan 2023","","Money brought forward","","","","0 PLN"
"11 Dec 2023","Instant Access - Aion Bank","Deposit","","","+2,500 PLN","2,500 PLN"
"11 Dec 2023","Instant Access - Aion Bank","Deposit","","","+10 PLN","2,510 PLN"
"11 Dec 2023","Instant Access - Aion Bank","Deposit","","","+10 PLN","2,520 PLN"
"12 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/12","3.05%","","+0.21 PLN","2,520.21 PLN"
"13 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/13","3.05%","","+0.20 PLN","2,520.41 PLN"
"14 Dec 2023","Instant Access - Aion Bank","Deposit","","","+10 PLN","2,530.41 PLN"
"15 Dec 2023","Instant Access - Aion Bank","Deposit","","","+8.22 PLN","2,538.63 PLN"
"15 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/15","3.05%","","+0.21 PLN","2,538.84 PLN"
"16 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/16","3.05%","","+0.21 PLN","2,539.05 PLN"
"17 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/17","3.05%","","+0.21 PLN","2,539.26 PLN"
"18 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/18","3.05%","","+0.21 PLN","2,539.47 PLN"
"19 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/19","3.05%","","+0.41 PLN","2,539.88 PLN"
"20 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/20","3.05%","","+0.21 PLN","2,540.09 PLN"
"21 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/21","3.05%","","+0.21 PLN","2,540.30 PLN"
"21 Dec 2023","Instant Access - Aion Bank","Deposit","","","+10 PLN","2,550.30 PLN"
"22 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/22","3.05%","","+0.21 PLN","2,550.51 PLN"
"23 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/23","3.05%","","+0.21 PLN","2,550.72 PLN"
"24 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/24","3.05%","","+0.21 PLN","2,550.93 PLN"
"25 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/25","3.05%","","+0.21 PLN","2,551.14 PLN"
"26 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/26","3.05%","","+0.21 PLN","2,551.35 PLN"
"27 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/27","3.05%","","+0.21 PLN","2,551.56 PLN"
"28 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/28","3.05%","","+0.21 PLN","2,551.77 PLN"
"28 Dec 2023","Instant Access - Aion Bank","Deposit","","","+10 PLN","2,561.77 PLN"
"29 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/29","3.05%","","+0.21 PLN","2,561.98 PLN"
"30 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/30","3.05%","","+0.21 PLN","2,562.19 PLN"
"31 Dec 2023","Instant Access - Aion Bank","Gross interest
Earned on 2023/12/31","3.05%","","+0.21 PLN","2,562.40 PLN"
"31 Dec 2023","","Money carried forward","","","","2,562.40 PLN"
33 changes: 32 additions & 1 deletion src/csvparser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn extract_intrest_rate_transactions(df: &DataFrame) -> Result<DataFrame, &'stat
.map(|x| {
let m = match x {
AnyValue::Utf8(x) => {
if x.contains("Odsetki brutto") {
if x.contains("Odsetki brutto") || x.contains("Gross interest") {
Some("odsetki")
} else {
None
Expand Down Expand Up @@ -535,6 +535,37 @@ mod tests {
Ok(())
}

#[test]
fn test_parse_revolut_transactions_english_statement_pln() -> Result<(), String> {
let expected_result = Ok(vec![
("12/12/23".to_owned(), crate::Currency::PLN(0.21)),
("12/13/23".to_owned(), crate::Currency::PLN(0.20)),
("12/15/23".to_owned(), crate::Currency::PLN(0.21)),
("12/16/23".to_owned(), crate::Currency::PLN(0.21)),
("12/17/23".to_owned(), crate::Currency::PLN(0.21)),
("12/18/23".to_owned(), crate::Currency::PLN(0.21)),
("12/19/23".to_owned(), crate::Currency::PLN(0.41)),
("12/20/23".to_owned(), crate::Currency::PLN(0.21)),
("12/21/23".to_owned(), crate::Currency::PLN(0.21)),
("12/22/23".to_owned(), crate::Currency::PLN(0.21)),
("12/23/23".to_owned(), crate::Currency::PLN(0.21)),
("12/24/23".to_owned(), crate::Currency::PLN(0.21)),
("12/25/23".to_owned(), crate::Currency::PLN(0.21)),
("12/26/23".to_owned(), crate::Currency::PLN(0.21)),
("12/27/23".to_owned(), crate::Currency::PLN(0.21)),
("12/28/23".to_owned(), crate::Currency::PLN(0.21)),
("12/29/23".to_owned(), crate::Currency::PLN(0.21)),
("12/30/23".to_owned(), crate::Currency::PLN(0.21)),
("12/31/23".to_owned(), crate::Currency::PLN(0.21)),
]);
assert_eq!(
parse_revolut_transactions("revolut_data/revolut-savings-eng.csv"),
expected_result
);

Ok(())
}

#[test]
fn test_parse_revolut_investment_transactions_usd() -> Result<(), String> {
let expected_result = Ok(vec![
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use logging::ResultExt;
// TODO: parse_gain_and_losses expect -> ?
// TODO: GUI : choosing residency
// TODO: Drag&Drop to work on MultiBrowser field
// TODO: Change run_taxation for_Each into try_for_Ech if possible
// TODO: taxation of EUR instruments in US

fn create_cmd_line_pattern<'a, 'b>(myapp: App<'a, 'b>) -> App<'a, 'b> {
Expand Down

0 comments on commit 437526b

Please sign in to comment.