fitness function for rsi using genetic algorithms

让人想犯罪 __ 提交于 2021-01-20 13:39:06

问题


This code is implementing a fitness function for rsi indicators using genetic algorithms but i have no idea what are the output for every function

def strategy_return(trading_signal, asset_return):
    strat_ret = np.array(trading_signal[0:-1]) * np.array(asset_return[1::])
    strat_ret = np.insert(strat_ret, 0, np.nan)
    return strat_ret

def _cumulative_return(ret):
    cum_ret_list = [ret[0]]
    n = ret.shape[0]
    for i in range(1, n):
        cum_ret = (1 + ret[i]) * (1 + cum_ret_list[-1]) - 1
        cum_ret_list.append(cum_ret)
    cum_ret_list.insert(0, np.nan)
    return cum_ret_list

def fit_evaluation(strategy_return):
    strat_cum_ret = _cumulative_return(strat_ret[1::])
    return strat_cum_ret

来源:https://stackoverflow.com/questions/65580865/fitness-function-for-rsi-using-genetic-algorithms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!