Skip to content

Commit

Permalink
- Added more diagnostic and fix error messages (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
jczaja authored Mar 2, 2024
1 parent 23098f6 commit 305c53c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
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.4.1"
version = "0.4.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
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ mod gui;
use etradeTaxReturnHelper::run_taxation;
use logging::ResultExt;

// TODO: make UT working and test GUI
// TODO: When there is no proxy (on intel account) there are problems (UT do not work
// getting_Exchange_rate)
// TODO: Make a parsing of incomplete date
// TODO: Dividends of revolut should combined with dividends not sold
// TODO: When I sold on Dec there was EST cost (0.04). Make sure it is included in your results
Expand Down
13 changes: 8 additions & 5 deletions src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,22 @@ pub fn reconstruct_sold_transactions(
for (acquisition_date, tr_date, cost_basis, _, inc) in gains_and_losses {
// match trade date and gross with principal and trade date of trade confirmation

log::info!("Reconstructing G&L sold transaction: trade date: {tr_date}, acquisition date: {acquisition_date}, cost basis: {cost_basis}, income: {inc}");
let (_, settlement_date, _, _, _) = sold_transactions.iter().find(|(trade_dt, _, _, _, _income)|{
*trade_dt == chrono::NaiveDate::parse_from_str(&tr_date, "%m/%d/%Y").unwrap().format("%m/%d/%y").to_string()
}).expect_and_log("\n\nERROR: Sold transaction detected, but corressponding Gain&Losses document is missing. Please download Gain&Losses XLSX document at:\n
https://us.etrade.com/etx/sp/stockplan#/myAccount/gainsLosses\n\n");
*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()
}).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
https://edoc.etrade.com/e/t/onlinedocs/docsearch?doc_type=stmt\n\n"));

detailed_sold_transactions.push((
chrono::NaiveDate::parse_from_str(&tr_date, "%m/%d/%Y")
.unwrap()
.expect(&format!("Unable to parse trade date: {tr_date}"))
.format("%m/%d/%y")
.to_string(),
settlement_date.clone(),
chrono::NaiveDate::parse_from_str(&acquisition_date, "%m/%d/%Y")
.unwrap()
.expect(&format!(
"Unable to parse acquisition_date: {acquisition_date}"
))
.format("%m/%d/%y")
.to_string(),
*inc,
Expand Down

0 comments on commit 305c53c

Please sign in to comment.