ta-indicator 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +10 -0
- data/LICENSE-ta-lib +32 -0
- data/README.rdoc +196 -0
- data/Rakefile +13 -0
- data/examples/mapping.rb +43 -0
- data/lib/indicator.rb +56 -0
- data/lib/indicator/auto_gen.rb +163 -0
- data/lib/indicator/auto_gen/acos.rb +44 -0
- data/lib/indicator/auto_gen/ad.rb +44 -0
- data/lib/indicator/auto_gen/ad_osc.rb +58 -0
- data/lib/indicator/auto_gen/add.rb +45 -0
- data/lib/indicator/auto_gen/adx.rb +53 -0
- data/lib/indicator/auto_gen/adxr.rb +53 -0
- data/lib/indicator/auto_gen/apo.rb +63 -0
- data/lib/indicator/auto_gen/aroon.rb +56 -0
- data/lib/indicator/auto_gen/aroon_osc.rb +53 -0
- data/lib/indicator/auto_gen/asin.rb +44 -0
- data/lib/indicator/auto_gen/atan.rb +44 -0
- data/lib/indicator/auto_gen/atr.rb +53 -0
- data/lib/indicator/auto_gen/avg_price.rb +44 -0
- data/lib/indicator/auto_gen/bbands.rb +74 -0
- data/lib/indicator/auto_gen/beta.rb +54 -0
- data/lib/indicator/auto_gen/bop.rb +44 -0
- data/lib/indicator/auto_gen/cci.rb +53 -0
- data/lib/indicator/auto_gen/cdl2_crows.rb +44 -0
- data/lib/indicator/auto_gen/cdl3_black_crows.rb +44 -0
- data/lib/indicator/auto_gen/cdl3_inside.rb +44 -0
- data/lib/indicator/auto_gen/cdl3_line_strike.rb +44 -0
- data/lib/indicator/auto_gen/cdl3_outside.rb +44 -0
- data/lib/indicator/auto_gen/cdl3_stars_in_south.rb +44 -0
- data/lib/indicator/auto_gen/cdl3_white_soldiers.rb +44 -0
- data/lib/indicator/auto_gen/cdl_abandoned_baby.rb +53 -0
- data/lib/indicator/auto_gen/cdl_advance_block.rb +44 -0
- data/lib/indicator/auto_gen/cdl_belt_hold.rb +44 -0
- data/lib/indicator/auto_gen/cdl_breakaway.rb +44 -0
- data/lib/indicator/auto_gen/cdl_closing_marubozu.rb +44 -0
- data/lib/indicator/auto_gen/cdl_conceal_babys_wall.rb +44 -0
- data/lib/indicator/auto_gen/cdl_counter_attack.rb +44 -0
- data/lib/indicator/auto_gen/cdl_dark_cloud_cover.rb +53 -0
- data/lib/indicator/auto_gen/cdl_doji.rb +44 -0
- data/lib/indicator/auto_gen/cdl_doji_star.rb +44 -0
- data/lib/indicator/auto_gen/cdl_dragonfly_doji.rb +44 -0
- data/lib/indicator/auto_gen/cdl_engulfing.rb +44 -0
- data/lib/indicator/auto_gen/cdl_evening_doji_star.rb +53 -0
- data/lib/indicator/auto_gen/cdl_evening_star.rb +53 -0
- data/lib/indicator/auto_gen/cdl_gap_side_side_white.rb +44 -0
- data/lib/indicator/auto_gen/cdl_gravestone_doji.rb +44 -0
- data/lib/indicator/auto_gen/cdl_hammer.rb +44 -0
- data/lib/indicator/auto_gen/cdl_hanging_man.rb +44 -0
- data/lib/indicator/auto_gen/cdl_harami.rb +44 -0
- data/lib/indicator/auto_gen/cdl_harami_cross.rb +44 -0
- data/lib/indicator/auto_gen/cdl_hign_wave.rb +44 -0
- data/lib/indicator/auto_gen/cdl_hikkake.rb +44 -0
- data/lib/indicator/auto_gen/cdl_hikkake_mod.rb +44 -0
- data/lib/indicator/auto_gen/cdl_homing_pigeon.rb +44 -0
- data/lib/indicator/auto_gen/cdl_identical3_crows.rb +44 -0
- data/lib/indicator/auto_gen/cdl_in_neck.rb +44 -0
- data/lib/indicator/auto_gen/cdl_inverted_hammer.rb +44 -0
- data/lib/indicator/auto_gen/cdl_kicking.rb +44 -0
- data/lib/indicator/auto_gen/cdl_kicking_by_length.rb +44 -0
- data/lib/indicator/auto_gen/cdl_ladder_bottom.rb +44 -0
- data/lib/indicator/auto_gen/cdl_long_legged_doji.rb +44 -0
- data/lib/indicator/auto_gen/cdl_long_line.rb +44 -0
- data/lib/indicator/auto_gen/cdl_marubozu.rb +44 -0
- data/lib/indicator/auto_gen/cdl_mat_hold.rb +53 -0
- data/lib/indicator/auto_gen/cdl_matching_low.rb +44 -0
- data/lib/indicator/auto_gen/cdl_morning_doji_star.rb +53 -0
- data/lib/indicator/auto_gen/cdl_morning_star.rb +53 -0
- data/lib/indicator/auto_gen/cdl_on_neck.rb +44 -0
- data/lib/indicator/auto_gen/cdl_piercing.rb +44 -0
- data/lib/indicator/auto_gen/cdl_rickshaw_man.rb +44 -0
- data/lib/indicator/auto_gen/cdl_rise_fall3_methods.rb +44 -0
- data/lib/indicator/auto_gen/cdl_seperating_lines.rb +44 -0
- data/lib/indicator/auto_gen/cdl_shooting_star.rb +44 -0
- data/lib/indicator/auto_gen/cdl_short_line.rb +44 -0
- data/lib/indicator/auto_gen/cdl_spinning_top.rb +44 -0
- data/lib/indicator/auto_gen/cdl_stalled_pattern.rb +44 -0
- data/lib/indicator/auto_gen/cdl_stick_sandwhich.rb +44 -0
- data/lib/indicator/auto_gen/cdl_takuri.rb +44 -0
- data/lib/indicator/auto_gen/cdl_tasuki_gap.rb +44 -0
- data/lib/indicator/auto_gen/cdl_thrusting.rb +44 -0
- data/lib/indicator/auto_gen/cdl_tristar.rb +44 -0
- data/lib/indicator/auto_gen/cdl_unique3_river.rb +44 -0
- data/lib/indicator/auto_gen/cdl_upside_gap2_crows.rb +44 -0
- data/lib/indicator/auto_gen/cdl_x_side_gap3_methods.rb +44 -0
- data/lib/indicator/auto_gen/ceil.rb +44 -0
- data/lib/indicator/auto_gen/cmo.rb +53 -0
- data/lib/indicator/auto_gen/correl.rb +54 -0
- data/lib/indicator/auto_gen/cos.rb +44 -0
- data/lib/indicator/auto_gen/cosh.rb +44 -0
- data/lib/indicator/auto_gen/dema.rb +53 -0
- data/lib/indicator/auto_gen/div.rb +45 -0
- data/lib/indicator/auto_gen/dx.rb +53 -0
- data/lib/indicator/auto_gen/ema.rb +53 -0
- data/lib/indicator/auto_gen/exp.rb +44 -0
- data/lib/indicator/auto_gen/floor.rb +44 -0
- data/lib/indicator/auto_gen/ht_dc_period.rb +44 -0
- data/lib/indicator/auto_gen/ht_dc_phase.rb +44 -0
- data/lib/indicator/auto_gen/ht_phasor.rb +47 -0
- data/lib/indicator/auto_gen/ht_sine.rb +47 -0
- data/lib/indicator/auto_gen/ht_trend_mode.rb +44 -0
- data/lib/indicator/auto_gen/ht_trendline.rb +44 -0
- data/lib/indicator/auto_gen/kama.rb +53 -0
- data/lib/indicator/auto_gen/linear_reg.rb +53 -0
- data/lib/indicator/auto_gen/linear_reg_angle.rb +53 -0
- data/lib/indicator/auto_gen/linear_reg_intercept.rb +53 -0
- data/lib/indicator/auto_gen/linear_reg_slope.rb +53 -0
- data/lib/indicator/auto_gen/ln.rb +44 -0
- data/lib/indicator/auto_gen/log10.rb +44 -0
- data/lib/indicator/auto_gen/macd.rb +69 -0
- data/lib/indicator/auto_gen/macd_ext.rb +84 -0
- data/lib/indicator/auto_gen/macd_fix.rb +59 -0
- data/lib/indicator/auto_gen/mama.rb +61 -0
- data/lib/indicator/auto_gen/max.rb +53 -0
- data/lib/indicator/auto_gen/max_index.rb +53 -0
- data/lib/indicator/auto_gen/med_price.rb +44 -0
- data/lib/indicator/auto_gen/mfi.rb +53 -0
- data/lib/indicator/auto_gen/mid_point.rb +53 -0
- data/lib/indicator/auto_gen/mid_price.rb +53 -0
- data/lib/indicator/auto_gen/min.rb +53 -0
- data/lib/indicator/auto_gen/min_index.rb +53 -0
- data/lib/indicator/auto_gen/min_max.rb +56 -0
- data/lib/indicator/auto_gen/min_max_index.rb +56 -0
- data/lib/indicator/auto_gen/minus_di.rb +53 -0
- data/lib/indicator/auto_gen/minus_dm.rb +53 -0
- data/lib/indicator/auto_gen/mom.rb +53 -0
- data/lib/indicator/auto_gen/moving_average.rb +58 -0
- data/lib/indicator/auto_gen/moving_average_variable_period.rb +64 -0
- data/lib/indicator/auto_gen/mult.rb +45 -0
- data/lib/indicator/auto_gen/natr.rb +53 -0
- data/lib/indicator/auto_gen/obv.rb +44 -0
- data/lib/indicator/auto_gen/plus_di.rb +53 -0
- data/lib/indicator/auto_gen/plus_dm.rb +53 -0
- data/lib/indicator/auto_gen/ppo.rb +63 -0
- data/lib/indicator/auto_gen/roc.rb +53 -0
- data/lib/indicator/auto_gen/roc_p.rb +53 -0
- data/lib/indicator/auto_gen/roc_r.rb +53 -0
- data/lib/indicator/auto_gen/roc_r100.rb +53 -0
- data/lib/indicator/auto_gen/rsi.rb +53 -0
- data/lib/indicator/auto_gen/sar.rb +58 -0
- data/lib/indicator/auto_gen/sar_ext.rb +88 -0
- data/lib/indicator/auto_gen/sin.rb +44 -0
- data/lib/indicator/auto_gen/sinh.rb +44 -0
- data/lib/indicator/auto_gen/sma.rb +53 -0
- data/lib/indicator/auto_gen/sqrt.rb +44 -0
- data/lib/indicator/auto_gen/std_dev.rb +58 -0
- data/lib/indicator/auto_gen/stoch.rb +76 -0
- data/lib/indicator/auto_gen/stoch_f.rb +66 -0
- data/lib/indicator/auto_gen/stoch_rsi.rb +71 -0
- data/lib/indicator/auto_gen/sub.rb +45 -0
- data/lib/indicator/auto_gen/sum.rb +53 -0
- data/lib/indicator/auto_gen/t3.rb +58 -0
- data/lib/indicator/auto_gen/tan.rb +44 -0
- data/lib/indicator/auto_gen/tanh.rb +44 -0
- data/lib/indicator/auto_gen/tema.rb +53 -0
- data/lib/indicator/auto_gen/trima.rb +53 -0
- data/lib/indicator/auto_gen/trix.rb +53 -0
- data/lib/indicator/auto_gen/true_range.rb +44 -0
- data/lib/indicator/auto_gen/tsf.rb +53 -0
- data/lib/indicator/auto_gen/typ_price.rb +44 -0
- data/lib/indicator/auto_gen/ult_osc.rb +63 -0
- data/lib/indicator/auto_gen/variance.rb +58 -0
- data/lib/indicator/auto_gen/wcl_price.rb +44 -0
- data/lib/indicator/auto_gen/will_r.rb +53 -0
- data/lib/indicator/auto_gen/wma.rb +53 -0
- data/lib/indicator/base.rb +19 -0
- data/lib/indicator/data_mapper.rb +93 -0
- data/lib/indicator/mixin.rb +15 -0
- data/lib/indicator/version.rb +3 -0
- data/test/data_mapper_test.rb +76 -0
- metadata +226 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Ta-Lib function mapping class
|
|
2
|
+
# Function: 'STOCH'
|
|
3
|
+
# Description: 'Stochastic'
|
|
4
|
+
# This file has been autogenerated - Do Not Edit.
|
|
5
|
+
class Indicator::AutoGen::Stoch < Indicator::Base
|
|
6
|
+
# Fast-K Period <Integer>
|
|
7
|
+
attr_accessor :fast_k_period
|
|
8
|
+
# Slow-K Period <Integer>
|
|
9
|
+
attr_accessor :slow_k_period
|
|
10
|
+
# Slow-K MA <MA Type>
|
|
11
|
+
attr_accessor :slow_k_ma
|
|
12
|
+
# Slow-D Period <Integer>
|
|
13
|
+
attr_accessor :slow_d_period
|
|
14
|
+
# Slow-D MA <MA Type>
|
|
15
|
+
attr_accessor :slow_d_ma
|
|
16
|
+
|
|
17
|
+
def initialize(*args)
|
|
18
|
+
if args.first.is_a? Hash
|
|
19
|
+
h = args.first
|
|
20
|
+
@fast_k_period = h[:fast_k_period] || 5
|
|
21
|
+
@slow_k_period = h[:slow_k_period] || 3
|
|
22
|
+
@slow_k_ma = h[:slow_k_ma] || 0
|
|
23
|
+
@slow_d_period = h[:slow_d_period] || 3
|
|
24
|
+
@slow_d_ma = h[:slow_d_ma] || 0
|
|
25
|
+
else
|
|
26
|
+
@fast_k_period = args[0] || 5
|
|
27
|
+
@slow_k_period = args[1] || 3
|
|
28
|
+
@slow_k_ma = args[2] || 0
|
|
29
|
+
@slow_d_period = args[3] || 3
|
|
30
|
+
@slow_d_ma = args[4] || 0
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
@func = TaLib::Function.new("STOCH")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Is price data required as an input
|
|
37
|
+
def self.price_input?
|
|
38
|
+
true
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# The list of arguments
|
|
42
|
+
def self.arguments
|
|
43
|
+
[ :fast_k_period, :slow_k_period, :slow_k_ma, :slow_d_period, :slow_d_ma ]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# The minimum set of inputs required
|
|
47
|
+
def self.inputs
|
|
48
|
+
[ :open, :high, :low, :close ]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# The outputs generated by this function
|
|
52
|
+
def self.outputs
|
|
53
|
+
[ :out_slow_k, :out_slow_d ]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def run(*args)
|
|
57
|
+
o, h, l, c, v, len = map_ohlcv(false, *args)
|
|
58
|
+
@func.in_price(0, o, h, l, c, v, nil)
|
|
59
|
+
|
|
60
|
+
@func.opt_int(0, @fast_k_period)
|
|
61
|
+
@func.opt_int(1, @slow_k_period)
|
|
62
|
+
@func.opt_int(2, @slow_k_ma)
|
|
63
|
+
@func.opt_int(3, @slow_d_period)
|
|
64
|
+
@func.opt_int(4, @slow_d_ma)
|
|
65
|
+
|
|
66
|
+
out_slow_k = Array.new(len)
|
|
67
|
+
@func.out_real(0, out_slow_k)
|
|
68
|
+
out_slow_d = Array.new(len)
|
|
69
|
+
@func.out_real(1, out_slow_d)
|
|
70
|
+
|
|
71
|
+
@func.call(0, len - 1)
|
|
72
|
+
|
|
73
|
+
{:out_slow_k => out_slow_k,
|
|
74
|
+
:out_slow_d => out_slow_d}
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Ta-Lib function mapping class
|
|
2
|
+
# Function: 'STOCHF'
|
|
3
|
+
# Description: 'Stochastic Fast'
|
|
4
|
+
# This file has been autogenerated - Do Not Edit.
|
|
5
|
+
class Indicator::AutoGen::StochF < Indicator::Base
|
|
6
|
+
# Fast-K Period <Integer>
|
|
7
|
+
attr_accessor :fast_k_period
|
|
8
|
+
# Fast-D Period <Integer>
|
|
9
|
+
attr_accessor :fast_d_period
|
|
10
|
+
# Fast-D MA <MA Type>
|
|
11
|
+
attr_accessor :fast_d_ma
|
|
12
|
+
|
|
13
|
+
def initialize(*args)
|
|
14
|
+
if args.first.is_a? Hash
|
|
15
|
+
h = args.first
|
|
16
|
+
@fast_k_period = h[:fast_k_period] || 5
|
|
17
|
+
@fast_d_period = h[:fast_d_period] || 3
|
|
18
|
+
@fast_d_ma = h[:fast_d_ma] || 0
|
|
19
|
+
else
|
|
20
|
+
@fast_k_period = args[0] || 5
|
|
21
|
+
@fast_d_period = args[1] || 3
|
|
22
|
+
@fast_d_ma = args[2] || 0
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
@func = TaLib::Function.new("STOCHF")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Is price data required as an input
|
|
29
|
+
def self.price_input?
|
|
30
|
+
true
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# The list of arguments
|
|
34
|
+
def self.arguments
|
|
35
|
+
[ :fast_k_period, :fast_d_period, :fast_d_ma ]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# The minimum set of inputs required
|
|
39
|
+
def self.inputs
|
|
40
|
+
[ :open, :high, :low, :close ]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# The outputs generated by this function
|
|
44
|
+
def self.outputs
|
|
45
|
+
[ :out_fast_k, :out_fast_d ]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def run(*args)
|
|
49
|
+
o, h, l, c, v, len = map_ohlcv(false, *args)
|
|
50
|
+
@func.in_price(0, o, h, l, c, v, nil)
|
|
51
|
+
|
|
52
|
+
@func.opt_int(0, @fast_k_period)
|
|
53
|
+
@func.opt_int(1, @fast_d_period)
|
|
54
|
+
@func.opt_int(2, @fast_d_ma)
|
|
55
|
+
|
|
56
|
+
out_fast_k = Array.new(len)
|
|
57
|
+
@func.out_real(0, out_fast_k)
|
|
58
|
+
out_fast_d = Array.new(len)
|
|
59
|
+
@func.out_real(1, out_fast_d)
|
|
60
|
+
|
|
61
|
+
@func.call(0, len - 1)
|
|
62
|
+
|
|
63
|
+
{:out_fast_k => out_fast_k,
|
|
64
|
+
:out_fast_d => out_fast_d}
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Ta-Lib function mapping class
|
|
2
|
+
# Function: 'STOCHRSI'
|
|
3
|
+
# Description: 'Stochastic Relative Strength Index'
|
|
4
|
+
# This file has been autogenerated - Do Not Edit.
|
|
5
|
+
class Indicator::AutoGen::StochRsi < Indicator::Base
|
|
6
|
+
# Time Period <Integer>
|
|
7
|
+
attr_accessor :time_period
|
|
8
|
+
# Fast-K Period <Integer>
|
|
9
|
+
attr_accessor :fast_k_period
|
|
10
|
+
# Fast-D Period <Integer>
|
|
11
|
+
attr_accessor :fast_d_period
|
|
12
|
+
# Fast-D MA <MA Type>
|
|
13
|
+
attr_accessor :fast_d_ma
|
|
14
|
+
|
|
15
|
+
def initialize(*args)
|
|
16
|
+
if args.first.is_a? Hash
|
|
17
|
+
h = args.first
|
|
18
|
+
@time_period = h[:time_period] || 14
|
|
19
|
+
@fast_k_period = h[:fast_k_period] || 5
|
|
20
|
+
@fast_d_period = h[:fast_d_period] || 3
|
|
21
|
+
@fast_d_ma = h[:fast_d_ma] || 0
|
|
22
|
+
else
|
|
23
|
+
@time_period = args[0] || 14
|
|
24
|
+
@fast_k_period = args[1] || 5
|
|
25
|
+
@fast_d_period = args[2] || 3
|
|
26
|
+
@fast_d_ma = args[3] || 0
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
@func = TaLib::Function.new("STOCHRSI")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Is price data required as an input
|
|
33
|
+
def self.price_input?
|
|
34
|
+
false
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# The list of arguments
|
|
38
|
+
def self.arguments
|
|
39
|
+
[ :time_period, :fast_k_period, :fast_d_period, :fast_d_ma ]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# The minimum set of inputs required
|
|
43
|
+
def self.inputs
|
|
44
|
+
[ :in_real ]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# The outputs generated by this function
|
|
48
|
+
def self.outputs
|
|
49
|
+
[ :out_fast_k, :out_fast_d ]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def run(in_real)
|
|
53
|
+
len = in_real.length
|
|
54
|
+
@func.in_real(0, map(in_real))
|
|
55
|
+
|
|
56
|
+
@func.opt_int(0, @time_period)
|
|
57
|
+
@func.opt_int(1, @fast_k_period)
|
|
58
|
+
@func.opt_int(2, @fast_d_period)
|
|
59
|
+
@func.opt_int(3, @fast_d_ma)
|
|
60
|
+
|
|
61
|
+
out_fast_k = Array.new(len)
|
|
62
|
+
@func.out_real(0, out_fast_k)
|
|
63
|
+
out_fast_d = Array.new(len)
|
|
64
|
+
@func.out_real(1, out_fast_d)
|
|
65
|
+
|
|
66
|
+
@func.call(0, len - 1)
|
|
67
|
+
|
|
68
|
+
{:out_fast_k => out_fast_k,
|
|
69
|
+
:out_fast_d => out_fast_d}
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Ta-Lib function mapping class
|
|
2
|
+
# Function: 'SUB'
|
|
3
|
+
# Description: 'Vector Arithmetic Substraction'
|
|
4
|
+
# This file has been autogenerated - Do Not Edit.
|
|
5
|
+
class Indicator::AutoGen::Sub < Indicator::Base
|
|
6
|
+
|
|
7
|
+
def initialize(*args)
|
|
8
|
+
|
|
9
|
+
@func = TaLib::Function.new("SUB")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Is price data required as an input
|
|
13
|
+
def self.price_input?
|
|
14
|
+
false
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The list of arguments
|
|
18
|
+
def self.arguments
|
|
19
|
+
[ ]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# The minimum set of inputs required
|
|
23
|
+
def self.inputs
|
|
24
|
+
[ :in_real0, :in_real1 ]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# The outputs generated by this function
|
|
28
|
+
def self.outputs
|
|
29
|
+
[ :out_real ]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def run(in_real0, in_real1)
|
|
33
|
+
len = in_real0.length
|
|
34
|
+
@func.in_real(0, map(in_real0))
|
|
35
|
+
@func.in_real(1, map(in_real1))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
out_real = Array.new(len)
|
|
39
|
+
@func.out_real(0, out_real)
|
|
40
|
+
|
|
41
|
+
@func.call(0, len - 1)
|
|
42
|
+
|
|
43
|
+
out_real
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Ta-Lib function mapping class
|
|
2
|
+
# Function: 'SUM'
|
|
3
|
+
# Description: 'Summation'
|
|
4
|
+
# This file has been autogenerated - Do Not Edit.
|
|
5
|
+
class Indicator::AutoGen::Sum < Indicator::Base
|
|
6
|
+
# Time Period <Integer>
|
|
7
|
+
attr_accessor :time_period
|
|
8
|
+
|
|
9
|
+
def initialize(*args)
|
|
10
|
+
if args.first.is_a? Hash
|
|
11
|
+
h = args.first
|
|
12
|
+
@time_period = h[:time_period] || 30
|
|
13
|
+
else
|
|
14
|
+
@time_period = args[0] || 30
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@func = TaLib::Function.new("SUM")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Is price data required as an input
|
|
21
|
+
def self.price_input?
|
|
22
|
+
false
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# The list of arguments
|
|
26
|
+
def self.arguments
|
|
27
|
+
[ :time_period ]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# The minimum set of inputs required
|
|
31
|
+
def self.inputs
|
|
32
|
+
[ :in_real ]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# The outputs generated by this function
|
|
36
|
+
def self.outputs
|
|
37
|
+
[ :out_real ]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def run(in_real)
|
|
41
|
+
len = in_real.length
|
|
42
|
+
@func.in_real(0, map(in_real))
|
|
43
|
+
|
|
44
|
+
@func.opt_int(0, @time_period)
|
|
45
|
+
|
|
46
|
+
out_real = Array.new(len)
|
|
47
|
+
@func.out_real(0, out_real)
|
|
48
|
+
|
|
49
|
+
@func.call(0, len - 1)
|
|
50
|
+
|
|
51
|
+
out_real
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Ta-Lib function mapping class
|
|
2
|
+
# Function: 'T3'
|
|
3
|
+
# Description: 'Triple Exponential Moving Average (T3)'
|
|
4
|
+
# This file has been autogenerated - Do Not Edit.
|
|
5
|
+
class Indicator::AutoGen::T3 < Indicator::Base
|
|
6
|
+
# Time Period <Integer>
|
|
7
|
+
attr_accessor :time_period
|
|
8
|
+
# Volume Factor <Double>
|
|
9
|
+
attr_accessor :volume_factor
|
|
10
|
+
|
|
11
|
+
def initialize(*args)
|
|
12
|
+
if args.first.is_a? Hash
|
|
13
|
+
h = args.first
|
|
14
|
+
@time_period = h[:time_period] || 5
|
|
15
|
+
@volume_factor = h[:volume_factor] || 7.000000e-1
|
|
16
|
+
else
|
|
17
|
+
@time_period = args[0] || 5
|
|
18
|
+
@volume_factor = args[1] || 7.000000e-1
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
@func = TaLib::Function.new("T3")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Is price data required as an input
|
|
25
|
+
def self.price_input?
|
|
26
|
+
false
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# The list of arguments
|
|
30
|
+
def self.arguments
|
|
31
|
+
[ :time_period, :volume_factor ]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# The minimum set of inputs required
|
|
35
|
+
def self.inputs
|
|
36
|
+
[ :in_real ]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# The outputs generated by this function
|
|
40
|
+
def self.outputs
|
|
41
|
+
[ :out_real ]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def run(in_real)
|
|
45
|
+
len = in_real.length
|
|
46
|
+
@func.in_real(0, map(in_real))
|
|
47
|
+
|
|
48
|
+
@func.opt_int(0, @time_period)
|
|
49
|
+
@func.opt_real(1, @volume_factor)
|
|
50
|
+
|
|
51
|
+
out_real = Array.new(len)
|
|
52
|
+
@func.out_real(0, out_real)
|
|
53
|
+
|
|
54
|
+
@func.call(0, len - 1)
|
|
55
|
+
|
|
56
|
+
out_real
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Ta-Lib function mapping class
|
|
2
|
+
# Function: 'TAN'
|
|
3
|
+
# Description: 'Vector Trigonometric Tan'
|
|
4
|
+
# This file has been autogenerated - Do Not Edit.
|
|
5
|
+
class Indicator::AutoGen::Tan < Indicator::Base
|
|
6
|
+
|
|
7
|
+
def initialize(*args)
|
|
8
|
+
|
|
9
|
+
@func = TaLib::Function.new("TAN")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Is price data required as an input
|
|
13
|
+
def self.price_input?
|
|
14
|
+
false
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The list of arguments
|
|
18
|
+
def self.arguments
|
|
19
|
+
[ ]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# The minimum set of inputs required
|
|
23
|
+
def self.inputs
|
|
24
|
+
[ :in_real ]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# The outputs generated by this function
|
|
28
|
+
def self.outputs
|
|
29
|
+
[ :out_real ]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def run(in_real)
|
|
33
|
+
len = in_real.length
|
|
34
|
+
@func.in_real(0, map(in_real))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
out_real = Array.new(len)
|
|
38
|
+
@func.out_real(0, out_real)
|
|
39
|
+
|
|
40
|
+
@func.call(0, len - 1)
|
|
41
|
+
|
|
42
|
+
out_real
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Ta-Lib function mapping class
|
|
2
|
+
# Function: 'TANH'
|
|
3
|
+
# Description: 'Vector Trigonometric Tanh'
|
|
4
|
+
# This file has been autogenerated - Do Not Edit.
|
|
5
|
+
class Indicator::AutoGen::Tanh < Indicator::Base
|
|
6
|
+
|
|
7
|
+
def initialize(*args)
|
|
8
|
+
|
|
9
|
+
@func = TaLib::Function.new("TANH")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Is price data required as an input
|
|
13
|
+
def self.price_input?
|
|
14
|
+
false
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The list of arguments
|
|
18
|
+
def self.arguments
|
|
19
|
+
[ ]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# The minimum set of inputs required
|
|
23
|
+
def self.inputs
|
|
24
|
+
[ :in_real ]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# The outputs generated by this function
|
|
28
|
+
def self.outputs
|
|
29
|
+
[ :out_real ]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def run(in_real)
|
|
33
|
+
len = in_real.length
|
|
34
|
+
@func.in_real(0, map(in_real))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
out_real = Array.new(len)
|
|
38
|
+
@func.out_real(0, out_real)
|
|
39
|
+
|
|
40
|
+
@func.call(0, len - 1)
|
|
41
|
+
|
|
42
|
+
out_real
|
|
43
|
+
end
|
|
44
|
+
end
|