Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何在已购买的多基金交易单上执行策略 #140

Open
yaduns opened this issue Jul 26, 2021 · 1 comment
Open

如何在已购买的多基金交易单上执行策略 #140

yaduns opened this issue Jul 26, 2021 · 1 comment

Comments

@yaduns
Copy link

yaduns commented Jul 26, 2021

我现在支付宝有10多只基金,从2018年到2020年分批次不同金额买入,一直有个痛点,不知何时退出。
本来想用xalpha来回测基于技术指标点位的交易策略,但是看了一圈后发现好像xalpha只支持按账单交易(一直持有),或者是从零开始买入卖出的交易策略,而不支持在已有交易单上执行买入卖出的交易策略(在我的测试案例里,我只想测试卖出策略)。
请问,该怎么做?

@refraction-ray
Copy link
Owner

通过 backtest 类回测,生成类的时候,手动改掉 BTE.trades 是可以的,不过可能需要你读下 https://github.com/refraction-ray/xalpha/blob/master/xalpha/backtest.py 源码,基本上就是把现成的 trade 类手动放进 BTE.trades 这个字典里

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants