fantaAverage period
    Updated 2022-05-09
    with deposit as
    (
    select block_timestamp::date as dt,from_address,amount_usd from ethereum.udm_events
    where to_address_name = 'sushiswap: bentoboxv1'
    and cast(amount_usd as INTEGER)> 50 and tx_id in (select tx_id from ethereum.udm_events where event_name='LogDeposit')
    )
    , withdrawal as
    (
    select block_timestamp::date as dt,from_address,amount_usd from ethereum.udm_events
    where to_address_name = 'sushiswap: bentoboxv1'
    and cast(amount_usd as INTEGER)> 50 and tx_id in (select distinct tx_id from ethereum.udm_events where event_name='LogWithdraw')
    )
    , holding_period as
    (
    select d.from_address::string as users, avg(datediff('hour',d.dt,w.dt)) as diff
    from deposit as d left join withdrawal as w on d.from_address = w.from_address and d.dt < w.dt and w.amount_usd * 2 >= d.amount_usd
    group by users
    having diff != 0
    )
    , total as
    (
    select distinct from_address from ethereum.udm_events where to_address_name = 'sushiswap: bentoboxv1'
    and cast(amount_usd as INTEGER)> 50
    )
    , scoin as
    (
    select distinct from_address from ethereum.udm_events where to_address_name = 'sushiswap: bentoboxv1'
    and cast(amount_usd as INTEGER)> 50 and symbol in ('DAI','USDT','UST','USDC','BUSD','TUSD','DGX','SUSD','PAX','GUSD','USDP',
    'USDN','FEI','TRIBE','FRAX','LUSD','HUSD','USDD','USDX','XSGD','EURS','SUSD','RSR','OUSD','CUSD','QC','VAI',
    'MUSD','SBD','DGD','RSV','KRT','USDK','IDRT','BITCNY','ESD','EOSDT','XCHF','XAUR','BAC','ITL','USNBT','MIM',
    'DUSD','AGEUR','ALUSD','EURT','XIDR','TRYB','USDs','TOR','SEUR','PAR','FLOAT','xDAI','YUSD','CEUR','ONC','MTR','1GOLD','XUSD',
    'COUSD','ZUSD','USDP','ARTH','COFFIN','USDB','MDO','IRON','DPT','BRCP','KBC','USDQ','BSD','DSD','MDS','CADC','JPYC','AUSD')
    Run a query to Download Data