Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some syntax issues? #24

Open
RaNo99 opened this issue Mar 5, 2023 · 1 comment
Open

Some syntax issues? #24

RaNo99 opened this issue Mar 5, 2023 · 1 comment

Comments

@RaNo99
Copy link
Contributor

RaNo99 commented Mar 5, 2023

Hi @ncortines I tried running the script for 2020 tax year, and I had to change boolean compounds order at the beginning of processSaleDetails to:

        const saleDateString = sale.withdrawalDate || sale.order.uniqueFillDate
        return getExchangeRate(new Date(saleDateString))
            .then(sellExchangeRate => {
                const longTermCostTransactions = (sale.costBasis && sale.costBasis.longTerm && sale.costBasis.longTerm.rows) || []
                const shortTermCostTransactions = (sale.costBasis && sale.costBasis.shortTerm && sale.costBasis.shortTerm.rows) || []

because sale.order arrived undefined, and so did sale.costBasis. Not sure why.

Also, I'm getting Uncaught (in promise) TypeError: can't convert undefined to object in stringifyList. The stringified data is as follows:

0: "sales summary:"
​"1.0.date": "2020-08-06"
​"1.0.settlement date": "2020-08-10"
​"1.0.quantity": "0.00"
​"1.0.exchange rate": "3.71"
​"1.0.earnings usd": "0.00"
​"1.0.earnings pln": "0.00"
​"1.0.cost pln": "0.00"
​"1.0.fees usd": "50.05"
​"1.0.fees pln": "185.90"
​"1.0.cost + fees pln": "185.90"
​2: "total earnings pln (PIT-38 p. 22): 0.00"
​3: "total earnings cost (with fees) pln (PIT-38 p. 23): 666.66"
​4: "total profit pln (PIT/ZG p. 32): -666.66"
​5: "breakdown of sale from 2020-08-06:"
​7: "dividends summary:"
​"8.0.date": "2020-07-22"
​"8.0.exchange rate": "3.88"
​"8.0.amount usd": "66.66"
​"8.0.amount pln": "66.66"
​9: "total dividend earnings pln: 66.66"
​10: "total dividend 19% tax pln (PIT-38 p. 45): 66.66"
​11: "total dividend 15% (*) tax withhold (PIT-38 p. 46): 66.66"
​12: "(*) Assuming you filled in W-8BEN. Otherwise adjust this number"

I changed some sensitive data to "666"/"66", but what's also interesting is that the "total profit pln" field has a negative value.

@ncortines
Copy link
Owner

ncortines commented Aug 25, 2023

@RaNo99 , could be related to #23? sale.costBasis is not available for ESPP-related sale records

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants