1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include <math.h>
#include <stddef.h>
#include "ts.h"
bool ts_test_historical_volatility( void )
{
fp_t const x[] = { 100, 101, 100, 102, 101, 100, 103, 101, 102, 100 };
fp_t const * const inp[1] = { x };
/* k=3, initial window at y[0][2], rolling windows at y[0][3..8] */
fp_t const e[] = { 0.196453, 0.222285, 0.222285, 0.295293, 0.337649, 0.320724, 0.221194, 0 };
fp_t const * const exp[1] = { e };
uint_t k = 3;
return ts_test(ts_historical_volatility, ts_historical_volatility_offset, inp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)&k, &ts_historical_volatility_p);
}
|