tempData =FileAttachment("./data/crypto_data_030723.csv").csv().then(function(data) { data.forEach(function(d) { d.datez= d3.timeParse("%Y-%m-%d")(d.date); });return data; })tempData2 = aq.from(tempData).params({startDateSelect: startDateSelect}).params({endDateSelect: endDateSelect}).filter((d, $) => d.datez>= $.startDateSelect).filter((d, $) => d.datez<= $.endDateSelect).objects()tempData3 = aq.from(tempData2).derive({"date": d => d.datez}).derive({"S&P 500": d =>+d.GSPC}).derive({"VIX": d =>+d.VIX}).derive({"Russell 2000": d =>+d.RUT}).derive({"Crude Oil": d =>+d.CL}).derive({"Gold": d =>+d.GC}).derive({"Silver": d =>+d.SI}).derive({"Euro": d =>+d.EUR}).derive({"Pound": d =>+d.GBP}).derive({"Ruble": d =>+d.RUB}).derive({"Yen": d =>+d.JPY}).derive({"Real": d =>+d.BRL}).derive({"Rupee": d =>+d.INR}).derive({"Bitcoin": d =>+d.BTC}).derive({"Ethereum": d =>+d.ETH}).derive({"Binance": d =>+d.BNB}).derive({"Ripple": d =>+d.XRP}).derive({"Cardano": d =>+d.ADA}).derive({"Polygon": d =>+d.MATIC}).derive({"DogeCoin": d =>+d.DOGE}).derive({"Binance USD": d =>+d.BUSD}).derive({"Tether": d =>+d.USDT}).derive({"USD Coin": d =>+d.USDC}).derive({"FTX Token": d =>+d.FTT}).select("date","S&P 500","Russell 2000","VIX","Crude Oil","Gold","Silver","Euro","Pound","Ruble","Yen","Real","Rupee","Bitcoin","Ethereum","Binance","Ripple","Cardano","Polygon","DogeCoin","Binance USD","Tether","USD Coin","FTX Token").fold(aq.not('date'), { as: ['id','value'] }).orderby('id').objects();tempData4 = aq.from(tempData2).derive({"date": d => d.datez}).derive({"S&P 500": d =>+d["GSPC.Adjusted"]}).derive({"VIX": d =>+d["VIX.Adjusted"]}).derive({"Russell 2000": d =>+d["RUT.Adjusted"]}).derive({"Crude Oil": d =>+d["CL=F.Adjusted"]}).derive({"Gold": d =>+d["GC=F.Adjusted"]}).derive({"Silver": d =>+d["SI=F.Adjusted"]}).derive({"Euro": d =>+d["EURUSD=X.Adjusted"]}).derive({"Pound": d =>+d["GBPUSD=X.Adjusted"]}).derive({"Ruble": d =>+d["RUBUSD=X.Adjusted"]}).derive({"Yen": d =>+d["JPYUSD=X.Adjusted"]}).derive({"Real": d =>+d["BRLUSD=X.Adjusted"]}).derive({"Rupee": d =>+d["INRUSD=X.Adjusted"]}).derive({"Bitcoin": d =>+d["BTC-USD.Adjusted"]}).derive({"Ethereum": d =>+d["ETH-USD.Adjusted"]}).derive({"Binance": d =>+d["BNB-USD.Adjusted"]}).derive({"Ripple": d =>+d["XRP-USD.Adjusted"]}).derive({"Cardano": d =>+d["ADA-USD.Adjusted"]}).derive({"Polygon": d =>+d["MATIC-USD.Adjusted"]}).derive({"DogeCoin": d =>+d["DOGE-USD.Adjusted"]}).derive({"Binance USD": d =>+d["BUSD-USD.Adjusted"]}).derive({"Tether": d =>+d["USDT-USD.Adjusted"]}).derive({"USD Coin": d =>+d["USDC-USD.Adjusted"]}).derive({"FTX Token": d =>+d["FTT-USD.Adjusted"]}).select("date","S&P 500","Russell 2000","VIX","Crude Oil","Gold","Silver","Euro","Pound","Ruble","Yen","Real","Rupee","Bitcoin","Ethereum","Binance","Ripple","Cardano","Polygon","DogeCoin","Binance USD","Tether","USD Coin","FTX Token").fold(aq.not('date'), { as: ['id','price'] }).orderby('id').objects();data = aq.from(tempData3).join_left(aq.from(tempData4), [["date","id"], ["date","id"]]).objects();dataSum = aq.from(data).groupby("id").rollup({"absMDC": d => op.mean(op.abs(d.value))}).objects();