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

关于action记录的一些疑问 #30

Open
StephenLee2016 opened this issue Sep 21, 2023 · 2 comments
Open

关于action记录的一些疑问 #30

StephenLee2016 opened this issue Sep 21, 2023 · 2 comments

Comments

@StephenLee2016
Copy link

1、想请教一下,action的record有demo可以提供一下嘛?具体需要记录哪些字段?现在我可以用update_action更新和记录action,但是在后续一些调用上会出现利用action信息进行统计,会出现字段不匹配的问题。
2、PerformanceCTA中action['no']字段具体该填哪些信息?
if action["offset"] == "OPEN":
open_trades[gateway_name][security][action['no']] = action
elif action["offset"] == "CLOSE":
close_trd = action

@josephchenhk
Copy link
Owner

你好,应该demo的例子就包括了action的记录。action['no']是记录同一个标的的开仓次数,比如你第一次开仓,可以标记1,然后你再加仓的时候,就标记2,如此类推。

@StephenLee2016
Copy link
Author

StephenLee2016 commented Sep 21, 2023

你好,应该demo的例子就包括了action的记录。action['no']是记录同一个标的的开仓次数,比如你第一次开仓,可以标记1,然后你再加仓的时候,就标记2,如此类推。

多谢回复,还有几个问题需要帮忙解答一下
1、demo例子里action的记录貌似没看到,跑了之后存好的csv文件action字段是空,我自己添加了update_action调用,目前可以记录了。然后action[‘no’]我是用get_all_orders方法取的记录自己解析之后算的,不知道是否有更便捷的取法?
2、 下面几行代码中的close_trd["close"] 中的“close ”是代表什么意义?
close_trd_price = close_trd["close"]
open_trd_price = open_trd["close"]
# make a copy, instead of a reference!

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