AI量化系统Quantlab V1.7代码更新,支持pybroker引擎,含大类资产风险平价及波动率策略源码集,平均年化15%

系统代码发布V1.7:

图片

代码及数据均可以下载,请同学们更新:

图片

今日todo:

1、完成量化平台发布代码前检查,发布v1.7。

freeze requirements.txt。

select signal去掉做空,weight equally。

2、gpquant/gplearn代码对比。看下如何改造。

3、alphanet端到端的因子挖掘与合成框架代码。

大家更新环境时,使用pip install requirements_freezed.txt,这样就不会有版本问题。

图片

按信号选股,去掉做空逻辑:

class SelectBySignal(Algo):
    def __init__(self, rules_buy=[], buy_at_least_count=1, rules_sell=[], sell_at_least_count=1):
        super(SelectBySignal, self).__init__()
        self.rules_buy = rules_buy
        self.rules_sell = rules_sell

        if buy_at_least_count > len(rules_buy):
            buy_at_least_count = len(rules_buy)
        if buy_at_least_count <= 0:
            buy_at_least_count = 1
        self.buy_at_least_count = buy_at_least_count

        if sell_at_least_count > len(rules_sell):
            sell_at_least_count = len(rules_sell)
        if sell_at_least_count <= 0:
            sell_at_least_count = 1
        self.sell_at_least_count = sell_at_least_count

    def _check_if_matched(self, df_bar, rules, at_least_count):
        se_count = pd.Series(index=df_bar.index, data=0)
        for r in rules:
            se_count += df_bar.eval(r)

        matched_items = se_count[(se_count.values >= at_least_count)].index
        return list(matched_items)

    def __call__(self, target):
        df_bar = target.df_bar
        matched_buy = []
        matched_sell = []
        if self.rules_buy and len(self.rules_buy):
            matched_buy = self._check_if_matched(df_bar, self.rules_buy, self.buy_at_least_count)

        if self.rules_sell and len(self.rules_sell):
            matched_sell = self._check_if_matched(df_bar, self.rules_sell, self.sell_at_least_count)

        holdings = target.get_long_symbols()
        if holdings and len(holdings) > 0:
            matched_buy += holdings

        if matched_sell:
            for sell in matched_sell:
                if sell in matched_buy:
                    matched_buy.remove(sell)

        target.temp['selected'] = matched_buy
        return True

吾日三省吾身

昨天看到一个词叫“去魅”,有意思。

你永远无法评价一个你不曾得到的东西,那是阿Q心态,酸葡萄心理。

人总是在痛苦和无聊之间徘徊。

得不到的痛苦,得到就无聊。

然后寻找更高的目标去痛苦。

儿时,一罐八宝粥或者一听健力宝,就算愿望。

学生时代,几张烧饼,一本故事会或者小小说,就是美好的中午时光。

长大后,你有能力随意安排时,你发现也就那样。

东西还是那些东西,味却不对。

满满当当的超市,找不到一件想吃的东西。

世界那么大,我们想去看看。

被困在写字楼的方寸之间,其实当你走遍世界,你发现不过如此。

旅行就是去一个别人待腻了的地方拍照。

但你只有去了,方能“去魅”。

人生本来就是一场体验,尽最大可能性去体验,深度体验罢了。

当然不必穷举,走遍数十个城市之后,你发现城市其实大同小异。

没有感受风土人情是一种遗憾,人生尽量少留遗憾。

昨天看到一篇文章,批评冯唐,说他高高在上,自己得到的所有,劝年轻人躺平。

也许,到达顶峰的人,确实发现也就那样。

马云说他不需要钱,也是真的。

但是,只有你真的有钱,你才可以这么说。

发布者:股市刺客,转载请注明出处:https://www.95sca.cn/archives/103807
站内所有文章皆来自网络转载或读者投稿,请勿用于商业用途。如有侵权、不妥之处,请联系站长并出示版权证明以便删除。敬请谅解!

(0)
股市刺客的头像股市刺客
上一篇 2024 年 7 月 29 日
下一篇 2024 年 7 月 29 日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注