1
0

Kucoin balances with format similar to defi_mpc
Some checks failed
Build container / Package-Python (push) Failing after 23s
Build container / Package-Container (push) Successful in 1m17s

This commit is contained in:
Jon Michael Aanes 2024-05-17 00:29:02 +02:00
parent 63bffd9c63
commit c42092137e
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -36,16 +36,12 @@ class KucoinAccountBalances(Scraper):
deduplicate_ignore_columns = ['account.update_time']
def scrape(self) -> Iterator[Mapping[str, object]]:
time = datetime.datetime.now()
for account in client.get_accounts():
print(account)
data_point = {
'account.id': account['id'],
'account.currency': account['currency'],
'account.type': account['type'],
'account.balance': account['balance'],
'account.update_time': time,
'account.update_time': datetime.datetime.now(tz=datetime.UTC),
}
for account in client.get_accounts():
key = f"balance.{account['currency']}"
data_point[key] = data_point.get(key, Decimal(0)) + Decimal(account['balance'])
yield frozendict(data_point)