Handle and report stock splits
pviotti opened this issue · comments
Paolo commented
A reverse stock split is marked in the following way in Degiro account statement:
06-06-2022,14:38,06-06-2022,ACME Inc NEW,CODENEW123456,STOCK SPLIT: Buy 5 ACME Inc NEW@17.5 USD (CODENEW123456),,USD,-87.50,USD,-0.00,
06-06-2022,14:38,06-06-2022,ACME Inc OLD,CODEOLD123456,STOCK SPLIT: Sell 50 ACME Inc OLD@1.75 USD (CODEOLD123456),,USD,87.50,USD,87.50,
At the moment, stock splits are not handled, so if a stock gets turned into another stock (with a different ISIN) as a result of a split, the sell transaction won't find corresponding buy transactions and Degiro Bookeeper will fail with an error similar to the following:
Error: could not find buy transactions for remaining 5 sells of { Date = 8/1/2022 4:57:00 PM 1810.5 K
Type = Sell
Product = "ACME Inc NEW"
ISIN = "CODENEW123456"
ProdType = Shares
Quantity = 5
Fees = -0.50M
Price = 86.43M
Value = 17.8M
ValueCurrency = USD
OrderId = ab2dea5e-1459-425c-96bb-f3124b754b75 }
It'd be great if we could
- handle code splits (at least the types of splits I am aware of, as they show up in my account statement...)
- print out a warning to notify the user that a split happened (since Degiro doesn't...)