This repository has been archived on 2025-10-29. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
gekko/core/stats.js
T
2021-06-06 20:25:14 +02:00

18 lines
395 B
JavaScript

const stats = require('stats-lite');
const lodash = require('lodash');
// simply monkey patch the stats with other stuff we
// need and pass on.
// sharpe ratio
//
// @param returns (array - list of returns)
// @param rfreturn (number - risk free return)
//
stats.sharpe = (returns, rfreturn) => {
return (stats.mean(returns) - rfreturn) / stats.stdev(returns);
}
module.exports = stats;