A TypeScript library providing advanced quantitative finance functions for risk analysis, performance metrics, and technical indicators. (Currently in development)
npm install quantitivecalccalculateAlpha - Computes excess returns relative to a benchmark.
calculateAnnualizedReturns - Calculates annualized return.
calculateCalmarRatio - Measures risk-adjusted returns.
calculateCompoundReturns - Calculates compound returns.
calculateDailyReturns - Computes daily returns.
calculateInformationRatio - Assesses risk-adjusted performance.
calculateSortinoRatio - Measures risk-adjusted returns considering downside risk.
calculatePeriodicCompoundReturns - Calculates compound returns over specified periods.
addPeriodicCompoundReturnsToData - Adds periodic compound returns to each row in the dataset.
filterByRange - Filter list items based on a specified range.
findExtremesInColumn - Find min/max values in a column.
getFirstRow - Get the first row/item from a list.
getLastRow - Get the last row/item from a list.
setFirstItemToValue - Set a property on the first item in a list.
sortByColumn - Sort a list by a column.
typescript
import { qCalc } from 'quantitivecalc';
const data = [
{ name: 'Alice', score: 42 },
{ name: 'Bob', score: 75 },
{ name: 'Charlie', score: 60 }
];
const sorted = qCalc.listUtils.sortByColumn(data, 'score', true); // ascending order
console.log(sorted);
// Output: [ { name: 'Alice', score: 42 }, { name: 'Charlie', score: 60 }, { name: 'Bob', score: 75 } ]
`
- analyzeColumnWithRange - Analyze a column and return statistics within a specified range.
$3
- applyFunction - Apply a function to each value in a dictionary.
- applyFunctionToFlattened - Apply a function to each item in flattened lists within a dictionary.
- findExtremesInColumnPerKey - Find min/max values in a column for each key in a dictionary.
- findExtremesInColumn - Find min/max values in a column across all keys.
$3
- calculateCorrelationMatrix - Computes correlation matrix for assets.
- calculatePortfolioReturns - Calculates portfolio returns.
- calculateRebalancing - Determines optimal rebalancing strategies.
- calculateRiskContribution - Analyzes risk contribution of each asset.
- Types: AssetReturn, CorrelationMatrix, PortfolioWeight, RebalancingResult, RiskContribution
$3
- calculateBeta - Computes Beta coefficient.
- calculateMaxDrawdown - Calculates maximum observed loss.
- calculateSharpeRatio - Determines Sharpe Ratio.
- calculateVaR - Estimates Value at Risk.
- calculateVolatility - Measures statistical volatility.
- getZScore - Calculates Z-Score.
$3
- calculateBollingerBands - Calculates Bollinger Bands.
- calculateMACD - Calculates MACD indicator.
- calculateMovingAverage - Calculates moving average.
- calculateRSI - Calculates Relative Strength Index.
- calculateStochasticOscillator - Calculates Stochastic Oscillator.
Installation
`bash
npm install quantitivecalc
``