-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbench_test.go
101 lines (97 loc) · 3.34 KB
/
bench_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package tart
import (
"testing"
"github.com/markcheno/go-talib"
)
func BenchmarkTart(b *testing.B) {
for i := 0; i < b.N; i++ {
AdArr(testHigh, testLow, testClose, testVolume)
AdOscArr(testHigh, testLow, testClose, testVolume, 3, 10)
AdxArr(testHigh, testLow, testClose, 14)
AdxRArr(testHigh, testLow, testClose, 5)
ApoArr(SMA, testClose, 12, 26)
AroonArr(testHigh, testLow, 14)
AroonOscArr(testHigh, testLow, 14)
AtrArr(testHigh, testLow, testClose, 14)
BBandsArr(SMA, testClose, 5, 2.0, 2.0)
BopArr(testOpen, testHigh, testLow, testClose)
CciArr(testHigh, testLow, testClose, 14)
CmoArr(testClose, 14)
DemaArr(testClose, 10)
DiffArr(testClose, 10)
DxArr(testHigh, testLow, testClose, 14)
EmaArr(testClose, 20)
KamaArr(testClose, 10)
MaArr(DEMA, testClose, 20)
MacdArr(testClose, 12, 26, 9)
MacdExtArr(testClose, SMA, 12, SMA, 26, SMA, 9)
MaxArr(testClose, 10)
MfiArr(testHigh, testLow, testClose, testVolume, 14)
MinArr(testClose, 10)
NatrArr(testHigh, testLow, testClose, 14)
ObvArr(testClose, testVolume)
PpoArr(testClose, SMA, 12, 26)
RocArr(testClose, 10)
RsiArr(testClose, 10)
SmaArr(testClose, 20)
StdDevArr(testClose, 10)
StochFastArr(testHigh, testLow, testClose, 5, SMA, 3)
StochRsiArr(testClose, 14, 5, SMA, 2)
StochSlowArr(testHigh, testLow, testClose, 5, SMA, 3, SMA, 3)
SumArr(testClose, 10)
TemaArr(testClose, 10)
TRangeArr(testHigh, testLow, testClose)
TrimaArr(testClose, 10)
TrixArr(testClose, 5)
UltOscArr(testHigh, testLow, testClose, 7, 14, 28)
VarArr(testClose, 10)
WillRArr(testHigh, testLow, testClose, 9)
WmaArr(testClose, 10)
}
}
func BenchmarkTalib(b *testing.B) {
for i := 0; i < b.N; i++ {
talib.Ad(testHigh, testLow, testClose, testVolume)
talib.AdOsc(testHigh, testLow, testClose, testVolume, 3, 10)
talib.Adx(testHigh, testLow, testClose, 14)
talib.AdxR(testHigh, testLow, testClose, 5)
talib.Apo(testClose, 12, 26, talib.SMA)
talib.Aroon(testHigh, testLow, 14)
talib.AroonOsc(testHigh, testLow, 14)
talib.Atr(testHigh, testLow, testClose, 14)
talib.BBands(testClose, 5, 2.0, 2.0, talib.SMA)
talib.Bop(testOpen, testHigh, testLow, testClose)
talib.Cci(testHigh, testLow, testClose, 14)
talib.Cmo(testClose, 14)
talib.Dema(testClose, 10)
talib.Mom(testClose, 10)
talib.Dx(testHigh, testLow, testClose, 14)
talib.Ema(testClose, 20)
talib.Kama(testClose, 10)
talib.Ma(testClose, 20, talib.DEMA)
talib.Macd(testClose, 12, 26, 9)
talib.MacdExt(testClose, 12, talib.SMA, 26, talib.SMA, 9, talib.SMA)
talib.Max(testClose, 10)
talib.Mfi(testHigh, testLow, testClose, testVolume, 14)
talib.Min(testClose, 10)
talib.Natr(testHigh, testLow, testClose, 14)
talib.Obv(testClose, testVolume)
talib.Ppo(testClose, 12, 26, talib.SMA)
talib.Roc(testClose, 10)
talib.Rsi(testClose, 10)
talib.Sma(testClose, 20)
talib.StdDev(testClose, 10, 1.0)
talib.StochF(testHigh, testLow, testClose, 5, 3, talib.SMA)
talib.StochRsi(testClose, 14, 5, 2, talib.SMA)
talib.Stoch(testHigh, testLow, testClose, 5, 3, talib.SMA, 3, talib.SMA)
talib.Sum(testClose, 10)
talib.Tema(testClose, 10)
talib.TRange(testHigh, testLow, testClose)
talib.Trima(testClose, 10)
talib.Trix(testClose, 5)
talib.UltOsc(testHigh, testLow, testClose, 7, 14, 28)
talib.Var(testClose, 10)
talib.WillR(testHigh, testLow, testClose, 9)
talib.Wma(testClose, 10)
}
}