ConorIA / cdc-csv

1 stars 0 forks source link

Missing transactions in CDC-CSV javascript function #1

Open cryptoltruist opened 2 years ago

cryptoltruist commented 2 years ago

Thank you so much for the CDC CSV Exporter javascript function. I have been using it to great success until now to do my crypto taxes.

Today when calculating taxes my software detected missing transactions due to negative balances. I was able to track down the issue to the CDC exchange, and to the rewards more specifically.

Further investigation revealed that the javascript misses 2 out of my 5 CRO trading rebates, as well as 10 of my 210 supercharger rewards. In addition to the missing "Sign Up Bonus Amount" which I was already aware of and added manually. That said, it does have all of the CRO staking interest and soft staking rewards. These missing transactions are not due to using an old file as I have tried downloading a fresh version of the file and comparing directly with the CDC exchange records.

I was wondering if you would be able to free sufficient time to look into this issue so that hopefully we can find a fix and continue using this superb script. Are you for instance able to replicate this issue on your side?

To get us started, I wonder if this might have to do with the fact that the CDC exchange shows this message when trying to download the file directly: "Date range cannot exceed 6 months". Any idea? Again, thanks so much for your precious time on this issue.

Edit: Further info

For the supercharger rewards, the earliest date downloaded in the CSV is 2021-08-19, whereas on the exchange history I can see 10 additional supercharger rewards dating 2021-08-18 to 2021-08-14, which makes sense in the context of the "earliest dates being excluded". However, it hasn't been 6 months exactly yet (but almost).

In regard of the missing rebates, it is the most recent transactions that are missing: 2021-11-28 and 2021-11-26. So I have no clue for those. Manually downloading the rebates CSV from the CDC exchange does show all 5 rebates.

ConorIA commented 2 years ago

Thanks for opening an issue. I suspect that this may have to do with the number, as opposed to the age of the transactions.

cdc.js requests the first page for each category, and requests 200 results per page. I think this is the maximum.

Can you try this version, which should ask which page you want to download (enter 2).

javascript:(function()%7Bfunction%20callback()%7Bwindow.cdc()%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2FConorIA%2Fcdc-csv%40prompt%2Fcdc.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()

I can run that version of the script in the Developer Tools console, but it doesn't seem to want to prompt me from a new bookmarklet - I suspect something may be cached and should not have been.

cryptoltruist commented 2 years ago

Oh actually this makes sense because I have 210 supercharger rewards and only the first 200 got downloaded (though it does not explain for the rebate category).

I tried the new script from the bookmarklet, and, like you, it didn't ask me which page to download (it just downloaded the csv directly)—I also tried in a private window, same result. However, the csv only contains 10 transactions. Actually, they are the oldest transactions that were missing though, so seems we're on to something! It was probably the second page per default. It would be nice if the script could download the first 200 from the first page, then if > 1 page, download the following pages and combine them before the final csv download.

Edit: I've also tried copy-pasting the script in the Developer Tools console, which I've never used before, and got that error: Uncaught SyntaxError: Unexpected token '%". I'm probably doing something basic wrong haha.

ConorIA commented 2 years ago

@jsdelivrbot purge https://cdn.jsdelivr.net/gh/ConorIA/cdc-csv@prompt/cdc.js

ConorIA commented 2 years ago

@jsdelivrbot purge https://cdn.jsdelivr.net/gh/ConorIA/cdc-csv@master/cdc.js

ConorIA commented 2 years ago

Not sure if that will work. It seems jsDelivr has caches an old version of the script and we need to wait for it to invalidate its cache. Then the prompt should work. 🤞🏻

Otherwise 12 hrs to 7 days: https://github.com/jsdelivr/jsdelivr/issues/18124#issuecomment-455339682