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

coinbase: scrape transaction history #29

Open
dckc opened this issue Nov 3, 2022 · 1 comment
Open

coinbase: scrape transaction history #29

dckc opened this issue Nov 3, 2022 · 1 comment

Comments

@dckc
Copy link
Owner

dckc commented Nov 3, 2022

I downloaded a "complete" transaction report, but the transactions don't add up to the balance. It seems to be missing "transfers".

But I seem to be able to compute the balance using a DOM query:

acs = document.querySelectorAll('*[data-element="AmountContainer"]')
acs.length // 245
ns = [...acs].map(ac => Number(ac.textContent.split(' ')[0].replace('−', '-').replace('+', '').replace(',', '')))
sum = ns => ns.reduce((acc, x) => acc + x, 0)
sum(ns)

To get associated transaction info, I'm starting with...

tis = document.querySelectorAll('*[data-component="TransactionItem"]')
@dckc
Copy link
Owner Author

dckc commented Nov 5, 2022

txInfo = tr => ({ date: tr.getAttribute('aria-label').replace(' transaction details', ''), title: tr.querySelector('*[data-element="TitleWrapper"] span').textContent, status: tr.querySelector('*[data-element="TitleWrapper"] p').textContent, amount: Number(tr.querySelector('*[data-element="AmountContainer"]').textContent.split(' ')[0].replace('−', '-').replace('+', '').replace(',', '')) })
txs = [...tis].map(txInfo)
JSON.stringify(txs)

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

1 participant