Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports.exp = function(num1,num2) {
const num1Math = Math.bignumber(new BigNumber(num1).toString(10));
const num2Math = Math.bignumber(new BigNumber(num2).toString(10));
const result = Math.pow(num1Math,num2Math);
return new BigNumber(result.toString());
};
if (undefined === balances) {
var message = `balances is undefined`;
currentTestResult.failureMessages.push(message);
acctestutils.addTestResult(classResults, currentTestResult, false);
return;
}
if (balances.length !== 1) {
var message = `balances.length of ${balances.length} was expected to be 1`;
currentTestResult.failureMessages.push(message);
acctestutils.addTestResult(classResults, currentTestResult, false);
return;
}
let plusOne = math.add(math.bignumber(balancesResponse.timestamp), math.bignumber(1));
let minusOne = math.subtract(math.bignumber(balancesResponse.timestamp), math.bignumber(1));
let paq = `${balancesPath}?timestamp=gt:${minusOne.toString()}` + `×tamp=lt:${plusOne.toString()}&limit=1`;
url = acctestutils.getUrl(server, paq);
currentTestResult.url = url;
balances = await getBalances(url, currentTestResult);
if (undefined === balances) {
var message = `balances is undefined`;
currentTestResult.failureMessages.push(message);
acctestutils.addTestResult(classResults, currentTestResult, false);
return;
}
if (balances.length !== 1) {
var message = `balances.length of ${balances.length} was expected to be 1`;
currentTestResult.failureMessages.push(message);
public mathmul(a: number, b: number): number {
return parseFloat(multiply(bignumber(a), bignumber(b)).toString());
}
public mathDiv(a: number, b: number): number {
const calculateBackupTotal = (price, size) => math.round(math.multiply(math.bignumber(price), math.bignumber(size)), 6).toNumber().toFixed(6);
export function buildSharpeRatio(returns) {
const DAILY = 252
const WEEKLY = 52
const MONTLY = 12
const riskFreeReturn = 0
const riskAdjusted = math.subtract(b(returns), b(riskFreeReturn))
const meanReturn = math.mean(b(riskAdjusted))
const standardDeviation = math.std(b(riskAdjusted))
const annualizationFactor = math.sqrt(b(DAILY))
return n(chain(b(meanReturn))
.divide(b(standardDeviation)).multiply(b(annualizationFactor)).done()
)
}
export function buildSharpeRatio(returns) {
const DAILY = 252
const WEEKLY = 52
const MONTLY = 12
const riskFreeReturn = 0
const riskAdjusted = math.subtract(b(returns), b(riskFreeReturn))
const meanReturn = math.mean(b(riskAdjusted))
const standardDeviation = math.std(b(riskAdjusted))
const annualizationFactor = math.sqrt(b(DAILY))
return n(chain(b(meanReturn))
.divide(b(standardDeviation)).multiply(b(annualizationFactor)).done()
)
}
function(
synapse,
synapseIndex,
synapses
) {
synapse.previousWeightChange = synapse.weightChange;
synapse.weightChange = add(
multiply(
bignumber(learningRate),
multiply(
layerNeuron.delta,
synapse.incomingConnection.output
)
),
multiply(
bignumber(momentumRate),
synapse.previousWeightChange
)
);
synapse.previousWeight = synapse.weight;
synapse.weight = add(
synapse.weight,
synapse.weightChange
);
}