Module: Yfinrb::PriceTechnical

Extended by:
ActiveSupport::Concern
Includes:
ActionView::Helpers::NumberHelper
Included in:
Yfinrb
Defined in:
lib/yfinrb/price_technical.rb

Instance Method Summary collapse

Instance Method Details

#ad(df) ⇒ Object



9
10
11
12
13
# File 'lib/yfinrb/price_technical.rb', line 9

def ad(df)
  inputs = ['High', 'Low','Adj Close','Volume'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.ad(inputs).first
  Polars::Series.new("Accum-Distrib Ln", [nil]*(df.rows.length - output.length)+output)
end

#adosc(df, short_window: 2, long_window: 5) ⇒ Object



16
17
18
19
20
# File 'lib/yfinrb/price_technical.rb', line 16

def adosc(df, short_window: 2, long_window: 5)
  inputs = ['High', 'Low','Adj Close','Volume'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.adosc(inputs, short_period: short_window, long_period: long_window).first
  Polars::Series.new("#{short_window}/#{long_window} Accum-Distrib Osc", [nil]*(df.rows.length - output.length)+output)
end

#adx(df, column: 'Adj Close', window: 5) ⇒ Object Also known as: avg_dir_index



23
24
25
26
27
# File 'lib/yfinrb/price_technical.rb', line 23

def adx(df, column: 'Adj Close', window: 5)
  input = Polars::Series.new(df[column]).to_a
  output = Tulirb.adx([input], period: window).first
  Polars::Series.new("#{window}-day Avg Dir Movemt Idx for #{column}", [nil]*(df.rows.length - output.length)+output)
end

#adxr(df, column: 'Adj Close', window: 5) ⇒ Object Also known as: avg_dir_movement_rating



31
32
33
34
35
# File 'lib/yfinrb/price_technical.rb', line 31

def adxr(df, column: 'Adj Close', window: 5)
  input = Polars::Series.new(df[column]).to_a
  output = Tulirb.adxr([input], period: window).first
  Polars::Series.new("#{window}-day Avg Dir Movemt Rating for #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#ao(df) ⇒ Object



51
52
53
54
55
# File 'lib/yfinrb/price_technical.rb', line 51

def ao(df)
  inputs = ['High', 'Low'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.ao(inputs).first
  Polars::Series.new("Accum-Distrib Ln", [nil]*(df.rows.length - output.length)+output) #)
end

#apo(df, column: 'Adj Close', short_window: 12, long_window: 29) ⇒ Object



58
59
60
61
62
# File 'lib/yfinrb/price_technical.rb', line 58

def apo(df, column: 'Adj Close', short_window: 12, long_window: 29)
  input = Polars::Series.new(df[column]).to_a
  output = Tulirb.ao([input], short_period: short_window, long_period: long_window).first
  Polars::Series.new("#{short_window}/#{long_window} Abs Price Osc for #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#aroon(df, window: 20) ⇒ Object



65
66
67
68
69
# File 'lib/yfinrb/price_technical.rb', line 65

def aroon(df, window: 20)
  inputs = ['High', 'Low'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.aroon(inputs, period: window).first
  Polars::Series.new("#{window} Aroon Ind", [nil]*(df.rows.length - output.length)+output) #)
end

#aroonosc(df, window: 20) ⇒ Object



71
72
73
74
75
# File 'lib/yfinrb/price_technical.rb', line 71

def aroonosc(df, window: 20)
  inputs = ['High', 'Low'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.aroonosc(inputs, period: window).first
  Polars::Series.new("#{window} Aroon Osc Ind", [nil]*(df.rows.length - output.length)+output) #)
end

#atr(df, window: 20) ⇒ Object Also known as: avg_true_range



86
87
88
89
90
# File 'lib/yfinrb/price_technical.rb', line 86

def atr(df, window: 20)
  inputs = ['High', 'Low', 'Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.atr(inputs, period: window).first
  Polars::Series.new("#{window}-day Avg True Range", [nil]*(df.rows.length - output.length)+output)#)
end

#avg_daily_trading_volume(df, window: 20) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/yfinrb/price_technical.rb', line 40

def avg_daily_trading_volume(df, window: 20)
  df.insert_at_idx(0, Polars::Series.new('idx', (1..df.length).to_a))
  df = df.set_sorted('idx', descending: false)

  adtv = df.group_by_rolling(index_column: 'idx', period: "#{window}i").
    agg([Polars.mean('Volume').alias("ADTV(#{window})")]).to_series(1)
  df = df.drop('idx')
  adtv
end

#avg_price(df) ⇒ Object Also known as: avgprice



78
79
80
81
82
# File 'lib/yfinrb/price_technical.rb', line 78

def avg_price(df)
  inputs = ['Open', 'High', 'Low', 'Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.avgprice(inputs).first
  Polars::Series.new("Avg Price", [nil]*(df.rows.length - output.length)+output) #)
end

#bbands(df, column: 'Adj Close', window: 20, stddev: 1) ⇒ Object



94
95
96
97
98
# File 'lib/yfinrb/price_technical.rb', line 94

def bbands(df, column: 'Adj Close', window: 20, stddev: 1 )
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.bbands(inputs, period: window, stddev: stddev).first
  Polars::Series.new("#{window}-day Boll Band for #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#bop(df) ⇒ Object



101
102
103
104
105
# File 'lib/yfinrb/price_technical.rb', line 101

def bop(df)
  inputs = ['Open', 'High', 'Low', 'Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.bop(inputs).first
  Polars::Series.new("Bal of Power", [nil]*(df.rows.length - output.length)+output) #)
end

#cci(df, window: 20) ⇒ Object



108
109
110
111
112
# File 'lib/yfinrb/price_technical.rb', line 108

def cci(df, window: 20)
  inputs = ['High', 'Low', 'Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.cci(inputs, period: window).first
  Polars::Series.new("#{window}-day Comm Channel Idx", [nil]*(df.rows.length - output.length)+output) #)
end

#cmo(df, column: 'Adj Close', window: 20) ⇒ Object



115
116
117
118
119
# File 'lib/yfinrb/price_technical.rb', line 115

def cmo(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.cmo(inputs, period: window).first
  Polars::Series.new("#{window}-day Chande Mom Osc for #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#cvi(df, window: 20) ⇒ Object



122
123
124
125
126
# File 'lib/yfinrb/price_technical.rb', line 122

def cvi(df, window: 20)
  inputs = ['High', 'Low'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.cvi(inputs, period: window).first
  Polars::Series.new("#{window}-day Chaikins Volatility", [nil]*(df.rows.length - output.length)+output) #)
end

#dema(df, column: 'Adj Close', window: 20) ⇒ Object



129
130
131
132
133
# File 'lib/yfinrb/price_technical.rb', line 129

def dema(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.dema(inputs, period: window).first
  Polars::Series.new("Dbl EMA(#{window})", [nil]*(df.rows.length - output.length)+output) #)
end

#di(df, window: 20) ⇒ Object



136
137
138
139
140
# File 'lib/yfinrb/price_technical.rb', line 136

def di(df, window: 20)
  inputs = ['High','Low','Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.di(inputs, period: window).first
  Polars::Series.new("#{window}-day Dir Idx", [nil]*(df.rows.length - output.length)+output) #)
end

#dm(df, window: 20) ⇒ Object



143
144
145
146
147
# File 'lib/yfinrb/price_technical.rb', line 143

def dm(df, window: 20)
  inputs = ['High','Low'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.dm(inputs, period: window).first
  Polars::Series.new("#{window}-day Dir Movemt", [nil]*(df.rows.length - output.length)+output) #)
end

#dpo(df, column: 'Adj Close', window: 20) ⇒ Object



150
151
152
153
154
# File 'lib/yfinrb/price_technical.rb', line 150

def dpo(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.dpo(inputs, period: window).first
  Polars::Series.new("#{window}-day Detrend Price Osc of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#dx(df, window: 20) ⇒ Object



157
158
159
160
161
# File 'lib/yfinrb/price_technical.rb', line 157

def dx(df, window: 20)
  inputs = ['High','Low', 'Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.dx(inputs, period: window).first
  Polars::Series.new("#{window}-day Dir Movemt Idx", [nil]*(df.rows.length - output.length)+output) #)
end

#ema(df, column: 'Adj Close', window: 5) ⇒ Object



164
165
166
167
168
# File 'lib/yfinrb/price_technical.rb', line 164

def ema(df, column: 'Adj Close', window: 5) 
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.ema(inputs, period: window).first
  Polars::Series.new("EMA(#{window}) for #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#emv(df) ⇒ Object



171
172
173
174
175
# File 'lib/yfinrb/price_technical.rb', line 171

def emv(df)
  inputs = ['High', 'Low', 'Volume'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.emv(inputs).first
  Polars::Series.new("Ease of Mvmt", [nil]*(df.rows.length - output.length)+output) #)
end

#fisher(df, window: 20) ⇒ Object



178
179
180
181
182
# File 'lib/yfinrb/price_technical.rb', line 178

def fisher(df, window: 20) 
  inputs = ['High', 'Low'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.fisher(inputs, period: window).first
  Polars::Series.new("#{window}-day Fisher Xform", [nil]*(df.rows.length - output.length)+output) #)
end

#fosc(df, window: 20) ⇒ Object



185
186
187
188
189
# File 'lib/yfinrb/price_technical.rb', line 185

def fosc(df, window: 20) 
  inputs = ['Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.fosc(inputs, period: window).first
  Polars::Series.new("Fcast Osc", [nil]*(df.rows.length - output.length)+output) #)
end

#hma(df, column: 'Adj Close', window: 5) ⇒ Object



192
193
194
195
196
# File 'lib/yfinrb/price_technical.rb', line 192

def hma(df, column: 'Adj Close', window: 5) 
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.ema(inputs, period: window).first
  Polars::Series.new("EMA(#{window}) for #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#kama(df, column: 'Adj Close', window: 5) ⇒ Object



199
200
201
202
203
# File 'lib/yfinrb/price_technical.rb', line 199

def kama(df, column: 'Adj Close', window: 5) 
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.kama(inputs, period: window).first
  Polars::Series.new("KAMA(#{window}) for #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#kvo(df, short_window: 5, long_window: 20) ⇒ Object



206
207
208
209
210
# File 'lib/yfinrb/price_technical.rb', line 206

def kvo(df, short_window: 5, long_window: 20)
  inputs = ['High', 'Low', 'Adj Close', 'Volume'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.kvo(inputs, short_period: short_window, long_period: long_window).first
  Polars::Series.new("#{short_window}/#{long_window} Klinger Vol Osc", [nil]*(df.rows.length - output.length)+output) #)
end

#linreg(df, column: 'Adj Close', window: 20) ⇒ Object



213
214
215
216
217
# File 'lib/yfinrb/price_technical.rb', line 213

def linreg(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.linreg(inputs, period: window).first
  Polars::Series.new("#{window}-day Lin Reg Est for #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#linregintercept(df, column: 'Adj Close', window: 20) ⇒ Object



220
221
222
223
224
# File 'lib/yfinrb/price_technical.rb', line 220

def linregintercept(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.linregintercept(inputs, period: window).first
  Polars::Series.new("#{window}-day Lin Reg Int for #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#linregslope(df, column: 'Adj Close', window: 20) ⇒ Object



227
228
229
230
231
# File 'lib/yfinrb/price_technical.rb', line 227

def linregslope(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.linregslope(inputs, period: window).first
  Polars::Series.new("#{window}-day Lin Reg Slope for #{column}", [nil]*(df.rows.length - output.length)+output)
end

#macd(df, column: 'Adj Close', short_window: 12, long_window: 26, signal_window: 9) ⇒ Object



234
235
236
237
238
# File 'lib/yfinrb/price_technical.rb', line 234

def macd(df, column: 'Adj Close', short_window: 12, long_window: 26, signal_window: 9)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.macd(inputs, short_period: short_window, long_period: long_window, signal_period: signal_window).first
  Polars::Series.new("#{short_window}/#{long_window}/#{signal_window} MACD for #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#marketfi(df) ⇒ Object



241
242
243
244
245
# File 'lib/yfinrb/price_technical.rb', line 241

def marketfi(df)
  inputs = ['High', 'Low', 'Volume'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.marketfi(inputs).first
  Polars::Series.new("Mkt Facilitation Idx", [nil]*(df.rows.length - output.length)+output) #)
end

#mass(df, window: 20) ⇒ Object



248
249
250
251
252
# File 'lib/yfinrb/price_technical.rb', line 248

def mass(df, window: 20)
  inputs = ['High', 'Low'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.mass(inputs, period: window).first
  Polars::Series.new("#{window}-day Mass Idx", [nil]*(df.rows.length - output.length)+output) #)
end

#max(df, column: 'Adj Close', window: 20) ⇒ Object



255
256
257
258
259
# File 'lib/yfinrb/price_technical.rb', line 255

def max(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.max(inputs, period: window).first
  Polars::Series.new("Max of #{column} in #{window}-day pd", [nil]*(df.rows.length - output.length)+output) #)
end

#md(df, column: 'Adj Close', window: 20) ⇒ Object



262
263
264
265
266
# File 'lib/yfinrb/price_technical.rb', line 262

def md(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.md(inputs, period: window).first
  Polars::Series.new("Mean Dev of #{column} in #{window}-day pd", [nil]*(df.rows.length - output.length)+output) #)
end

#median_price(df) ⇒ Object Also known as: medprice



269
270
271
272
273
# File 'lib/yfinrb/price_technical.rb', line 269

def median_price(df)
  inputs = ['High', 'Low'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.medprice(inputs).first
  Polars::Series.new("Med Price", [nil]*(df.rows.length - output.length)+output) #)
end

#mfi(df, window: 20) ⇒ Object



277
278
279
280
281
# File 'lib/yfinrb/price_technical.rb', line 277

def mfi(df, window: 20)
  inputs = ['High', 'Low', 'Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.mfi(inputs, period: window).first
  Polars::Series.new("#{window}-day Money Flow Idx", [nil]*(df.rows.length - output.length)+output) #)
end

#min(df, column: 'Adj Close', window: 20) ⇒ Object



284
285
286
287
288
# File 'lib/yfinrb/price_technical.rb', line 284

def min(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.min(inputs, period: window).first
  Polars::Series.new("Min of #{column} in #{window}-day pd", [nil]*(df.rows.length - output.length)+output) #)
end

#mom(df, column: 'Adj Close', window: 5) ⇒ Object Also known as: momentum



291
292
293
294
295
# File 'lib/yfinrb/price_technical.rb', line 291

def mom(df, column: 'Adj Close', window: 5)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.mom(inputs, period: window).first
  Polars::Series.new("#{window}-day Momentum of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#moving_avgs(df, window: 20) ⇒ Object



299
300
301
302
303
304
305
# File 'lib/yfinrb/price_technical.rb', line 299

def moving_avgs(df, window: 20)
  df.insert_at_idx(0, Polars::Series.new('idx', (1..df.length).to_a))
  df = df.set_sorted('idx', descending: false)
  s = df.group_by_rolling(index_column: 'idx', period: "#{window}i").agg([Polars.mean('Adj Close').alias("MA(#{window})")]).to_series(1) #)
  df = df.drop('idx')
  s
end

#natr(df, window: 20) ⇒ Object Also known as: normalized_avg_true_range



307
308
309
310
311
# File 'lib/yfinrb/price_technical.rb', line 307

def natr(df, window: 20)
  inputs = ['High', 'Low', 'Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.natr(inputs, period: window).firs
  Polars::Series.new("#{window}-day Norm Avg True Range", [nil]*(df.rows.length - output.length)+output) #)
end

#nvi(df) ⇒ Object



343
344
345
346
347
# File 'lib/yfinrb/price_technical.rb', line 343

def nvi(df)
  inputs = ['Adj Close', 'Volume'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.nvi(inputs).first
  Polars::Series.new("Neg Vol Idx", [nil]*(df.rows.length - output.length)+output) #)
end

#obv(df) ⇒ Object



350
351
352
353
354
# File 'lib/yfinrb/price_technical.rb', line 350

def obv(df)
  inputs = ['Adj Close', 'Volume'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.obv(inputs).first
  Polars::Series.new("On Bal Vol", [nil]*(df.rows.length - output.length)+output) #)
end

#ppo(df, column: 'Adj Close', short_window: 12, long_window: 26) ⇒ Object



357
358
359
360
361
# File 'lib/yfinrb/price_technical.rb', line 357

def ppo(df, column: 'Adj Close', short_window: 12, long_window: 26)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.ppo(inputs, short_period: short_window, long_period: long_window).first
  Polars::Series.new("#{short_window}/#{long_window} Pctage Price Osc of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#psar(df, acceleration_factor_step: 0.2, acceleration_factor_maximum: 2) ⇒ Object



364
365
366
367
368
# File 'lib/yfinrb/price_technical.rb', line 364

def psar(df, acceleration_factor_step: 0.2, acceleration_factor_maximum: 2)
  inputs = ['High', 'Low'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.psar(inputs, acceleration_factor_step, acceleration_factor_maximum).first
  Polars::Series.new("Parabolic SAR w step #{acceleration_factor_step} and max #{acceleration_factor_maximum}", [nil]*(df.rows.length - output.length)+output) #)
end

#pvi(df) ⇒ Object



371
372
373
374
375
# File 'lib/yfinrb/price_technical.rb', line 371

def pvi(df)
  inputs = ['Adj Close', 'Volume'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.pvi(inputs).first
  Polars::Series.new("Pos Vol Idx", [nil]*(df.rows.length - output.length)+output) #)
end

#qstick(df, window: 20) ⇒ Object



378
379
380
381
382
# File 'lib/yfinrb/price_technical.rb', line 378

def qstick(df, window: 20)
  inputs = ['Open', 'Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.qstick(inputs, period: window).first
  Polars::Series.new("#{window}-day Qstick", [nil]*(df.rows.length - output.length)+output) #)
end

#roc(df, column: 'Adj Close', window: 20) ⇒ Object



385
386
387
388
389
# File 'lib/yfinrb/price_technical.rb', line 385

def roc(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.roc(inputs, period: window).first
  Polars::Series.new("Rate of Chg of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#rocr(df, column: 'Adj Close', window: 20) ⇒ Object



392
393
394
395
396
# File 'lib/yfinrb/price_technical.rb', line 392

def rocr(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.rocr(inputs, period: window).first
  Polars::Series.new("Rate of Chg Ratio of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#rsi(df, window: 20) ⇒ Object



398
399
400
401
402
403
# File 'lib/yfinrb/price_technical.rb', line 398

def rsi(df, window: 20)
  return nil if w == 1
  inputs = ['Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.rsi(inputs, period: window).first
  Polars::Series.new("#{window}-day RSI", [nil]*(df.rows.length - output.length)+output) #)
end

#sma(df, column: 'Adj Close', window: 20) ⇒ Object



405
406
407
408
409
# File 'lib/yfinrb/price_technical.rb', line 405

def sma(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.sma(inputs, period: window).first
  Polars::Series.new("SMA(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#stddev(df, column: 'Adj Close', window: 20) ⇒ Object



412
413
414
415
416
# File 'lib/yfinrb/price_technical.rb', line 412

def stddev(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.stddev(inputs, period: window).first
  Polars::Series.new("Rolling Stdev(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#stderr(df, column: 'Adj Close', window: 20) ⇒ Object



419
420
421
422
423
# File 'lib/yfinrb/price_technical.rb', line 419

def stderr(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.stderr(inputs, period: window).first
  Polars::Series.new("Rolling Stderr(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#stochrsi(df, column: 'Adj Close', window: 20) ⇒ Object



426
427
428
429
430
# File 'lib/yfinrb/price_technical.rb', line 426

def stochrsi(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.stochrsi(inputs, period: window).first
  Polars::Series.new("Stochastic RSI(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#sum(df, column: 'Adj Close', window: 20) ⇒ Object



433
434
435
436
437
# File 'lib/yfinrb/price_technical.rb', line 433

def sum(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.sum(inputs, period: window).first
  Polars::Series.new("Rolling #{window}-day Sum of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#tema(df, column: 'Adj Close', window: 20) ⇒ Object



439
440
441
442
443
# File 'lib/yfinrb/price_technical.rb', line 439

def tema(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.tema(inputs, period: window).first
  Polars::Series.new("TEMA(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#tr(df, column: 'Adj Close') ⇒ Object Also known as: true_range



446
447
448
449
450
# File 'lib/yfinrb/price_technical.rb', line 446

def tr(df, column: 'Adj Close')
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.tr(inputs).first
  Polars::Series.new("True Range of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#trima(df, column: 'Adj Close', window: 20) ⇒ Object



454
455
456
457
458
# File 'lib/yfinrb/price_technical.rb', line 454

def trima(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.trima(inputs, period: window).first
  Polars::Series.new("Triang MA(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#trix(df, column: 'Adj Close', window: 20) ⇒ Object



461
462
463
464
465
# File 'lib/yfinrb/price_technical.rb', line 461

def trix(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.trix(inputs, period: window).first
  Polars::Series.new("Trix(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#tsf(df, column: 'Adj Close', window: 20) ⇒ Object



468
469
470
471
472
# File 'lib/yfinrb/price_technical.rb', line 468

def tsf(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.tsf(inputs, period: window).first
  Polars::Series.new("Time-series Fcast(#{window}) of #{window}", [nil]*(df.rows.length - output.length)+output) #)
end

#typical_price(df) ⇒ Object Also known as: typprice



475
476
477
478
479
# File 'lib/yfinrb/price_technical.rb', line 475

def typical_price(df)
  inputs = ['High', 'Low', 'Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.typprice(inputs).first
  Polars::Series.new("Typical Price", [nil]*(df.rows.length - output.length)+output) #)
end

#ultosc(df, short_window: 5, medium_window: 12, long_window: 26) ⇒ Object



483
484
485
486
487
# File 'lib/yfinrb/price_technical.rb', line 483

def ultosc(df, short_window: 5, medium_window: 12, long_window: 26)
  inputs = ['High', 'Low', 'Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.ultosc(inputs, short_period: short_window, medium_period: medium_window, long_period: long_window).first
  Polars::Series.new("Ult Osc(#{short_window}, #{medium_window}, #{long_window})", [nil]*(df.rows.length - output.length)+output) #)
end

#var(df, column: 'Adj Close', window: 20) ⇒ Object



496
497
498
499
500
# File 'lib/yfinrb/price_technical.rb', line 496

def var(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.var(inputs, period: window).first
  Polars::Series.new("Var over Per(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#vhf(df, column: 'Adj Close', window: 20) ⇒ Object



503
504
505
506
507
# File 'lib/yfinrb/price_technical.rb', line 503

def vhf(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.vhf(inputs, period: window).first
  Polars::Series.new("VHF(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#vidya(df, column: 'Adj Close', short_window: 5, long_window: 20, alpha: 0.2) ⇒ Object



510
511
512
513
514
# File 'lib/yfinrb/price_technical.rb', line 510

def vidya(df, column: 'Adj Close', short_window: 5, long_window: 20, alpha: 0.2)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.vidya(inputs, short_period: short_window, long_period: long_window, alpha: alpha).first
  Polars::Series.new("vidya(#{short_window},#{long_window},#{alpha}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#vol_weighted_moving_avg(df, window: 20) ⇒ Object Also known as: vwma



530
531
532
533
534
# File 'lib/yfinrb/price_technical.rb', line 530

def vol_weighted_moving_avg(df, window: 20)
  inputs = ['Adj Close','Volume'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.vwma(inputs, period: window).first
  Polars::Series.new("VWMA(#{window})", [nil]*(df.rows.length - output.length)+output) #)
end

#volatility(df, column: 'Adj Close', window: 20) ⇒ Object



517
518
519
520
521
# File 'lib/yfinrb/price_technical.rb', line 517

def volatility(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.volatility(inputs, period: window).first
  Polars::Series.new("#{window}-day Volatility of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#vosc(df, column: 'Adj Close', short_window: 5, long_window: 20) ⇒ Object



524
525
526
527
528
# File 'lib/yfinrb/price_technical.rb', line 524

def vosc(df, column: 'Adj Close', short_window: 5, long_window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.vosc(inputs, short_period: short_window, long_period: long_window).first
  Polars::Series.new("#{short_window}/#{long_window} Vol Osc of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#wad(df) ⇒ Object



538
539
540
541
542
# File 'lib/yfinrb/price_technical.rb', line 538

def wad(df)
  inputs = ['High','Low','Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.wad(inputs, period: window).first
  Polars::Series.new("Wms Accum/Distrib", [nil]*(df.rows.length - output.length)+output) #)
end

#wcprice(df) ⇒ Object



545
546
547
548
549
# File 'lib/yfinrb/price_technical.rb', line 545

def wcprice(df)
  inputs = ['High','Low','Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.stderr(inputs).first
  Polars::Series.new("Wtd Close Price", [nil]*(df.rows.length - output.length)+output) #)
end

#weighted_close_price(df) ⇒ Object



489
490
491
492
493
# File 'lib/yfinrb/price_technical.rb', line 489

def weighted_close_price(df)
  inputs = ['High', 'Low', 'Adj Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.wcprice(inputs).first
  Polars::Series.new("Wtd Close Price", [nil]*(df.rows.length - output.length)+output) #)
end

#wilders(df, column: 'Adj Close', window: 20) ⇒ Object



552
553
554
555
556
# File 'lib/yfinrb/price_technical.rb', line 552

def wilders(df, column: 'Adj Close', window: 20)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.wilders(inputs, period: window).first
  Polars::Series.new("#{window}-day Wilders Smoothing of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#willr(df, window: 20) ⇒ Object



559
560
561
562
563
# File 'lib/yfinrb/price_technical.rb', line 559

def willr(df, window: 20)
  inputs = ['High','Low','Close'].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.willr(inputs, period: window).first
  Polars::Series.new("#{window}-day Williams %R Ind", [nil]*(df.rows.length - output.length)+output) #)
end

#wma(df, column: 'Adj Close', window: 5) ⇒ Object



566
567
568
569
570
# File 'lib/yfinrb/price_technical.rb', line 566

def wma(df, column: 'Adj Close', window: 5)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.wma(inputs, period: window).first
  Polars::Series.new("WMA(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end

#zlema(df, column: 'Adj Close', window: 5) ⇒ Object



573
574
575
576
577
# File 'lib/yfinrb/price_technical.rb', line 573

def zlema(df, column: 'Adj Close', window: 5)
  inputs = [column].map{|col| Polars::Series.new(df[col]).to_a}
  output = Tulirb.zlema(inputs, period: window).first
  Polars::Series.new("ZLEMA(#{window}) of #{column}", [nil]*(df.rows.length - output.length)+output) #)
end