mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-07 21:47:43 +00:00
feat: add 8 new indicators with full integration
New indicators: - HWC (Holt-Winters Channel) — channels, 27 tests - VWMACD (Volume-Weighted MACD) — momentum, 38 tests - Squeeze Pro — oscillators, 69 tests - BW_MFI (Bill Williams MFI) — oscillators - DSTOCH (Double Stochastic) — oscillators - ATRSTOP (ATR Trailing Stop) — reversals - VSTOP (Volatility Stop) — reversals - Convexity (Beta Convexity) — statistics, 23 tests Integration: - Python bridge: Exports.cs, _bridge.py, wrapper modules - Documentation: _sidebar.md, _index.md pages, SPEC.md - All analyzer warnings fixed (MA0074, xUnit2013, S2699) Build: 0 warnings, 0 errors | Tests: 15,933 passed, 0 failed
This commit is contained in:
@@ -41,6 +41,7 @@ __all__ = [
|
||||
"correl",
|
||||
"covariance",
|
||||
"cointegration",
|
||||
"convexity",
|
||||
]
|
||||
|
||||
|
||||
@@ -406,3 +407,27 @@ def cointegration(x: object, y: object, period: int = 20,
|
||||
n = len(xarr); dst = _out(n)
|
||||
_check(_lib.qtl_cointegration(_ptr(xarr), _ptr(yarr), n, _ptr(dst), period))
|
||||
return _wrap(dst, idx, f"COINT_{period}", "statistics", offset)
|
||||
|
||||
|
||||
def convexity(x: object, y: object, period: int = 20,
|
||||
offset: int = 0, **kwargs) -> object:
|
||||
"""Beta Convexity (up/down beta asymmetry).
|
||||
|
||||
Returns dict with keys: beta_std, beta_up, beta_down, ratio, convexity.
|
||||
"""
|
||||
period = int(kwargs.get("length", period)); offset = int(offset)
|
||||
xarr, idx = _arr(x); yarr, _ = _arr(y)
|
||||
n = len(xarr)
|
||||
d_std = _out(n); d_up = _out(n); d_down = _out(n)
|
||||
d_ratio = _out(n); d_cvx = _out(n)
|
||||
_check(_lib.qtl_convexity(
|
||||
_ptr(xarr), _ptr(yarr), n,
|
||||
_ptr(d_std), _ptr(d_up), _ptr(d_down),
|
||||
_ptr(d_ratio), _ptr(d_cvx), period))
|
||||
return {
|
||||
"beta_std": _wrap(d_std, idx, f"BETA_STD_{period}", "statistics", offset),
|
||||
"beta_up": _wrap(d_up, idx, f"BETA_UP_{period}", "statistics", offset),
|
||||
"beta_down": _wrap(d_down, idx, f"BETA_DOWN_{period}", "statistics", offset),
|
||||
"ratio": _wrap(d_ratio, idx, f"RATIO_{period}", "statistics", offset),
|
||||
"convexity": _wrap(d_cvx, idx, f"CONVEXITY_{period}", "statistics", offset),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user