[英]Difference between use = “txns” and use = “trades” in tradeStrats()?
I'm backtesting a trading strategy using the quantstrat
package, when generating trade statistics using the tradeStats()
function, what does de use =
argument changes if using "txns"
instead of "trades"
as the argument.我正在使用
quantstrat
package 对交易策略进行回测,当使用tradeStats()
function 生成交易统计数据时,如果使用"txns"
而不是"trades"
作为参数,de use =
参数会发生什么变化。
The tradeStats
function is in blotter...you can read the source here -https://github.com/braverock/blotter/blob/master/R/tradeStats.R . tradeStats
function 在吸墨纸中……您可以在此处阅读源代码 -https://github.com/braverock/blotter/blob/master/R/tradeStats.ZE1E1D3D40573127E9ZEE048 。 When using "txns"
the PnL is derived from the portfolio object, which typically is marked daily to the close price.当使用
"txns"
时,盈亏来自投资组合 object,通常以每日收盘价标记。 When using "trades"
the PnL will be based on the round trip trade (at least one buy txn and one sell txn, for example) which could be longer or shorter than the period used in the txn PL calculation.当使用
"trades"
时,盈亏将基于往返交易(例如,至少一笔买入 txn 和一笔卖出 txn),这可能比 txn 盈亏计算中使用的周期更长或更短。 For intraday and other high frequency strategies you probably want to use "trades"
and for lower frequency strategies that trade over periods typically spanning more than 1 day you probably want to use "txns"
so that you get the analysis based on a daily mark-to-market of your portfolio.对于日内和其他高频策略,您可能想要使用
"trades"
,而对于交易周期通常超过 1 天的低频策略,您可能想要使用"txns"
,以便您获得基于每日标记的分析-将您的投资组合推向市场。 HTH. HTH。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.