API Reference¶
Complete API reference for SQA::TAI.
Module Methods¶
SQA::TAI.available?¶
Check if TA-Lib C library is available.
Returns: Boolean
SQA::TAI.check_available!¶
Verify TA-Lib is available, raise error if not.
Raises: SQA::TAI::TAINotInstalledError
Overlap Studies¶
SQA::TAI.sma(prices, period:)¶
Simple Moving Average.
Parameters:
prices(Array) - Price data period(Integer) - Time period (default: 30)
Returns: Array
SQA::TAI.ema(prices, period:)¶
Exponential Moving Average.
Parameters:
prices(Array) - Price data period(Integer) - Time period (default: 30)
Returns: Array
SQA::TAI.wma(prices, period:)¶
Weighted Moving Average.
Parameters:
prices(Array) - Price data period(Integer) - Time period (default: 30)
Returns: Array
SQA::TAI.bbands(prices, period:, nbdev_up:, nbdev_down:)¶
Bollinger Bands.
Parameters:
prices(Array) - Price data period(Integer) - Time period (default: 5)nbdev_up(Float) - Upper deviation (default: 2.0)nbdev_down(Float) - Lower deviation (default: 2.0)
Returns: Array
Momentum Indicators¶
SQA::TAI.rsi(prices, period:)¶
Relative Strength Index.
Parameters:
- prices (Arrayperiod (Integer) - Time period (default: 14)
Returns: Array
SQA::TAI.macd(prices, fast_period:, slow_period:, signal_period:)¶
Moving Average Convergence/Divergence.
Parameters:
prices(Array) - Price data fast_period(Integer) - Fast period (default: 12)slow_period(Integer) - Slow period (default: 26)signal_period(Integer) - Signal period (default: 9)
Returns: Array
macd, signal, histogram = SQA::TAI.macd(prices)
# With custom periods
macd, signal, histogram = SQA::TAI.macd(
prices,
fast_period: 12,
slow_period: 26,
signal_period: 9
)
SQA::TAI.stoch(high, low, close, fastk_period:, slowk_period:, slowd_period:)¶
Stochastic Oscillator.
Parameters:
high(Array) - High prices low(Array) - Low prices close(Array) - Close prices fastk_period(Integer) - Fast K period (default: 5)slowk_period(Integer) - Slow K period (default: 3)slowd_period(Integer) - Slow D period (default: 3)
Returns: Array
SQA::TAI.mom(prices, period:)¶
Momentum.
Parameters:
prices(Array) - Price data period(Integer) - Time period (default: 10)
Returns: Array
Volatility Indicators¶
SQA::TAI.atr(high, low, close, period:)¶
Average True Range.
Parameters:
high(Array) - High prices low(Array) - Low prices close(Array) - Close prices period(Integer) - Time period (default: 14)
Returns: Array
SQA::TAI.trange(high, low, close)¶
True Range.
Parameters:
high(Array) - High prices low(Array) - Low prices close(Array) - Close prices
Returns: Array
Volume Indicators¶
SQA::TAI.obv(close, volume)¶
On Balance Volume.
Parameters:
close(Array) - Close prices volume(Array) - Volume data
Returns: Array
SQA::TAI.ad(high, low, close, volume)¶
Chaikin A/D Line.
Parameters:
high(Array) - High prices low(Array) - Low prices close(Array) - Close prices volume(Array) - Volume data
Returns: Array
Pattern Recognition¶
SQA::TAI.cdl_doji(open, high, low, close)¶
Doji candlestick pattern.
Parameters:
open(Array) - Open prices high(Array) - High prices low(Array) - Low prices close(Array) - Close prices
Returns: Array
SQA::TAI.cdl_hammer(open, high, low, close)¶
Hammer candlestick pattern.
Returns: Array
SQA::TAI.cdl_engulfing(open, high, low, close)¶
Engulfing candlestick pattern.
Returns: Array
Exceptions¶
SQA::TAI::Error¶
Base error class for all SQA::TAI errors.
SQA::TAI::TAINotInstalledError¶
Raised when TA-Lib C library is not installed or not found.
SQA::TAI::InvalidParameterError¶
Raised when invalid parameters are provided to an indicator function.
Common causes: - Empty or nil price array - Period larger than data size - Negative period values - Non-array parameters