Query editor
WITHtransfers AS (SELECTday,address,SUM("value") AS amountFROM(SELECTDATE_TRUNC('day', "evt_block_time") AS day,"to" AS address,cast("value" as INT256) as valueFROMerc20_arbitrum.evt_TransferWHERE"contract_address" = 0x55ff62567f09906a85183b866df84bf599a4bf70UNION ALLSELECTDATE_TRUNC('day', "evt_block_time") AS day,"from" AS address,-1 * cast("value" as INT256) as valueFROMerc20_arbitrum.evt_TransferWHERE"contract_address" = 0x55ff62567f09906a85183b866df84bf599a4bf70) AS txGROUP BY1,2),balances_with_gap_days AS (SELECTt.day,address,SUM(amount) OVER (PARTITION BYaddressORDER BYt.day) AS balance,/* balance per day with a transfer */ LEAD(DAY, 1, CURRENT_TIMESTAMP) OVER (PARTITION BYaddressORDER BYt.day) AS next_day /* the day after a day with a transfer */FROMtransfers AS t),days AS (SELECTDAYFROMUNNEST (SEQUENCE(TRY_CAST('2021-11-21' AS TIMESTAMP),CAST(CAST(CAST(DATE_TRUNC('day', CURRENT_TIMESTAMP) AS TIMESTAMP) AS TIMESTAMP) AS TIMESTAMP