timelineCsvConverter.py index out of range for selling a fractional share (giftby Stellantis) by market order, and selling I guess "Bezugsrechte" by Kion (this might be 2 bugs in 1 report):
'Limit Sell order executed at 132.22 €\nProfit:  -1.18 %'
But breaks on:
'Sell order executed at 46.58 €'
'Sell order executed at 0.3727 €'
with (for both):
Traceback (most recent call last):
File "C:\workspace\python\TradeRepublicApi\examples\timelineCsvConverter.py", line 180, in <module>
profit = abs(float(re.findall("[-+]?\d.*\.\d+|\d+", body)[1].replace(",", "")) / 100) #as decimal (percentage)
IndexError: list index out of range
and (only for the second):
Traceback (most recent call last):
File "C:\workspace\python\TradeRepublicApi\examples\timelineCsvConverter.py", line 187, in <module>
shares = "{0:.4f}".format(cashChangeAmount / amountPerShare)
ZeroDivisionError: float division by zero
There is a clue: this was a and my only (maybe) fractional share I got from Stellantis as a "gift" once:
Which could be sold only by market order and might even have no buy in.
It's no big bug, as the occurence might be quite rare. But just wanted it to be noted.
First one is a "gift" by Stellantis and second one might be "Bezugsrechte" by Kion.
Workaround: edit myTimeline.json and change it e.g. to:
"Sell order executed at 46.58 €\nProfit:  0.00 %",
The latter one (Bezugsrechte) I added some print statements and it turned out that:
cashChangeAmount = 4.74
amountPerShare = 0.0
So that's why division by zero error.
A really dirty quick workaround could be here:
if amountPerShare == 0:
amountPerShare = cashChangeAmount
If this issue should be too confusing I could create 2 issues instead, now it's mixed up a little ;)
timelineCsvConverter.py index out of range for selling a fractional share (giftby Stellantis) by market order, and selling I guess "Bezugsrechte" by Kion (this might be 2 bugs in 1 report):
This:
works fine for e.g.
But breaks on:
with (for both):
and (only for the second):
There is a clue: this was a and my only (maybe) fractional share I got from Stellantis as a "gift" once:
and I guess Bezugsrechte Kion:
Which could be sold only by market order and might even have no buy in. It's no big bug, as the occurence might be quite rare. But just wanted it to be noted.
First one is a "gift" by Stellantis and second one might be "Bezugsrechte" by Kion.
Workaround: edit myTimeline.json and change it e.g. to:
The latter one (Bezugsrechte) I added some print statements and it turned out that: cashChangeAmount = 4.74 amountPerShare = 0.0 So that's why division by zero error.
A really dirty quick workaround could be here:
If this issue should be too confusing I could create 2 issues instead, now it's mixed up a little ;)