I am trying to write a query to find out stellar balances(for all addresses)but I am not able to get the correct operations to consider in that , maybe because I don't understand stellar very well .
So , the questions I have are as follows .
- How to calculate balance of an address with query. I have a very simple query but not giving correct balances . Here currency_id is for stellar .
SELECT
sum(in_value_xlm) total_in,
sum(out_value_xlm) total_out,
tx_date,
total_in - total_out AS balance
FROM
(
SELECT
0 AS in_value_xlm,
sum(toFloat64(value_from) / 10000000) AS out_value_xlm,
tx_date
FROM stellar_flow.transfers_from
WHERE (transfer_from = '{{ addr }}') AND (currency_from_id = 417896)
GROUP BY tx_date
UNION All
SELECT
sum(toFloat64(value_to) / 10000000) AS in_value_xlm,
0 AS out_value_xlm,
tx_date
FROM stellar_flow.transfers_to
WHERE (transfer_to = '{{ addr }}') AND (currency_to_id = 417896)
GROUP BY tx_date
)
GROUP BY tx_date
- Is there any website/page where I can find daily address stellar balance of an address , similar to stellar expert .
Thank you