fixed libs
This commit is contained in:
parent
528be93804
commit
5cd24ade09
6 changed files with 29 additions and 420 deletions
|
|
@ -812,25 +812,6 @@ export function amihudIlliquidityHFT(
|
|||
return validTrades > 0 ? illiquiditySum / validTrades : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parkinson Volatility
|
||||
*/
|
||||
export function parkinsonVolatility(
|
||||
highPrices: number[],
|
||||
lowPrices: number[]
|
||||
): number {
|
||||
if (highPrices.length !== lowPrices.length || highPrices.length < 2) return 0;
|
||||
|
||||
let sumSquaredLogHL = 0;
|
||||
for (let i = 0; i < highPrices.length; i++) {
|
||||
const logHL = Math.log(highPrices[i] / lowPrices[i]);
|
||||
sumSquaredLogHL += logHL * logHL;
|
||||
}
|
||||
|
||||
const parkinsonVariance = (1 / (4 * highPrices.length * Math.log(2))) * sumSquaredLogHL;
|
||||
return Math.sqrt(parkinsonVariance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Garman-Klass Volatility
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue