Skip to content

Commit 305c53c

Browse files
authored
- Added more diagnostic and fix error messages (#98)
1 parent 23098f6 commit 305c53c

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "etradeTaxReturnHelper"
3-
version = "0.4.1"
3+
version = "0.4.2"
44
edition = "2021"
55
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)"
66
license = "BSD-3-Clause"

src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ mod gui;
1111
use etradeTaxReturnHelper::run_taxation;
1212
use logging::ResultExt;
1313

14-
// TODO: make UT working and test GUI
14+
// TODO: When there is no proxy (on intel account) there are problems (UT do not work
15+
// getting_Exchange_rate)
1516
// TODO: Make a parsing of incomplete date
1617
// TODO: Dividends of revolut should combined with dividends not sold
1718
// TODO: When I sold on Dec there was EST cost (0.04). Make sure it is included in your results

src/transactions.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,22 @@ pub fn reconstruct_sold_transactions(
8787
for (acquisition_date, tr_date, cost_basis, _, inc) in gains_and_losses {
8888
// match trade date and gross with principal and trade date of trade confirmation
8989

90+
log::info!("Reconstructing G&L sold transaction: trade date: {tr_date}, acquisition date: {acquisition_date}, cost basis: {cost_basis}, income: {inc}");
9091
let (_, settlement_date, _, _, _) = sold_transactions.iter().find(|(trade_dt, _, _, _, _income)|{
91-
*trade_dt == chrono::NaiveDate::parse_from_str(&tr_date, "%m/%d/%Y").unwrap().format("%m/%d/%y").to_string()
92-
}).expect_and_log("\n\nERROR: Sold transaction detected, but corressponding Gain&Losses document is missing. Please download Gain&Losses XLSX document at:\n
93-
https://us.etrade.com/etx/sp/stockplan#/myAccount/gainsLosses\n\n");
92+
*trade_dt == chrono::NaiveDate::parse_from_str(&tr_date, "%m/%d/%Y").expect_and_log(&format!("Unable to parse trade date: {tr_date}")).format("%m/%d/%y").to_string()
93+
}).expect_and_log(&format!("\n\nERROR: Sold transaction:\n (trade_date: {tr_date}, acquisition date: {acquisition_date}, cost basis: {cost_basis}, income: {inc}) detected,\n but corressponding data from PDF document is missing. You can download account statements PDF documents at:\n
94+
https://edoc.etrade.com/e/t/onlinedocs/docsearch?doc_type=stmt\n\n"));
9495

9596
detailed_sold_transactions.push((
9697
chrono::NaiveDate::parse_from_str(&tr_date, "%m/%d/%Y")
97-
.unwrap()
98+
.expect(&format!("Unable to parse trade date: {tr_date}"))
9899
.format("%m/%d/%y")
99100
.to_string(),
100101
settlement_date.clone(),
101102
chrono::NaiveDate::parse_from_str(&acquisition_date, "%m/%d/%Y")
102-
.unwrap()
103+
.expect(&format!(
104+
"Unable to parse acquisition_date: {acquisition_date}"
105+
))
103106
.format("%m/%d/%y")
104107
.to_string(),
105108
*inc,

0 commit comments

Comments
 (0)