Type/to search

收益率统计

Tool
2
Follow
4
Followers

统计收益率

BotVS的收益统计只能记录一根曲线。不能进行技术分析。 此模板可以实现自动统计最近1日,上1日,最近7日,上个7日,最近30日,上30日 和所有时间的收益,收益率,月化收益率,年化收益率以及最大回撤。(根据短时间段计算出来的月化和年化收益率没有用复利算法。)

用法: 引入此模板,替换原来策略的LogProfit函数为$.LogProfit。 并在 LogStatus 的地方,添加 $.ProfitSummary(初始资金) 的返回字符串

例如:
function main() {
while(true) {
var t = exchange.GetTicker();
$.LogProfit(t.Last);
LogStatus($.ProfitSummary(10000));
Sleep(3600000);
}
}

显示效果:

1日: 收-78.44元(-0.537%),月化-16.781%,年化-204.169%,回撤1.106%
上1日: 收176.08元(1.221%),月化38.226%,年化465.087%,回撤1.236%
7日: 收771.74元(5.599%),月化24.141%,年化293.719%,回撤1.517%
上7日: 收223.15元(1.64%),月化7.071%,年化86.039%,回撤0.9%
30日: 收1570.31元(12.094%),月化12.111%,年化147.352%,回撤3.251%
上30日: 收200.12元(1.565%),月化1.567%,年化19.076%,回撤1.521%
总: 收4554.11元(45.541%),最大回撤3.251%,统计时间74天23小时

Source
JavaScript
$.LogProfit = function(profit) {
    var args = Array.prototype.slice.call(arguments);
    if (SYS_LOGPROFIT) {
        LogProfit.apply(this, args);
    } else {
        args.unshift('收益');
        Log.apply(this,args);
    }

    var _history = $.GetAllProfit();
    _history.push([ Math.floor(new Date().getTime()/1000), profit]);
    _G('profit_history', JSON.stringify(_history));
Strategy parameters
Strategy parameters
是否同时记录到系统自带的LogProfit
Comment
All comments (5)

    用了该模板,回测速度很慢。。。

    7 years ago

    非常感谢

    10 years ago

    还是不会用 求联系方式

    10 years ago

    谢谢,正需要呢~

    10 years ago

    支持

    10 years ago
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)