Hello!
The following code generates look ahead bias while no data is used at all. Can you explain why?
import alphien
import numpy as np
dtf = alphien.DataFeatures(tickers=alphien.getTickersCryptoSelector(asTickers=True), fields= [“bb_live”,‘OHLC’])
dtf.load(zoom = “2017::2020”)
def mypayoutrandom(dtf):
allocationWeights = alphien.equalWeightCryptoSelect(dtf)
newweights = np.random.sample((4,))
newweights /= (2*np.sum(newweights))
allocationWeights.loc[:, “BTCUSD.bb_live”] = np.array([0.5] * len(allocationWeights))
allocationWeights.loc[:, “ETHUSD.bb_live”] = np.array([newweights[0]] * len(allocationWeights))
allocationWeights.loc[:, “LTCUSD.bb_live”] = np.array([newweights[1]] * len(allocationWeights))
allocationWeights.loc[:, “XRPUSD.bb_live”] = np.array([newweights[2]] * len(allocationWeights))
allocationWeights.loc[:, “USDTUSD.bb_live”] = np.array([newweights[3]] * len(allocationWeights))
return allocationWeights
port = alphien.cryptoPortfolio(alphien.getTickersCryptoSelector(asTickers=True))
port.payout(mypayoutrandom)
port.evaluate(zoom=“2017::2020”)
port.checkCryptoSubmission()