[英]Open multiple positions in Backtrader
Does someone know if it's possible to open multiple positions with only a single data feed?有人知道是否可以只用一个数据源就可以开多个头寸吗? I am trying to do a second buy whilst in a position, which doesn't seem to be possible.
我试图在处于某个位置时进行第二次购买,这似乎是不可能的。
Nobody seems to adress this issue.似乎没有人解决这个问题。 Does anyone have any experience with Backtrader and have any input?
有没有人对 Backtrader 有任何经验并有任何意见?
If you are just trying to buy more stock to add to your position, then yes, you should be able to do this and if you cannot recheck your strategy code in next.如果您只是想购买更多股票以增加您的头寸,那么是的,您应该可以这样做,并且如果您接下来无法重新检查您的策略代码。
If you are trying to track two separate positions of the same data...如果您尝试跟踪相同数据的两个不同位置...
One cannot have two separate positions in the same data feed.在同一个数据馈送中不能有两个不同的位置。 You may trade additional positions if you like but they will be combined in Backtrader.
如果您愿意,您可以交易额外的头寸,但它们将在 Backtrader 中合并。 Even if you use two strategies you will still have one combined broker.
即使您使用两种策略,您仍将拥有一个组合经纪人。
The reason for this is to simulate as near as possible real world conditions.这样做的原因是模拟尽可能接近真实世界的条件。 If you have a brokerage account you most likely would have just one postion.
如果你有一个经纪账户,你很可能只有一个职位。 (I know there are exceptions)
(我知道有例外)
One solution would be to track your trading manually in a dictionary trades that result from different signals/sub-strategies.一种解决方案是在由不同信号/子策略产生的字典交易中手动跟踪您的交易。 It's a bit more tedious to develop but very doable.
开发起来有点乏味,但非常可行。 jk
jk
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.