class Alphavantage::Indicator

Constants

MOVING_AVERAGE_TYPES

Public Class Methods

new(symbol:,interval:) click to toggle source
# File lib/alphavantage/indicator.rb, line 5
def initialize(symbol:,interval:)
  @symbol = symbol
  @interval = interval
end

Public Instance Methods

ad()
Alias for: vwap
adosc(fastperiod: 3, slowperiod: 10) click to toggle source
# File lib/alphavantage/indicator.rb, line 169
def adosc(fastperiod: 3, slowperiod: 10)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    fastperiod: validate_integer(label: 'fastperiod', value: fastperiod),
    slowperiod: validate_integer(label: 'slowperiod', value: slowperiod)
  })
end
adx(time_period:)
Alias for: willr
adxr(time_period:)
Alias for: willr
apo(series_type:, fastperiod: 12, slowperiod: 26, matype: 'sma') click to toggle source
# File lib/alphavantage/indicator.rb, line 193
def apo(series_type:, fastperiod: 12, slowperiod: 26, matype: 'sma')
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    series_type: validate_series_type(series_type),
    fastperiod: validate_integer(label: 'fastperiod', value: fastperiod),
    slowperiod: validate_integer(label: 'slowperiod', value: slowperiod),
    matype: validate_mat(MOVING_AVERAGE_TYPES[matype.to_sym])
  })
end
Also aliased as: ppo
aroon(time_period:)
Alias for: willr
aroonosc(time_period:)
Alias for: willr
atr(time_period:)
Alias for: willr
bbands(time_period:, series_type:, nbdevup: 2, nbdevdn: 2, matype: 'sma') click to toggle source
# File lib/alphavantage/indicator.rb, line 206
def bbands(time_period:, series_type:, nbdevup: 2, nbdevdn: 2, matype: 'sma')
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    time_period: validate_integer(label: 'time period', value: time_period),
    series_type: validate_series_type(series_type),
    nbdevup: validate_integer(label: 'nbdevup', value: nbdevup),
    nbdevdn: validate_integer(label: 'nbdevdn', value: nbdevdn),
    matype: validate_mat(MOVING_AVERAGE_TYPES[matype.to_sym])
  })
end
bop()
Alias for: vwap
cmo(time_period:,series_type:)
Alias for: sma
dema(time_period:,series_type:)
Alias for: sma
dx(time_period:)
Alias for: willr
ema(time_period:,series_type:)
Alias for: sma
ht_dcperiod(series_type:)
Alias for: ht_trendline
ht_dcphase(series_type:)
Alias for: ht_trendline
ht_phasor(series_type:)
Alias for: ht_trendline
ht_sine(series_type:)
Alias for: ht_trendline
ht_trendline(series_type:) click to toggle source
# File lib/alphavantage/indicator.rb, line 179
def ht_trendline(series_type:)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    series_type: validate_series_type(series_type)
  })
end
ht_trendmode(series_type:)
Alias for: ht_trendline
kama(time_period:,series_type:)
Alias for: sma
macd(series_type:, fastperiod: 12, slowperiod: 26, signalperiod: 9) click to toggle source
# File lib/alphavantage/indicator.rb, line 35
def macd(series_type:, fastperiod: 12, slowperiod: 26, signalperiod: 9)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    series_type: validate_series_type(series_type),
    fastperiod: validate_integer(label: 'fastperiod', value: fastperiod),
    slowperiod: validate_integer(label: 'slowperiod', value: slowperiod),
    signalperiod: validate_integer(label: 'signalperiod', value: signalperiod)
  })
end
macdext( series_type:, fastperiod: 12, slowperiod: 26, signalperiod: 9, fastmatype: 'sma', slowmatype: 'sma', signalmatype: 'sma' ) click to toggle source
# File lib/alphavantage/indicator.rb, line 59
def macdext(
  series_type:,
  fastperiod: 12,
  slowperiod: 26,
  signalperiod: 9,
  fastmatype: 'sma',
  slowmatype: 'sma',
  signalmatype: 'sma'
)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    series_type: validate_series_type(series_type),
    fastperiod: validate_integer(label: 'fastperiod', value: fastperiod),
    slowperiod: validate_integer(label: 'slowperiod', value: slowperiod),
    signalperiod: validate_integer(label: 'signalperiod', value: signalperiod),
    fastmatype: validate_mat(MOVING_AVERAGE_TYPES[fastmatype.to_sym]),
    slowmatype: validate_mat(MOVING_AVERAGE_TYPES[slowmatype.to_sym]),
    signalmatype: validate_mat(MOVING_AVERAGE_TYPES[signalmatype.to_sym])
  })
end
mama(time_period:,series_type:)
Alias for: sma
mfi(time_period:)
Alias for: willr
midpoint(time_period:,series_type:)
Alias for: sma
midprice(time_period:)
Alias for: willr
minus_di(time_period:)
Alias for: willr
minus_dm(time_period:)
Alias for: willr
mom(time_period:,series_type:)
Alias for: sma
natr(time_period:)
Alias for: willr
obv()
Alias for: vwap
plus_di(time_period:)
Alias for: willr
plus_dm(time_period:)
Alias for: willr
ppo(series_type:, fastperiod: 12, slowperiod: 26, matype: 'sma')
Alias for: apo
roc(time_period:,series_type:)
Alias for: sma
rocr(time_period:,series_type:)
Alias for: sma
rsi(time_period:,series_type:)
Alias for: sma
sar(acceleration: 0.01, maximum: 0.20) click to toggle source
# File lib/alphavantage/indicator.rb, line 219
def sar(acceleration: 0.01, maximum: 0.20)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    acceleration: validate_integer(label: 'acceleration', value: acceleration),
    maximum: validate_integer(label: 'maximum', value: maximum)
  })
end
sma(time_period:,series_type:) click to toggle source
# File lib/alphavantage/indicator.rb, line 10
def sma(time_period:,series_type:)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    time_period: validate_integer(label: 'time period', value: time_period),
    series_type: validate_series_type(series_type)
  })
end
Also aliased as: ema, wma, dema, tema, trima, kama, mama, t3, rsi, mom, cmo, roc, rocr, trix, midpoint
stoch( fastkperiod: 5, slowkperiod: 3, slowdperiod: 3, slowkmatype: 'sma', slowdmatype: 'sma' ) click to toggle source
# File lib/alphavantage/indicator.rb, line 82
def stoch(
  fastkperiod: 5,
  slowkperiod: 3,
  slowdperiod: 3,
  slowkmatype: 'sma',
  slowdmatype: 'sma'
)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    fastkperiod: validate_integer(label: 'fastkperiod', value: fastkperiod),
    slowkperiod: validate_integer(label: 'slowkperiod', value: slowkperiod),
    slowdperiod: validate_integer(label: 'slowdperiod', value: slowdperiod),
    slowkmatype: validate_mat(MOVING_AVERAGE_TYPES[slowkmatype.to_sym]),
    slowdmatype: validate_mat(MOVING_AVERAGE_TYPES[slowdmatype.to_sym])
  })
end
stochf( fastkperiod: 5, fastdperiod: 3, fastdmatype: 'sma' ) click to toggle source
# File lib/alphavantage/indicator.rb, line 101
def stochf(
  fastkperiod: 5,
  fastdperiod: 3,
  fastdmatype: 'sma'
)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    fastkperiod: validate_integer(label: 'fastkperiod', value: fastkperiod),
    fastdperiod: validate_integer(label: 'fastdperiod', value: fastdperiod),
    fastdmatype: validate_mat(MOVING_AVERAGE_TYPES[fastdmatype.to_sym])
  })
end
stochrsi( time_period:, series_type:, fastkperiod: 5, fastdperiod: 3, fastdmatype: 'sma' ) click to toggle source
# File lib/alphavantage/indicator.rb, line 116
def stochrsi(
  time_period:,
  series_type:,
  fastkperiod: 5,
  fastdperiod: 3,
  fastdmatype: 'sma'
)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    time_period: validate_integer(label: 'time period', value: time_period),
    series_type: validate_series_type(series_type),
    fastkperiod: validate_integer(label: 'fastkperiod', value: fastkperiod),
    fastdperiod: validate_integer(label: 'fastdperiod', value: fastdperiod),
    fastdmatype: validate_mat(MOVING_AVERAGE_TYPES[fastdmatype.to_sym])
  })
end
t3(time_period:,series_type:)
Alias for: sma
tema(time_period:,series_type:)
Alias for: sma
trange()
Alias for: vwap
trima(time_period:,series_type:)
Alias for: sma
trix(time_period:,series_type:)
Alias for: sma
ultosc(timeperiod1: 7, timeperiod2: 14, timeperiod3: 28) click to toggle source
# File lib/alphavantage/indicator.rb, line 229
def ultosc(timeperiod1: 7, timeperiod2: 14, timeperiod3: 28)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    timeperiod1: validate_integer(label: 'timeperiod1', value: timeperiod1),
    timeperiod2: validate_integer(label: 'timeperiod2', value: timeperiod2),
    timeperiod3: validate_integer(label: 'timeperiod3', value: timeperiod3)
  })
end
vwap() click to toggle source
# File lib/alphavantage/indicator.rb, line 157
def vwap
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: [:bop,:trange,:ad,:obv].include?(__callee__) ? validate_indicator_interval(@interval) : validate_interval(@interval)
  })
end
Also aliased as: bop, trange, ad, obv
willr(time_period:) click to toggle source
# File lib/alphavantage/indicator.rb, line 135
def willr(time_period:)
  Client.get(params: {
    function: __callee__.upcase,
    symbol: @symbol,
    interval: validate_indicator_interval(@interval),
    time_period: validate_integer(label: 'time period', value: time_period)
  })
end
wma(time_period:,series_type:)
Alias for: sma