int __stdcall NDK_PORTFOLIO_COVARIANCE | ( | double * | weights1, |
double * | weights2, | ||
size_t | nAssets, | ||
double ** | covar, | ||
double * | retVal | ||
) |
Calculates the covariance between two portfolios.
- Returns
- status code of the operation
- Return values
-
NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See Macros for full list.
- Remarks
-
- For uncorrelated assets, the covariance matrix is zero for all off-diagnonal elements. In this case, the covariance matrix (V) can be passed as an array of only variances (a one dimensional array).
- The weights array size must equal to the number of risky assets.
- The assets order in must be identical in the covariance and assets weights arrays.
- By definition, the covariance matrix is a square symmetric matrix with order equals to number of assets in the portfolio.
- The number of unique elements in the covariance matrix is equal to: \[\frac{N \times (N+1)}{2}\] Where: \(N\) is the number of risky assets in the portfolio.
- Requirements
-
Header SFSDK.H Library SFSDK.LIB DLL SFSDK.DLL
- References
- * Hamilton, J .D.; Time Series Analysis , Princeton University Press (1994), ISBN 0-691-04289-6
- * Tsay, Ruey S.; Analysis of Financial Time Series John Wiley & SONS. (2005), ISBN 0-471-690740
- * D. S.G. Pollock; Handbook of Time Series Analysis, Signal Processing, and Dynamics; Academic Press; Har/Cdr edition(Nov 17, 1999), ISBN: 125609906
- * Box, Jenkins and Reisel; Time Series Analysis: Forecasting and Control; John Wiley & SONS.; 4th edition(Jun 30, 2008), ISBN: 470272848