Query editor
With TurbineDailyIN as (select Date(S.evt_block_time) as Day, sum(value / 1e18) as DailyBTCInFROM elephant_bnb.BTCTurbine_evt_Sweep Sjoin btcb_bnb.BEP20Token_evt_Transfer Ton S.evt_tx_hash = T.evt_tx_hashwhere to = 0x69c714f868855ec3f24dfff0fd5f1805642f2d86 --BTC Turbine--and S.evt_tx_hash = 0xab6b61d02f8f5fda57c9f6cfbbdd77c0a92efde3035323574b62b1cc41cefec2group by Date(S.evt_block_time)),TurbineDailyOut as (select Date(S.evt_block_time) as Day,sum(underlyingAmount / 1e18) * -1 as DailyBTCOUTfrom elephant_bnb.BTCTurbine_evt_Sweep S-- Where S.evt_tx_hash = 0xab6b61d02f8f5fda57c9f6cfbbdd77c0a92efde3035323574b62b1cc41cefec2group by Date(S.evt_block_time)),DailyElePurchased as (select Date(S.evt_block_time) as Day, sum(value / 1e9) as ElephantPurchasedFROM elephant_bnb.BTCTurbine_evt_Sweep Sjoin elephant_bnb.ElephantToken_evt_Transfer Ton S.evt_tx_hash = T.evt_tx_hash-- where S.evt_tx_hash = 0xab6b61d02f8f5fda57c9f6cfbbdd77c0a92efde3035323574b62b1cc41cefec2group by Date(S.evt_block_time))select A.block_day,A.amount_raw / 1e18 as BTCAmount, (amount_raw / 1e18) * COALESCE((SELECT price_closeFROM prices.usd_dailyWHERE contract_address = 0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c AND day = A.block_day),(SELECT priceFROM prices.usd_latestWHERE contract_address = 0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c) --If the Daily table isn't populated yet, just use the most recent price instead of showing blank.) AS BTCAmountUSD, TIN.DailyBTCIn, TOUT.DailyBTCOut,EP.ElephantPurchased / 1000000 as ElephantPurchased --In Millionsfrom balances_bnb.bep20_day Aleft JOIN TurbineDailyIN TIN ON A.block_day = TIN.Dayleft JOIN TurbineDailyOut TOUT ON A.block_day = TOUT.Dayleft JOIN DailyElePurchased EP ON A.block_day = EP.Daywhere wallet_address = 0x69C714f868855eC3F24dfff0fd5F1805642F2D86 --BTC Turbine Wallet's Addressand token_address = 0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c --BTCB Token Addressorder by A.block_day desc