Class: AlphaVantageAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/api/alpha_vantage_api.rb

Constant Summary collapse

BASE_URL =
'https://www.alphavantage.co/query'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ AlphaVantageAPI

Returns a new instance of AlphaVantageAPI.



14
15
16
17
# File 'lib/api/alpha_vantage_api.rb', line 14

def initialize(api_key)
  @api_key    = api_key
  @connection = Faraday.new(url: BASE_URL)
end

Instance Method Details

#ad(symbol:, interval:) ⇒ Object



45
46
47
# File 'lib/api/alpha_vantage_api.rb', line 45

def ad(symbol:, interval:)
  query(function: 'AD', symbol: symbol, interval: interval)
end

#adosc(symbol:, interval:, fastperiod:, slowperiod:) ⇒ Object



49
50
51
# File 'lib/api/alpha_vantage_api.rb', line 49

def adosc(symbol:, interval:, fastperiod:, slowperiod:)
  query(function: 'ADOSC', symbol: symbol, interval: interval, fastperiod: fastperiod, slowperiod: slowperiod)
end

#adx(symbol:, interval:, time_period:) ⇒ Object



53
54
55
# File 'lib/api/alpha_vantage_api.rb', line 53

def adx(symbol:, interval:, time_period:)
  query(function: 'ADX', symbol: symbol, interval: interval, time_period: time_period)
end

#adxr(symbol:, interval:, time_period:) ⇒ Object



93
94
95
# File 'lib/api/alpha_vantage_api.rb', line 93

def adxr(symbol:, interval:, time_period:)
  query(function: 'ADXR', symbol: symbol, interval: interval, time_period: time_period)
end

#all_commodities(interval:) ⇒ Object



57
58
59
# File 'lib/api/alpha_vantage_api.rb', line 57

def all_commodities(interval:)
  query(function: 'ALL_COMMODITIES', interval: interval)
end

#aluminum(interval:) ⇒ Object



61
62
63
# File 'lib/api/alpha_vantage_api.rb', line 61

def aluminum(interval:)
  query(function: 'ALUMINUM', interval: interval)
end

#apo(symbol:, interval:, series_type:, fastperiod:, matype:) ⇒ Object



65
66
67
# File 'lib/api/alpha_vantage_api.rb', line 65

def apo(symbol:, interval:, series_type:, fastperiod:, matype:)
  query(function: 'APO', symbol: symbol, interval: interval, series_type: series_type, fastperiod: fastperiod, matype: matype)
end

#aronosc(symbol:, interval:, time_period:) ⇒ Object



170
171
172
# File 'lib/api/alpha_vantage_api.rb', line 170

def aronosc(symbol:, interval:, time_period:)
  query(function: 'AROONOSC', symbol: symbol, interval: interval, time_period: time_period)
end

#aroon(symbol:, interval:, time_period:) ⇒ Object



69
70
71
# File 'lib/api/alpha_vantage_api.rb', line 69

def aroon(symbol:, interval:, time_period:)
  query(function: 'AROON', symbol: symbol, interval: interval, time_period: time_period)
end

#atr(symbol:, interval:, time_period:) ⇒ Object



97
98
99
# File 'lib/api/alpha_vantage_api.rb', line 97

def atr(symbol:, interval:, time_period:)
  query(function: 'ATR', symbol: symbol, interval: interval, time_period: time_period)
end

#balance_sheet(symbol:) ⇒ Object



73
74
75
# File 'lib/api/alpha_vantage_api.rb', line 73

def balance_sheet(symbol:)
  query(function: 'BALANCE_SHEET', symbol: symbol)
end

#bbands(symbol:, interval:, time_period:, series_type:, nbdevup:, nbdevdn:, matype: nil) ⇒ Object



101
102
103
# File 'lib/api/alpha_vantage_api.rb', line 101

def bbands(symbol:, interval:, time_period:, series_type:, nbdevup:, nbdevdn:, matype: nil)
  query(function: 'BBANDS', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, nbdevup: nbdevup, nbdevdn: nbdevdn, matype: matype)
end

#bop(symbol:, interval:) ⇒ Object



105
106
107
# File 'lib/api/alpha_vantage_api.rb', line 105

def bop(symbol:, interval:)
  query(function: 'BOP', symbol: symbol, interval: interval)
end

#brent(interval:) ⇒ Object



174
175
176
# File 'lib/api/alpha_vantage_api.rb', line 174

def brent(interval:)
  query(function: 'BRENT', interval: interval)
end

#cash_flow(symbol:) ⇒ Object



109
110
111
# File 'lib/api/alpha_vantage_api.rb', line 109

def cash_flow(symbol:)
  query(function: 'CASH_FLOW', symbol: symbol)
end

#cci(symbol:, interval:, time_period:) ⇒ Object



113
114
115
# File 'lib/api/alpha_vantage_api.rb', line 113

def cci(symbol:, interval:, time_period:)
  query(function: 'CCI', symbol: symbol, interval: interval, time_period: time_period)
end

#cmo(symbol:, interval:, time_period:, series_type:) ⇒ Object



117
118
119
# File 'lib/api/alpha_vantage_api.rb', line 117

def cmo(symbol:, interval:, time_period:, series_type:)
  query(function: 'CMO', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type)
end

#coffee(interval:) ⇒ Object



178
179
180
# File 'lib/api/alpha_vantage_api.rb', line 178

def coffee(interval:)
  query(function: 'COFFEE', interval: interval)
end

#copper(interval:) ⇒ Object



182
183
184
# File 'lib/api/alpha_vantage_api.rb', line 182

def copper(interval:)
  query(function: 'COPPER', interval: interval)
end

#corn(interval:) ⇒ Object



186
187
188
# File 'lib/api/alpha_vantage_api.rb', line 186

def corn(interval:)
  query(function: 'CORN', interval: interval)
end

#cotton(interval:) ⇒ Object



190
191
192
# File 'lib/api/alpha_vantage_api.rb', line 190

def cotton(interval:)
  query(function: 'COTTON', interval: interval)
end

#cpi(interval:) ⇒ Object



194
195
196
# File 'lib/api/alpha_vantage_api.rb', line 194

def cpi(interval:)
  query(function: 'CPI', interval: interval)
end

#crypto_intraday(symbol:, market:, interval:, outputsize: nil, datatype: nil) ⇒ Object



77
78
79
# File 'lib/api/alpha_vantage_api.rb', line 77

def crypto_intraday(symbol:, market:, interval:, outputsize: nil, datatype: nil)
  query(function: 'CRYPTO_INTRADAY', symbol: symbol, market: market, interval: interval, outputsize: outputsize, datatype: datatype)
end

#currency_exchange_rate(from_currency:, to_currency:) ⇒ Object



81
82
83
# File 'lib/api/alpha_vantage_api.rb', line 81

def currency_exchange_rate(from_currency:, to_currency:)
  query(function: 'CURRENCY_EXCHANGE_RATE', from_currency: from_currency, to_currency: to_currency)
end

#dema(symbol:, interval:, time_period:, series_type:) ⇒ Object



121
122
123
# File 'lib/api/alpha_vantage_api.rb', line 121

def dema(symbol:, interval:, time_period:, series_type:)
  query(function: 'DEMA', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type)
end

#digital_currency_daily(symbol:, market:, datatype: 'json') ⇒ Object



274
275
276
# File 'lib/api/alpha_vantage_api.rb', line 274

def digital_currency_daily(symbol:, market:, datatype: 'json')
  query(function: 'DIGITAL_CURRENCY_DAILY', symbol: symbol, market: market, datatype: datatype)
end

#digital_currency_monthly(symbol:, market:, datatype: 'json') ⇒ Object



299
300
301
# File 'lib/api/alpha_vantage_api.rb', line 299

def digital_currency_monthly(symbol:, market:, datatype: 'json')
  query(function: 'DIGITAL_CURRENCY_MONTHLY', symbol: symbol, market: market, datatype: datatype)
end

#digital_currency_weekly(symbol:, market:, datatype: 'json') ⇒ Object



303
304
305
# File 'lib/api/alpha_vantage_api.rb', line 303

def digital_currency_weekly(symbol:, market:, datatype: 'json')
  query(function: 'DIGITAL_CURRENCY_WEEKLY', symbol: symbol, market: market, datatype: datatype)
end

#durablesObject



198
199
200
# File 'lib/api/alpha_vantage_api.rb', line 198

def durables
  query(function: 'DURABLES')
end

#dx(symbol:, interval:, time_period:) ⇒ Object



125
126
127
# File 'lib/api/alpha_vantage_api.rb', line 125

def dx(symbol:, interval:, time_period:)
  query(function: 'DX', symbol: symbol, interval: interval, time_period: time_period)
end

#earnings(symbol:) ⇒ Object



85
86
87
# File 'lib/api/alpha_vantage_api.rb', line 85

def earnings(symbol:)
  query(function: 'EARNINGS', symbol: symbol)
end

#earnings_calendar(symbol: nil, horizon: nil) ⇒ Object



129
130
131
# File 'lib/api/alpha_vantage_api.rb', line 129

def earnings_calendar(symbol: nil, horizon: nil)
  query(function: 'EARNINGS_CALENDAR', symbol: symbol, horizon: horizon)
end

#ema(symbol:, interval:, time_period:, series_type:) ⇒ Object



133
134
135
# File 'lib/api/alpha_vantage_api.rb', line 133

def ema(symbol:, interval:, time_period:, series_type:)
  query(function: 'EMA', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type)
end

#federal_funds_rate(interval:) ⇒ Object



137
138
139
# File 'lib/api/alpha_vantage_api.rb', line 137

def federal_funds_rate(interval:)
  query(function: 'FEDERAL_FUNDS_RATE', interval: interval)
end

#fx_daily(from_symbol:, to_symbol:, outputsize: nil, datatype: 'json') ⇒ Object



278
279
280
# File 'lib/api/alpha_vantage_api.rb', line 278

def fx_daily(from_symbol:, to_symbol:, outputsize: nil, datatype: 'json')
  query(function: 'FX_DAILY', from_symbol: from_symbol, to_symbol: to_symbol, outputsize: outputsize, datatype: datatype)
end

#fx_intraday(from_symbol:, to_symbol:, interval:, outputsize: nil, datatype: 'json') ⇒ Object



295
296
297
# File 'lib/api/alpha_vantage_api.rb', line 295

def fx_intraday(from_symbol:, to_symbol:, interval:, outputsize: nil, datatype: 'json')
  query(function: 'FX_INTRADAY', from_symbol: from_symbol, to_symbol: to_symbol, interval: interval, outputsize: outputsize, datatype: datatype)
end

#fx_monthly(from_symbol:, to_symbol:, datatype: 'json') ⇒ Object



331
332
333
# File 'lib/api/alpha_vantage_api.rb', line 331

def fx_monthly(from_symbol:, to_symbol:, datatype: 'json')
  query(function: 'FX_MONTHLY', from_symbol: from_symbol, to_symbol: to_symbol, datatype: datatype)
end

#fx_weekly(from_symbol:, to_symbol:, datatype: 'json') ⇒ Object



335
336
337
# File 'lib/api/alpha_vantage_api.rb', line 335

def fx_weekly(from_symbol:, to_symbol:, datatype: 'json')
  query(function: 'FX_WEEKLY', from_symbol: from_symbol, to_symbol: to_symbol, datatype: datatype)
end

#global_quote(symbol:, datatype: 'json') ⇒ Object



282
283
284
# File 'lib/api/alpha_vantage_api.rb', line 282

def global_quote(symbol:, datatype: 'json')
  query(function: 'GLOBAL_QUOTE', symbol: symbol, datatype: datatype)
end

#ht_dcperiod(symbol:, interval:, series_type:) ⇒ Object



141
142
143
# File 'lib/api/alpha_vantage_api.rb', line 141

def ht_dcperiod(symbol:, interval:, series_type:)
  query(function: 'HT_DCPERIOD', symbol: symbol, interval: interval, series_type: series_type)
end

#ht_dcphase(symbol:, interval:, series_type:) ⇒ Object



145
146
147
# File 'lib/api/alpha_vantage_api.rb', line 145

def ht_dcphase(symbol:, interval:, series_type:)
  query(function: 'HT_DCPHASE', symbol: symbol, interval: interval, series_type: series_type)
end

#ht_phasor(symbol:, interval:, series_type:) ⇒ Object



149
150
151
# File 'lib/api/alpha_vantage_api.rb', line 149

def ht_phasor(symbol:, interval:, series_type:)
  query(function: 'HT_PHASOR', symbol: symbol, interval: interval, series_type: series_type)
end

#ht_sine(symbol:, interval:, series_type:) ⇒ Object



153
154
155
# File 'lib/api/alpha_vantage_api.rb', line 153

def ht_sine(symbol:, interval:, series_type:)
  query(function: 'HT_SINE', symbol: symbol, interval: interval, series_type: series_type)
end

#ht_trendline(symbol:, interval:, series_type:) ⇒ Object



157
158
159
# File 'lib/api/alpha_vantage_api.rb', line 157

def ht_trendline(symbol:, interval:, series_type:)
  query(function: 'HT_TRENDLINE', symbol: symbol, interval: interval, series_type: series_type)
end

#ht_trendmode(symbol:, interval:, series_type:) ⇒ Object



161
162
163
# File 'lib/api/alpha_vantage_api.rb', line 161

def ht_trendmode(symbol:, interval:, series_type:)
  query(function: 'HT_TRENDMODE', symbol: symbol, interval: interval, series_type: series_type)
end

#income_statement(symbol:) ⇒ Object



165
166
167
# File 'lib/api/alpha_vantage_api.rb', line 165

def income_statement(symbol:)
  query(function: 'INCOME_STATEMENT', symbol: symbol)
end

#inflationObject



202
203
204
# File 'lib/api/alpha_vantage_api.rb', line 202

def inflation
  query(function: 'INFLATION')
end

#ipo_calendarObject



206
207
208
# File 'lib/api/alpha_vantage_api.rb', line 206

def ipo_calendar
  query(function: 'IPO_CALENDAR')
end

#kama(symbol:, interval:, time_period:, series_type:) ⇒ Object



210
211
212
# File 'lib/api/alpha_vantage_api.rb', line 210

def kama(symbol:, interval:, time_period:, series_type:)
  query(function: 'KAMA', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type)
end

#listing_status(date: nil, state: nil) ⇒ Object



214
215
216
# File 'lib/api/alpha_vantage_api.rb', line 214

def listing_status(date: nil, state: nil)
  query(function: 'LISTING_STATUS', date: date, state: state)
end

#macd(symbol:, interval:, series_type:, time_period:, datatype: 'json') ⇒ Object



290
291
292
# File 'lib/api/alpha_vantage_api.rb', line 290

def macd(symbol:, interval:, series_type:, fastperiod: nil, slowperiod: nil, signalperiod: nil, datatype: 'json')
  query(function: 'MACD', symbol: symbol, interval: interval, series_type: series_type, fastperiod: fastperiod, slowperiod: slowperiod, signalperiod: signalperiod, datatype: datatype)
end

#macd_ext(symbol:, interval:, series_type:, fastperiod: nil, slowperiod: nil, signalperiod: nil, matype: nil, datatype: 'json') ⇒ Object



319
320
321
# File 'lib/api/alpha_vantage_api.rb', line 319

def macd_ext(symbol:, interval:, series_type:, fastperiod: nil, slowperiod: nil, signalperiod: nil, matype: nil, datatype: 'json')
  query(function: 'MACDEXT', symbol: symbol, interval: interval, series_type: series_type, fastperiod: fastperiod, slowperiod: slowperiod, signalperiod: signalperiod, matype: matype, datatype: datatype)
end

#mama(symbol:, interval:, series_type:, fastlimit:, slowlimit:, datatype: 'json') ⇒ Object



339
340
341
# File 'lib/api/alpha_vantage_api.rb', line 339

def mama(symbol:, interval:, series_type:, fastlimit:, slowlimit:, datatype: 'json')
  query(function: 'MAMA', symbol: symbol, interval: interval, series_type: series_type, fastlimit: fastlimit, slowlimit: slowlimit, datatype: datatype)
end

#market_statusObject



218
219
220
# File 'lib/api/alpha_vantage_api.rb', line 218

def market_status
  query(function: 'MARKET_STATUS')
end

#mfi(symbol:, interval:, time_period:, datatype: 'json') ⇒ Object



343
344
345
# File 'lib/api/alpha_vantage_api.rb', line 343

def mfi(symbol:, interval:, time_period:, datatype: 'json')
  query(function: 'MFI', symbol: symbol, interval: interval, time_period: time_period, datatype: datatype)
end

#midpoint(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



347
348
349
# File 'lib/api/alpha_vantage_api.rb', line 347

def midpoint(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'MIDPOINT', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#midprice(symbol:, interval:, time_period:, datatype: 'json') ⇒ Object



351
352
353
# File 'lib/api/alpha_vantage_api.rb', line 351

def midprice(symbol:, interval:, time_period:, datatype: 'json')
  query(function: 'MIDPRICE', symbol: symbol, interval: interval, time_period: time_period, datatype: datatype)
end

#minus_di(symbol:, interval:, time_period:, datatype: 'json') ⇒ Object



355
356
357
# File 'lib/api/alpha_vantage_api.rb', line 355

def minus_di(symbol:, interval:, time_period:, datatype: 'json')
  query(function: 'MINUS_DI', symbol: symbol, interval: interval, time_period: time_period, datatype: datatype)
end

#minus_dm(symbol:, interval:, time_period:, datatype: 'json') ⇒ Object



359
360
361
# File 'lib/api/alpha_vantage_api.rb', line 359

def minus_dm(symbol:, interval:, time_period:, datatype: 'json')
  query(function: 'MINUS_DM', symbol: symbol, interval: interval, time_period: time_period, datatype: datatype)
end

#mom(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



363
364
365
# File 'lib/api/alpha_vantage_api.rb', line 363

def mom(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'MOM', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#natr(symbol:, interval:, time_period:, datatype: 'json') ⇒ Object



367
368
369
# File 'lib/api/alpha_vantage_api.rb', line 367

def natr(symbol:, interval:, time_period:, datatype: 'json')
  query(function: 'NATR', symbol: symbol, interval: interval, time_period: time_period, datatype: datatype)
end

#natural_gas(interval:) ⇒ Object



222
223
224
# File 'lib/api/alpha_vantage_api.rb', line 222

def natural_gas(interval:)
  query(function: 'NATURAL_GAS', interval: interval)
end

#news_sentiment(tickers:, time_from: nil, limit: nil) ⇒ Object



226
227
228
# File 'lib/api/alpha_vantage_api.rb', line 226

def news_sentiment(tickers:, time_from: nil, limit: nil)
  query(function: 'NEWS_SENTIMENT', tickers: tickers, time_from: time_from, limit: limit)
end

#nonfarm_payrollObject



230
231
232
# File 'lib/api/alpha_vantage_api.rb', line 230

def nonfarm_payroll
  query(function: 'NONFARM_PAYROLL')
end

#obv(symbol:, interval:, datatype: 'json') ⇒ Object



371
372
373
# File 'lib/api/alpha_vantage_api.rb', line 371

def obv(symbol:, interval:, datatype: 'json')
  query(function: 'OBV', symbol: symbol, interval: interval, datatype: datatype)
end

#overview(symbol:, datatype: 'json') ⇒ Object



375
376
377
# File 'lib/api/alpha_vantage_api.rb', line 375

def overview(symbol:, datatype: 'json')
  query(function: 'OVERVIEW', symbol: symbol, datatype: datatype)
end

#plus_di(symbol:, interval:, time_period:, datatype: 'json') ⇒ Object



379
380
381
# File 'lib/api/alpha_vantage_api.rb', line 379

def plus_di(symbol:, interval:, time_period:, datatype: 'json')
  query(function: 'PLUS_DI', symbol: symbol, interval: interval, time_period: time_period, datatype: datatype)
end

#plus_dm(symbol:, interval:, time_period:, datatype: 'json') ⇒ Object



383
384
385
# File 'lib/api/alpha_vantage_api.rb', line 383

def plus_dm(symbol:, interval:, time_period:, datatype: 'json')
  query(function: 'PLUS_DM', symbol: symbol, interval: interval, time_period: time_period, datatype: datatype)
end

#ppo(symbol:, interval:, series_type:, fastperiod:, slowperiod: nil, matype: nil, datatype: 'json') ⇒ Object



387
388
389
# File 'lib/api/alpha_vantage_api.rb', line 387

def ppo(symbol:, interval:, series_type:, fastperiod:, slowperiod: nil, matype: nil, datatype: 'json')
  query(function: 'PPO', symbol: symbol, interval: interval, series_type: series_type, fastperiod: fastperiod, slowperiod: slowperiod, matype: matype, datatype: datatype)
end

#query(function:, symbol: nil, interval: nil, time_period: nil, series_type: nil, market: nil, **extra) ⇒ Object



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
# File 'lib/api/alpha_vantage_api.rb', line 19

def query(  function:,
    symbol:       nil,
    interval:     nil,
    time_period:  nil,
    series_type:  nil,
    market:       nil,
    **extra
  )

  response = @connection.get do |req|
    req.params['apikey']      = @api_key
    req.params['function']    = function
    req.params['symbol']      = symbol      if symbol
    req.params['interval']    = interval    if interval
    req.params['time_period'] = time_period if time_period
    req.params['series_type'] = series_type if series_type
    req.params['market']      = market      if market

    extra.each { |key, value| req.params[key.to_s] = value if value }
  end

  JSON.parse(response.body)
rescue Faraday::Error => e
  { error: "Failed to retrieve data: #{e.message}" }
end

#real_gdp(interval:) ⇒ Object



234
235
236
# File 'lib/api/alpha_vantage_api.rb', line 234

def real_gdp(interval:)
  query(function: 'REAL_GDP', interval: interval)
end

#real_gdp_per_capitaObject



238
239
240
# File 'lib/api/alpha_vantage_api.rb', line 238

def real_gdp_per_capita
  query(function: 'REAL_GDP_PER_CAPITA')
end

#retail_salesObject



242
243
244
# File 'lib/api/alpha_vantage_api.rb', line 242

def retail_sales
  query(function: 'RETAIL_SALES')
end

#roc(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



391
392
393
# File 'lib/api/alpha_vantage_api.rb', line 391

def roc(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'ROC', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#rocr(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



395
396
397
# File 'lib/api/alpha_vantage_api.rb', line 395

def rocr(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'ROCR', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#rsi(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



327
328
329
# File 'lib/api/alpha_vantage_api.rb', line 327

def rsi(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'RSI', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#sar(symbol:, interval:, acceleration:, maximum:, datatype: 'json') ⇒ Object



403
404
405
# File 'lib/api/alpha_vantage_api.rb', line 403

def sar(symbol:, interval:, acceleration:, maximum:, datatype: 'json')
  query(function: 'SAR', symbol: symbol, interval: interval, acceleration: acceleration, maximum: maximum, datatype: datatype)
end

#sma(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



407
408
409
# File 'lib/api/alpha_vantage_api.rb', line 407

def sma(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'SMA', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#stoch(symbol:, interval:, fastkperiod: nil, slowkperiod: nil, slowdperiod: nil, slowkmatype: nil, slowdmatype: nil, datatype: 'json') ⇒ Object



399
400
401
# File 'lib/api/alpha_vantage_api.rb', line 399

def stoch(symbol:, interval:, fastkperiod: nil, slowkperiod: nil, slowdperiod: nil, slowkmatype: nil, slowdmatype: nil, datatype: 'json')
  query(function: 'STOCH', symbol: symbol, interval: interval, fastkperiod: fastkperiod, slowkperiod: slowkperiod, slowdperiod: slowdperiod, slowkmatype: slowkmatype, slowdmatype: slowdmatype, datatype: datatype)
end

#stochf(symbol:, interval:, fastkperiod: nil, fastdperiod: nil, fastdmatype: nil, datatype: 'json') ⇒ Object



411
412
413
# File 'lib/api/alpha_vantage_api.rb', line 411

def stochf(symbol:, interval:, fastkperiod: nil, fastdperiod: nil, fastdmatype: nil, datatype: 'json')
  query(function: 'STOCHF', symbol: symbol, interval: interval, fastkperiod: fastkperiod, fastdperiod: fastdperiod, fastdmatype: fastdmatype, datatype: datatype)
end

#sugar(interval:) ⇒ Object



246
247
248
# File 'lib/api/alpha_vantage_api.rb', line 246

def sugar(interval:)
  query(function: 'SUGAR', interval: interval)
end

#symbol_search(keywords:, datatype: nil) ⇒ Object



250
251
252
# File 'lib/api/alpha_vantage_api.rb', line 250

def symbol_search(keywords:, datatype: nil)
  query(function: 'SYMBOL_SEARCH', keywords: keywords, datatype: datatype)
end

#t3(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



415
416
417
# File 'lib/api/alpha_vantage_api.rb', line 415

def t3(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'T3', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#tema(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



419
420
421
# File 'lib/api/alpha_vantage_api.rb', line 419

def tema(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'TEMA', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#time_series_daily(symbol:, outputsize: nil, datatype: nil) ⇒ Object



89
90
91
# File 'lib/api/alpha_vantage_api.rb', line 89

def time_series_daily(symbol:, outputsize: nil, datatype: nil)
  query(function: 'TIME_SERIES_DAILY', symbol: symbol, outputsize: outputsize, datatype: datatype)
end

#time_series_daily_adjusted(symbol:, outputsize: nil, datatype: 'json') ⇒ Object



286
287
288
# File 'lib/api/alpha_vantage_api.rb', line 286

def time_series_daily_adjusted(symbol:, outputsize: nil, datatype: 'json')
  query(function: 'TIME_SERIES_DAILY_ADJUSTED', symbol: symbol, outputsize: outputsize, datatype: datatype)
end

#time_series_intraday(symbol:, interval:, outputsize: nil, datatype: 'json') ⇒ Object



307
308
309
# File 'lib/api/alpha_vantage_api.rb', line 307

def time_series_intraday(symbol:, interval:, outputsize: nil, datatype: 'json')
  query(function: 'TIME_SERIES_INTRADAY', symbol: symbol, interval: interval, outputsize: outputsize, datatype: datatype)
end

#time_series_monthly(symbol:, datatype: 'json') ⇒ Object



311
312
313
# File 'lib/api/alpha_vantage_api.rb', line 311

def time_series_monthly(symbol:, datatype: 'json')
  query(function: 'TIME_SERIES_MONTHLY', symbol: symbol, datatype: datatype)
end

#time_series_monthly_adjusted(symbol:, datatype: 'json') ⇒ Object



423
424
425
# File 'lib/api/alpha_vantage_api.rb', line 423

def time_series_monthly_adjusted(symbol:, datatype: 'json')
  query(function: 'TIME_SERIES_MONTHLY_ADJUSTED', symbol: symbol, datatype: datatype)
end

#time_series_weekly(symbol:, datatype: 'json') ⇒ Object



315
316
317
# File 'lib/api/alpha_vantage_api.rb', line 315

def time_series_weekly(symbol:, datatype: 'json')
  query(function: 'TIME_SERIES_WEEKLY', symbol: symbol, datatype: datatype)
end

#time_series_weekly_adjusted(symbol:, datatype: 'json') ⇒ Object



427
428
429
# File 'lib/api/alpha_vantage_api.rb', line 427

def time_series_weekly_adjusted(symbol:, datatype: 'json')
  query(function: 'TIME_SERIES_WEEKLY_ADJUSTED', symbol: symbol, datatype: datatype)
end

#top_gainers_losersObject



254
255
256
# File 'lib/api/alpha_vantage_api.rb', line 254

def top_gainers_losers
  query(function: 'TOP_GAINERS_LOSERS')
end

#trange(symbol:, interval:, datatype: 'json') ⇒ Object



431
432
433
# File 'lib/api/alpha_vantage_api.rb', line 431

def trange(symbol:, interval:, datatype: 'json')
  query(function: 'TRANGE', symbol: symbol, interval: interval, datatype: datatype)
end

#treasury_yield(interval:, maturity:) ⇒ Object



258
259
260
# File 'lib/api/alpha_vantage_api.rb', line 258

def treasury_yield(interval:, maturity:)
  query(function: 'TREASURY_YIELD', interval: interval, maturity: maturity)
end

#trima(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



435
436
437
# File 'lib/api/alpha_vantage_api.rb', line 435

def trima(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'TRIMA', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#trix(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



439
440
441
# File 'lib/api/alpha_vantage_api.rb', line 439

def trix(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'TRIX', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#ultosc(symbol:, interval:, timeperiod1: nil, timeperiod2: nil, timeperiod3: nil, datatype: 'json') ⇒ Object



443
444
445
# File 'lib/api/alpha_vantage_api.rb', line 443

def ultosc(symbol:, interval:, timeperiod1: nil, timeperiod2: nil, timeperiod3: nil, datatype: 'json')
  query(function: 'ULTOSC', symbol: symbol, interval: interval, timeperiod1: timeperiod1, timeperiod2: timeperiod2, timeperiod3: timeperiod3, datatype: datatype)
end

#unemploymentObject



262
263
264
# File 'lib/api/alpha_vantage_api.rb', line 262

def unemployment
  query(function: 'UNEMPLOYMENT')
end

#vwap(symbol:, interval:, datatype: 'json') ⇒ Object



447
448
449
# File 'lib/api/alpha_vantage_api.rb', line 447

def vwap(symbol:, interval:, datatype: 'json')
  query(function: 'VWAP', symbol: symbol, interval: interval, datatype: datatype)
end

#wheat(interval:) ⇒ Object



266
267
268
# File 'lib/api/alpha_vantage_api.rb', line 266

def wheat(interval:)
  query(function: 'WHEAT', interval: interval)
end

#willr(symbol:, interval:, time_period:, datatype: 'json') ⇒ Object



451
452
453
# File 'lib/api/alpha_vantage_api.rb', line 451

def willr(symbol:, interval:, time_period:, datatype: 'json')
  query(function: 'WILLR', symbol: symbol, interval: interval, time_period: time_period, datatype: datatype)
end

#wma(symbol:, interval:, time_period:, series_type:, datatype: 'json') ⇒ Object



455
456
457
# File 'lib/api/alpha_vantage_api.rb', line 455

def wma(symbol:, interval:, time_period:, series_type:, datatype: 'json')
  query(function: 'WMA', symbol: symbol, interval: interval, time_period: time_period, series_type: series_type, datatype: datatype)
end

#wti(interval:) ⇒ Object



270
271
272
# File 'lib/api/alpha_vantage_api.rb', line 270

def wti(interval:)
  query(function: 'WTI', interval: interval)
end