Skip to content

Most alphas are incorrectly implemented in 101Alpha_code_2 #2

@quantverse

Description

@quantverse

Please note that most of the generated code in 101Alpha_code_2 is completely incorrect. This is especially visible on the delay implementation - all wrong. But not only limited to. For instance take a look on the alpha22 implementation. It will always return zeros. The corrected and optimized alpha22 code could look like this one:

#  (-1 * (delta(correlation(high, volume, 5), 5) * rank(stddev(close, 20))))
class Alpha22:
    # inputs = [USEquityPricing.high, USEquityPricing.volume, USEquityPricing.close]
    window_length = 20
    def compute(self, today, assets, out, high, volume, close):
        ds = pd.DataFrame(high[-10:]).rolling(window=5).corr(pd.DataFrame(volume[-10:])).values
        v10 = ds[-1] - ds[-6]
        v110 = np.std(close[-20:], axis=0)
        v11 = stats.rankdata(v110)
        v1 = v10 * v11
        out[:] = -1. * v1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions