openbacktesting 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openbacktesting/__init__.py +85 -0
- openbacktesting/aggregation.py +8 -0
- openbacktesting/broker/__init__.py +54 -0
- openbacktesting/broker/commission.py +57 -0
- openbacktesting/broker/core.py +1122 -0
- openbacktesting/broker/execution.py +62 -0
- openbacktesting/broker/instrument.py +106 -0
- openbacktesting/broker/ledger.py +60 -0
- openbacktesting/broker/models.py +236 -0
- openbacktesting/broker/observations.py +99 -0
- openbacktesting/broker/requests.py +192 -0
- openbacktesting/broker/sizing.py +76 -0
- openbacktesting/colors.py +175 -0
- openbacktesting/data/__init__.py +20 -0
- openbacktesting/data/aggregation.py +39 -0
- openbacktesting/data/context.py +30 -0
- openbacktesting/data/core.py +218 -0
- openbacktesting/data/generators.py +54 -0
- openbacktesting/data/strategy_data.py +103 -0
- openbacktesting/data/timeframe.py +69 -0
- openbacktesting/engine.py +34 -0
- openbacktesting/helpers.py +77 -0
- openbacktesting/indicator_api.py +10 -0
- openbacktesting/indicator_methods.py +123 -0
- openbacktesting/indicator_types.py +19 -0
- openbacktesting/indicators/__init__.py +7 -0
- openbacktesting/indicators/api.py +97 -0
- openbacktesting/indicators/calculus.py +75 -0
- openbacktesting/indicators/candles/__init__.py +0 -0
- openbacktesting/indicators/candles/cdl_doji.py +17 -0
- openbacktesting/indicators/candles/cdl_engulfing.py +14 -0
- openbacktesting/indicators/candles/cdl_eveningstar.py +15 -0
- openbacktesting/indicators/candles/cdl_hammer.py +14 -0
- openbacktesting/indicators/candles/cdl_harami.py +14 -0
- openbacktesting/indicators/candles/cdl_inside.py +14 -0
- openbacktesting/indicators/candles/cdl_marubozu.py +14 -0
- openbacktesting/indicators/candles/cdl_morningstar.py +15 -0
- openbacktesting/indicators/candles/cdl_shootingstar.py +14 -0
- openbacktesting/indicators/candles/cdl_z.py +28 -0
- openbacktesting/indicators/candles/ha.py +19 -0
- openbacktesting/indicators/catalog.json +8348 -0
- openbacktesting/indicators/common.py +94 -0
- openbacktesting/indicators/cycles/__init__.py +0 -0
- openbacktesting/indicators/cycles/dsp.py +10 -0
- openbacktesting/indicators/cycles/ebsw.py +10 -0
- openbacktesting/indicators/cycles/ht_dcperiod.py +10 -0
- openbacktesting/indicators/cycles/ht_dcphase.py +10 -0
- openbacktesting/indicators/cycles/ht_phasor.py +17 -0
- openbacktesting/indicators/cycles/ht_sine.py +17 -0
- openbacktesting/indicators/cycles/ht_trendmode.py +10 -0
- openbacktesting/indicators/cycles/msw.py +19 -0
- openbacktesting/indicators/methods.py +5762 -0
- openbacktesting/indicators/momentum/__init__.py +0 -0
- openbacktesting/indicators/momentum/ac.py +9 -0
- openbacktesting/indicators/momentum/ao.py +10 -0
- openbacktesting/indicators/momentum/apo.py +10 -0
- openbacktesting/indicators/momentum/bias.py +10 -0
- openbacktesting/indicators/momentum/bop.py +10 -0
- openbacktesting/indicators/momentum/brar.py +26 -0
- openbacktesting/indicators/momentum/cci.py +10 -0
- openbacktesting/indicators/momentum/cfo.py +10 -0
- openbacktesting/indicators/momentum/cg.py +10 -0
- openbacktesting/indicators/momentum/cmo.py +10 -0
- openbacktesting/indicators/momentum/coppock.py +10 -0
- openbacktesting/indicators/momentum/crsi.py +28 -0
- openbacktesting/indicators/momentum/cti.py +10 -0
- openbacktesting/indicators/momentum/dm.py +17 -0
- openbacktesting/indicators/momentum/er.py +10 -0
- openbacktesting/indicators/momentum/eri.py +17 -0
- openbacktesting/indicators/momentum/fisher.py +17 -0
- openbacktesting/indicators/momentum/fosc.py +10 -0
- openbacktesting/indicators/momentum/gator.py +13 -0
- openbacktesting/indicators/momentum/ibs.py +7 -0
- openbacktesting/indicators/momentum/inertia.py +22 -0
- openbacktesting/indicators/momentum/kdj.py +18 -0
- openbacktesting/indicators/momentum/kst.py +30 -0
- openbacktesting/indicators/momentum/lrsi.py +10 -0
- openbacktesting/indicators/momentum/macd.py +27 -0
- openbacktesting/indicators/momentum/macdext.py +27 -0
- openbacktesting/indicators/momentum/macdfix.py +18 -0
- openbacktesting/indicators/momentum/mom.py +10 -0
- openbacktesting/indicators/momentum/pgo.py +10 -0
- openbacktesting/indicators/momentum/pmo.py +13 -0
- openbacktesting/indicators/momentum/po.py +10 -0
- openbacktesting/indicators/momentum/ppo.py +20 -0
- openbacktesting/indicators/momentum/psl.py +12 -0
- openbacktesting/indicators/momentum/pvo.py +20 -0
- openbacktesting/indicators/momentum/qqe.py +31 -0
- openbacktesting/indicators/momentum/rci.py +20 -0
- openbacktesting/indicators/momentum/rmi.py +7 -0
- openbacktesting/indicators/momentum/roc.py +10 -0
- openbacktesting/indicators/momentum/rocp.py +10 -0
- openbacktesting/indicators/momentum/rocr.py +10 -0
- openbacktesting/indicators/momentum/rocr100.py +10 -0
- openbacktesting/indicators/momentum/rsi.py +10 -0
- openbacktesting/indicators/momentum/rsx.py +10 -0
- openbacktesting/indicators/momentum/rvgi.py +26 -0
- openbacktesting/indicators/momentum/slope.py +17 -0
- openbacktesting/indicators/momentum/smc_sweep.py +18 -0
- openbacktesting/indicators/momentum/smi.py +21 -0
- openbacktesting/indicators/momentum/smi_stochastic.py +15 -0
- openbacktesting/indicators/momentum/squeeze.py +47 -0
- openbacktesting/indicators/momentum/squeeze_pro.py +53 -0
- openbacktesting/indicators/momentum/stc.py +20 -0
- openbacktesting/indicators/momentum/stoch.py +19 -0
- openbacktesting/indicators/momentum/stochf.py +19 -0
- openbacktesting/indicators/momentum/stochrsi.py +19 -0
- openbacktesting/indicators/momentum/td_seq.py +17 -0
- openbacktesting/indicators/momentum/trix.py +19 -0
- openbacktesting/indicators/momentum/trixh.py +20 -0
- openbacktesting/indicators/momentum/tsi.py +26 -0
- openbacktesting/indicators/momentum/uo.py +22 -0
- openbacktesting/indicators/momentum/vwmacd.py +20 -0
- openbacktesting/indicators/momentum/wavetrend.py +15 -0
- openbacktesting/indicators/momentum/willr.py +10 -0
- openbacktesting/indicators/overlap/__init__.py +0 -0
- openbacktesting/indicators/overlap/alligator.py +13 -0
- openbacktesting/indicators/overlap/alma.py +33 -0
- openbacktesting/indicators/overlap/anchored_vwap.py +50 -0
- openbacktesting/indicators/overlap/anchored_vwap_bands.py +13 -0
- openbacktesting/indicators/overlap/avgprice.py +10 -0
- openbacktesting/indicators/overlap/dema.py +10 -0
- openbacktesting/indicators/overlap/ema.py +12 -0
- openbacktesting/indicators/overlap/frama.py +29 -0
- openbacktesting/indicators/overlap/fwma.py +10 -0
- openbacktesting/indicators/overlap/hilo.py +26 -0
- openbacktesting/indicators/overlap/hl2.py +10 -0
- openbacktesting/indicators/overlap/hlc3.py +10 -0
- openbacktesting/indicators/overlap/hma.py +10 -0
- openbacktesting/indicators/overlap/ht_trendline.py +10 -0
- openbacktesting/indicators/overlap/hwma.py +10 -0
- openbacktesting/indicators/overlap/ichimoku.py +44 -0
- openbacktesting/indicators/overlap/jma.py +10 -0
- openbacktesting/indicators/overlap/kama.py +10 -0
- openbacktesting/indicators/overlap/linreg.py +15 -0
- openbacktesting/indicators/overlap/linregangle.py +10 -0
- openbacktesting/indicators/overlap/linregintercept.py +10 -0
- openbacktesting/indicators/overlap/linregslope.py +10 -0
- openbacktesting/indicators/overlap/ma.py +10 -0
- openbacktesting/indicators/overlap/ma_envelopes.py +16 -0
- openbacktesting/indicators/overlap/mama.py +17 -0
- openbacktesting/indicators/overlap/mavp.py +17 -0
- openbacktesting/indicators/overlap/mcgd.py +10 -0
- openbacktesting/indicators/overlap/medprice.py +10 -0
- openbacktesting/indicators/overlap/midpoint.py +10 -0
- openbacktesting/indicators/overlap/midprice.py +10 -0
- openbacktesting/indicators/overlap/mmar.py +21 -0
- openbacktesting/indicators/overlap/ohlc4.py +10 -0
- openbacktesting/indicators/overlap/pwma.py +10 -0
- openbacktesting/indicators/overlap/rainbow.py +25 -0
- openbacktesting/indicators/overlap/rma.py +10 -0
- openbacktesting/indicators/overlap/sinwma.py +10 -0
- openbacktesting/indicators/overlap/sma.py +14 -0
- openbacktesting/indicators/overlap/ssf.py +10 -0
- openbacktesting/indicators/overlap/supertrend.py +21 -0
- openbacktesting/indicators/overlap/swma.py +10 -0
- openbacktesting/indicators/overlap/t3.py +10 -0
- openbacktesting/indicators/overlap/tema.py +10 -0
- openbacktesting/indicators/overlap/trima.py +10 -0
- openbacktesting/indicators/overlap/tsf.py +10 -0
- openbacktesting/indicators/overlap/typprice.py +10 -0
- openbacktesting/indicators/overlap/vidya.py +10 -0
- openbacktesting/indicators/overlap/vwap.py +10 -0
- openbacktesting/indicators/overlap/vwma.py +10 -0
- openbacktesting/indicators/overlap/wcp.py +10 -0
- openbacktesting/indicators/overlap/wma.py +10 -0
- openbacktesting/indicators/overlap/zlma.py +10 -0
- openbacktesting/indicators/performance/__init__.py +0 -0
- openbacktesting/indicators/performance/drawdown.py +18 -0
- openbacktesting/indicators/performance/log_return.py +10 -0
- openbacktesting/indicators/performance/percent_return.py +10 -0
- openbacktesting/indicators/predicates.py +88 -0
- openbacktesting/indicators/registry.py +571 -0
- openbacktesting/indicators/runtime.py +290 -0
- openbacktesting/indicators/statistics/__init__.py +0 -0
- openbacktesting/indicators/statistics/beta.py +10 -0
- openbacktesting/indicators/statistics/correl.py +10 -0
- openbacktesting/indicators/statistics/entropy.py +10 -0
- openbacktesting/indicators/statistics/kurtosis.py +10 -0
- openbacktesting/indicators/statistics/mad.py +10 -0
- openbacktesting/indicators/statistics/md.py +10 -0
- openbacktesting/indicators/statistics/median.py +10 -0
- openbacktesting/indicators/statistics/mode.py +48 -0
- openbacktesting/indicators/statistics/quantile.py +10 -0
- openbacktesting/indicators/statistics/skew.py +10 -0
- openbacktesting/indicators/statistics/stderr.py +10 -0
- openbacktesting/indicators/statistics/stdev.py +10 -0
- openbacktesting/indicators/statistics/variance.py +10 -0
- openbacktesting/indicators/statistics/zscore.py +10 -0
- openbacktesting/indicators/trend/__init__.py +0 -0
- openbacktesting/indicators/trend/adx.py +28 -0
- openbacktesting/indicators/trend/adxr.py +28 -0
- openbacktesting/indicators/trend/amat.py +19 -0
- openbacktesting/indicators/trend/aroon.py +18 -0
- openbacktesting/indicators/trend/atr_stop.py +33 -0
- openbacktesting/indicators/trend/chop.py +20 -0
- openbacktesting/indicators/trend/cksp.py +17 -0
- openbacktesting/indicators/trend/cpr.py +57 -0
- openbacktesting/indicators/trend/decay.py +10 -0
- openbacktesting/indicators/trend/decreasing.py +18 -0
- openbacktesting/indicators/trend/dpo.py +12 -0
- openbacktesting/indicators/trend/dx.py +19 -0
- openbacktesting/indicators/trend/edecay.py +10 -0
- openbacktesting/indicators/trend/increasing.py +18 -0
- openbacktesting/indicators/trend/long_run.py +10 -0
- openbacktesting/indicators/trend/minus_dm.py +10 -0
- openbacktesting/indicators/trend/pivot_points.py +89 -0
- openbacktesting/indicators/trend/pivothigh.py +23 -0
- openbacktesting/indicators/trend/pivotlow.py +23 -0
- openbacktesting/indicators/trend/plus_dm.py +10 -0
- openbacktesting/indicators/trend/pmax.py +18 -0
- openbacktesting/indicators/trend/psar.py +19 -0
- openbacktesting/indicators/trend/qstick.py +10 -0
- openbacktesting/indicators/trend/sarext.py +35 -0
- openbacktesting/indicators/trend/short_run.py +10 -0
- openbacktesting/indicators/trend/tsignals.py +26 -0
- openbacktesting/indicators/trend/ttm_trend.py +16 -0
- openbacktesting/indicators/trend/vhf.py +10 -0
- openbacktesting/indicators/trend/volatility_stop.py +33 -0
- openbacktesting/indicators/trend/vortex.py +17 -0
- openbacktesting/indicators/trend/xsignals.py +29 -0
- openbacktesting/indicators/types.py +344 -0
- openbacktesting/indicators/utility/__init__.py +0 -0
- openbacktesting/indicators/utility/barssince.py +21 -0
- openbacktesting/indicators/utility/change.py +7 -0
- openbacktesting/indicators/utility/cross.py +12 -0
- openbacktesting/indicators/utility/crossover.py +11 -0
- openbacktesting/indicators/utility/crossunder.py +11 -0
- openbacktesting/indicators/utility/cum.py +7 -0
- openbacktesting/indicators/utility/falling.py +10 -0
- openbacktesting/indicators/utility/highest.py +7 -0
- openbacktesting/indicators/utility/highestbars.py +29 -0
- openbacktesting/indicators/utility/lowest.py +7 -0
- openbacktesting/indicators/utility/lowestbars.py +29 -0
- openbacktesting/indicators/utility/percentile_linear_interpolation.py +12 -0
- openbacktesting/indicators/utility/percentile_nearest_rank.py +16 -0
- openbacktesting/indicators/utility/percentrank.py +7 -0
- openbacktesting/indicators/utility/range.py +8 -0
- openbacktesting/indicators/utility/rising.py +10 -0
- openbacktesting/indicators/utility/rolling_count.py +12 -0
- openbacktesting/indicators/utility/rolling_sum.py +7 -0
- openbacktesting/indicators/utility/running_max.py +7 -0
- openbacktesting/indicators/utility/running_min.py +7 -0
- openbacktesting/indicators/utility/shift.py +7 -0
- openbacktesting/indicators/utility/valuewhen.py +25 -0
- openbacktesting/indicators/volatility/__init__.py +0 -0
- openbacktesting/indicators/volatility/aberration.py +21 -0
- openbacktesting/indicators/volatility/accbands.py +20 -0
- openbacktesting/indicators/volatility/adr.py +7 -0
- openbacktesting/indicators/volatility/atr.py +12 -0
- openbacktesting/indicators/volatility/avolume.py +10 -0
- openbacktesting/indicators/volatility/bbands.py +20 -0
- openbacktesting/indicators/volatility/ce.py +25 -0
- openbacktesting/indicators/volatility/cvi.py +10 -0
- openbacktesting/indicators/volatility/donchian.py +20 -0
- openbacktesting/indicators/volatility/hvol.py +10 -0
- openbacktesting/indicators/volatility/hwc.py +27 -0
- openbacktesting/indicators/volatility/kc.py +27 -0
- openbacktesting/indicators/volatility/massi.py +10 -0
- openbacktesting/indicators/volatility/natr.py +19 -0
- openbacktesting/indicators/volatility/pdist.py +10 -0
- openbacktesting/indicators/volatility/rvi.py +21 -0
- openbacktesting/indicators/volatility/starc.py +11 -0
- openbacktesting/indicators/volatility/thermo.py +28 -0
- openbacktesting/indicators/volatility/true_range.py +31 -0
- openbacktesting/indicators/volatility/ui.py +10 -0
- openbacktesting/indicators/volume/__init__.py +0 -0
- openbacktesting/indicators/volume/ad.py +10 -0
- openbacktesting/indicators/volume/adosc.py +19 -0
- openbacktesting/indicators/volume/aobv.py +31 -0
- openbacktesting/indicators/volume/cmf.py +12 -0
- openbacktesting/indicators/volume/efi.py +12 -0
- openbacktesting/indicators/volume/emv.py +10 -0
- openbacktesting/indicators/volume/eom.py +19 -0
- openbacktesting/indicators/volume/iii.py +9 -0
- openbacktesting/indicators/volume/kvo.py +28 -0
- openbacktesting/indicators/volume/marketfi.py +10 -0
- openbacktesting/indicators/volume/mfi.py +12 -0
- openbacktesting/indicators/volume/nvi.py +26 -0
- openbacktesting/indicators/volume/obv.py +10 -0
- openbacktesting/indicators/volume/pvi.py +26 -0
- openbacktesting/indicators/volume/pvol.py +10 -0
- openbacktesting/indicators/volume/pvr.py +10 -0
- openbacktesting/indicators/volume/pvt.py +10 -0
- openbacktesting/indicators/volume/rvol.py +8 -0
- openbacktesting/indicators/volume/vfi.py +18 -0
- openbacktesting/indicators/volume/vosc.py +10 -0
- openbacktesting/indicators/volume/wad.py +10 -0
- openbacktesting/indicators/volume/wvad.py +9 -0
- openbacktesting/inputs.py +51 -0
- openbacktesting/lib.py +31 -0
- openbacktesting/logs.py +129 -0
- openbacktesting/optimization.py +8 -0
- openbacktesting/optimizer/__init__.py +25 -0
- openbacktesting/optimizer/_semantics.py +155 -0
- openbacktesting/optimizer/identity.py +45 -0
- openbacktesting/optimizer/models.py +92 -0
- openbacktesting/optimizer/plan.py +129 -0
- openbacktesting/optimizer/portfolio-result.schema.json +4984 -0
- openbacktesting/optimizer/query.py +257 -0
- openbacktesting/optimizer/runner.py +98 -0
- openbacktesting/optimizer/storage.py +261 -0
- openbacktesting/optimizer/validation.py +64 -0
- openbacktesting/parallel.py +9 -0
- openbacktesting/plotting/__init__.py +23 -0
- openbacktesting/plotting/collector.py +509 -0
- openbacktesting/plotting/encoding.py +102 -0
- openbacktesting/plotting/types.py +92 -0
- openbacktesting/portfolio/__init__.py +15 -0
- openbacktesting/portfolio/analysis.py +245 -0
- openbacktesting/portfolio/builder.py +381 -0
- openbacktesting/portfolio/catalog.json +1404 -0
- openbacktesting/portfolio/helpers.py +92 -0
- openbacktesting/portfolio/metrics.py +186 -0
- openbacktesting/portfolio/models.py +63 -0
- openbacktesting/portfolio/periods.py +164 -0
- openbacktesting/portfolio/rates.py +14 -0
- openbacktesting/portfolio/snapshot.py +111 -0
- openbacktesting/portfolio/stats.py +272 -0
- openbacktesting/portfolio/trades.py +136 -0
- openbacktesting/portfolio/trading.py +215 -0
- openbacktesting/py.typed +0 -0
- openbacktesting/runtime.py +330 -0
- openbacktesting/simulation/__init__.py +17 -0
- openbacktesting/simulation/collection.py +13 -0
- openbacktesting/simulation/config.py +241 -0
- openbacktesting/simulation/core.py +528 -0
- openbacktesting/simulation/optimization.py +326 -0
- openbacktesting/simulation/parallel.py +145 -0
- openbacktesting/simulation/variants.py +107 -0
- openbacktesting/strategy/__init__.py +19 -0
- openbacktesting/strategy/bar_state.py +14 -0
- openbacktesting/strategy/base.py +810 -0
- openbacktesting/strategy/declaration.py +90 -0
- openbacktesting/strategy/helpers.py +198 -0
- openbacktesting/strategy/inputs.py +460 -0
- openbacktesting/strategy/sizing.py +80 -0
- openbacktesting/strategy/templates.py +160 -0
- openbacktesting/strategy_data.py +10 -0
- openbacktesting/test/BTCUSD.csv +157 -0
- openbacktesting/test/EURUSD.csv +5001 -0
- openbacktesting/test/GOOG.csv +2149 -0
- openbacktesting/test/__init__.py +29 -0
- openbacktesting/test/__main__.py +11 -0
- openbacktesting/test/_test.py +1312 -0
- openbacktesting/util.py +31 -0
- openbacktesting-0.2.0.dist-info/METADATA +151 -0
- openbacktesting-0.2.0.dist-info/RECORD +350 -0
- openbacktesting-0.2.0.dist-info/WHEEL +4 -0
- openbacktesting-0.2.0.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.rocr100: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.rocr100 import rocr100 as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, talib):
|
|
9
|
+
result = _calculate(close=close, length=length, talib=talib)
|
|
10
|
+
return named_series(result, "ta.rocr100", "rocr100")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.rsi: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.rsi import rsi as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, scalar, drift, talib):
|
|
9
|
+
result = _calculate(close=close, length=length, scalar=scalar, drift=drift, talib=talib)
|
|
10
|
+
return named_series(result, "ta.rsi", "rsi")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.rsx: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.rsx import rsx as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, drift, talib):
|
|
9
|
+
result = _calculate(close=close, length=length, drift=drift, talib=talib)
|
|
10
|
+
return named_series(result, "ta.rsx", "rsx")
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""ta.rvgi: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.rvgi import rvgi as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, open_, high, low, close, length, swma_length, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
open_=open_,
|
|
11
|
+
high=high,
|
|
12
|
+
low=low,
|
|
13
|
+
close=close,
|
|
14
|
+
length=length,
|
|
15
|
+
swma_length=swma_length,
|
|
16
|
+
talib=talib,
|
|
17
|
+
)
|
|
18
|
+
return named_frame(
|
|
19
|
+
result,
|
|
20
|
+
"ta.rvgi",
|
|
21
|
+
{
|
|
22
|
+
f"RVGIh_{length}_{swma_length}": "histogram",
|
|
23
|
+
f"RVGI_{length}_{swma_length}": "rvgi",
|
|
24
|
+
f"RVGIs_{length}_{swma_length}": "signal",
|
|
25
|
+
},
|
|
26
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""ta.slope: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.slope import slope as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, as_angle, to_degrees, vertical, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close,
|
|
11
|
+
length=length,
|
|
12
|
+
as_angle=as_angle,
|
|
13
|
+
to_degrees=to_degrees,
|
|
14
|
+
vertical=vertical,
|
|
15
|
+
talib=talib,
|
|
16
|
+
)
|
|
17
|
+
return named_series(result, "ta.slope", "slope")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""ta.smc_sweep: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.smc_sweep import smc_sweep as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, open_, high, low, close, length, wick_mult, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
open_=open_,
|
|
11
|
+
high=high,
|
|
12
|
+
low=low,
|
|
13
|
+
close=close,
|
|
14
|
+
length=length,
|
|
15
|
+
wick_mult=wick_mult,
|
|
16
|
+
talib=talib,
|
|
17
|
+
)
|
|
18
|
+
return named_series(result, "ta.smc_sweep", "smc_sweep")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""ta.smi: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.smi import smi as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, fast, slow, signal, scalar, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close, fast=fast, slow=slow, signal=signal, scalar=scalar, talib=talib
|
|
11
|
+
)
|
|
12
|
+
suffix = f"_{scalar}" if scalar != 1 else ""
|
|
13
|
+
return named_frame(
|
|
14
|
+
result,
|
|
15
|
+
"ta.smi",
|
|
16
|
+
{
|
|
17
|
+
f"SMI_{fast}_{slow}_{signal}{suffix}": "smi",
|
|
18
|
+
f"SMIs_{fast}_{slow}_{signal}{suffix}": "signal",
|
|
19
|
+
f"SMIo_{fast}_{slow}_{signal}{suffix}": "oscillator",
|
|
20
|
+
},
|
|
21
|
+
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""ta.smi_stochastic: Independent formula with a fixed initialization contract."""
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
from ..calculus import average, clean, ratio
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, close, length, smooth, double, signal):
|
|
9
|
+
hi, lo = clean(high).rolling(length).max(), clean(low).rolling(length).min()
|
|
10
|
+
distance = clean(close) - (hi + lo) / 2
|
|
11
|
+
spread = hi - lo
|
|
12
|
+
numerator = average(average(distance, smooth, seeded=False), double, seeded=False)
|
|
13
|
+
denominator = average(average(spread, smooth, seeded=False), double, seeded=False)
|
|
14
|
+
smi = ratio(200 * numerator, denominator)
|
|
15
|
+
return pd.DataFrame({"smi": smi, "signal": average(smi, signal, seeded=False)})
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""ta.squeeze: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.squeeze import squeeze as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(
|
|
9
|
+
*,
|
|
10
|
+
high,
|
|
11
|
+
low,
|
|
12
|
+
close,
|
|
13
|
+
bb_length,
|
|
14
|
+
bb_std,
|
|
15
|
+
kc_length,
|
|
16
|
+
kc_scalar,
|
|
17
|
+
mom_length,
|
|
18
|
+
mom_smooth,
|
|
19
|
+
use_tr,
|
|
20
|
+
mamode,
|
|
21
|
+
talib,
|
|
22
|
+
):
|
|
23
|
+
result = _calculate(
|
|
24
|
+
high=high,
|
|
25
|
+
low=low,
|
|
26
|
+
close=close,
|
|
27
|
+
bb_length=bb_length,
|
|
28
|
+
bb_std=bb_std,
|
|
29
|
+
kc_length=kc_length,
|
|
30
|
+
kc_scalar=kc_scalar,
|
|
31
|
+
mom_length=mom_length,
|
|
32
|
+
mom_smooth=mom_smooth,
|
|
33
|
+
tr=use_tr,
|
|
34
|
+
mamode=mamode,
|
|
35
|
+
talib=talib,
|
|
36
|
+
)
|
|
37
|
+
mode = "" if use_tr else "hlr"
|
|
38
|
+
return named_frame(
|
|
39
|
+
result,
|
|
40
|
+
"ta.squeeze",
|
|
41
|
+
{
|
|
42
|
+
f"SQZ{mode}_{bb_length}_{bb_std}_{kc_length}_{kc_scalar}": "squeeze",
|
|
43
|
+
"SQZ_ON": "on",
|
|
44
|
+
"SQZ_OFF": "off",
|
|
45
|
+
"SQZ_NO": "none",
|
|
46
|
+
},
|
|
47
|
+
)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""ta.squeeze_pro: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.squeeze_pro import squeeze_pro as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(
|
|
9
|
+
*,
|
|
10
|
+
high,
|
|
11
|
+
low,
|
|
12
|
+
close,
|
|
13
|
+
bb_length,
|
|
14
|
+
bb_std,
|
|
15
|
+
kc_length,
|
|
16
|
+
kc_scalar_wide,
|
|
17
|
+
kc_scalar_normal,
|
|
18
|
+
kc_scalar_narrow,
|
|
19
|
+
mom_length,
|
|
20
|
+
mom_smooth,
|
|
21
|
+
use_tr,
|
|
22
|
+
mamode,
|
|
23
|
+
talib,
|
|
24
|
+
):
|
|
25
|
+
result = _calculate(
|
|
26
|
+
high=high,
|
|
27
|
+
low=low,
|
|
28
|
+
close=close,
|
|
29
|
+
bb_length=bb_length,
|
|
30
|
+
bb_std=bb_std,
|
|
31
|
+
kc_length=kc_length,
|
|
32
|
+
kc_scalar_wide=kc_scalar_wide,
|
|
33
|
+
kc_scalar_normal=kc_scalar_normal,
|
|
34
|
+
kc_scalar_narrow=kc_scalar_narrow,
|
|
35
|
+
mom_length=mom_length,
|
|
36
|
+
mom_smooth=mom_smooth,
|
|
37
|
+
tr=use_tr,
|
|
38
|
+
mamode=mamode,
|
|
39
|
+
talib=talib,
|
|
40
|
+
)
|
|
41
|
+
mode = "" if use_tr else "hlr"
|
|
42
|
+
return named_frame(
|
|
43
|
+
result,
|
|
44
|
+
"ta.squeeze_pro",
|
|
45
|
+
{
|
|
46
|
+
f"SQZPRO{mode}_{bb_length}_{bb_std}_{kc_length}_{float(kc_scalar_wide)}_{float(kc_scalar_normal)}_{float(kc_scalar_narrow)}": "squeeze",
|
|
47
|
+
"SQZPRO_ON_WIDE": "on_wide",
|
|
48
|
+
"SQZPRO_ON_NORMAL": "on_normal",
|
|
49
|
+
"SQZPRO_ON_NARROW": "on_narrow",
|
|
50
|
+
"SQZPRO_OFF": "off",
|
|
51
|
+
"SQZPRO_NO": "none",
|
|
52
|
+
},
|
|
53
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""ta.stc: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.stc import stc as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, tclength, fast, slow, factor, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close, tclength=tclength, fast=fast, slow=slow, factor=factor, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_frame(
|
|
13
|
+
result,
|
|
14
|
+
"ta.stc",
|
|
15
|
+
{
|
|
16
|
+
f"STC_{tclength}_{fast}_{slow}_{factor}": "stc",
|
|
17
|
+
f"STCmacd_{tclength}_{fast}_{slow}_{factor}": "macd",
|
|
18
|
+
f"STCstoch_{tclength}_{fast}_{slow}_{factor}": "stochastic",
|
|
19
|
+
},
|
|
20
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""ta.stoch: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.stoch import stoch as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, close, k, d, smooth_k, mamode, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
high=high, low=low, close=close, k=k, d=d, smooth_k=smooth_k, mamode=mamode, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_frame(
|
|
13
|
+
result,
|
|
14
|
+
"ta.stoch",
|
|
15
|
+
{
|
|
16
|
+
f"STOCHk_{k}_{d}_{smooth_k}": "k",
|
|
17
|
+
f"STOCHd_{k}_{d}_{smooth_k}": "d",
|
|
18
|
+
},
|
|
19
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""ta.stochf: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.stochf import stochf as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, close, fastk, fastd, mamode, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
high=high, low=low, close=close, fastk=fastk, fastd=fastd, mamode=mamode, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_frame(
|
|
13
|
+
result,
|
|
14
|
+
"ta.stochf",
|
|
15
|
+
{
|
|
16
|
+
f"STOCHFk_{fastk}_{fastd}": "k",
|
|
17
|
+
f"STOCHFd_{fastk}_{fastd}": "d",
|
|
18
|
+
},
|
|
19
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""ta.stochrsi: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.stochrsi import stochrsi as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, rsi_length, k, d, mamode, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close, length=length, rsi_length=rsi_length, k=k, d=d, mamode=mamode, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_frame(
|
|
13
|
+
result,
|
|
14
|
+
"ta.stochrsi",
|
|
15
|
+
{
|
|
16
|
+
f"STOCHRSIk_{length}_{rsi_length}_{k}_{d}": "k",
|
|
17
|
+
f"STOCHRSId_{length}_{rsi_length}_{k}_{d}": "d",
|
|
18
|
+
},
|
|
19
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""ta.td_seq: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.td_seq import td_seq as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, asint, show_all, talib):
|
|
9
|
+
result = _calculate(close=close, asint=asint, show_all=show_all, talib=talib)
|
|
10
|
+
return named_frame(
|
|
11
|
+
result,
|
|
12
|
+
"ta.td_seq",
|
|
13
|
+
{
|
|
14
|
+
"TD_SEQ_UPa": "up",
|
|
15
|
+
"TD_SEQ_DNa": "down",
|
|
16
|
+
},
|
|
17
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""ta.trix: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.trix import trix as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, signal, scalar, drift, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close, length=length, signal=signal, scalar=scalar, drift=drift, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_frame(
|
|
13
|
+
result,
|
|
14
|
+
"ta.trix",
|
|
15
|
+
{
|
|
16
|
+
f"TRIX_{length}_{signal}": "trix",
|
|
17
|
+
f"TRIXs_{length}_{signal}": "signal",
|
|
18
|
+
},
|
|
19
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""ta.trixh: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.trixh import trixh as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, signal, scalar, drift, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close, length=length, signal=signal, scalar=scalar, drift=drift, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_frame(
|
|
13
|
+
result,
|
|
14
|
+
"ta.trixh",
|
|
15
|
+
{
|
|
16
|
+
f"TRIX_{length}_{signal}": "trix",
|
|
17
|
+
f"TRIXs_{length}_{signal}": "signal",
|
|
18
|
+
f"TRIXh_{length}_{signal}": "histogram",
|
|
19
|
+
},
|
|
20
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""ta.tsi: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.tsi import tsi as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, fast, slow, signal, scalar, mamode, drift, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close,
|
|
11
|
+
fast=fast,
|
|
12
|
+
slow=slow,
|
|
13
|
+
signal=signal,
|
|
14
|
+
scalar=scalar,
|
|
15
|
+
mamode=mamode,
|
|
16
|
+
drift=drift,
|
|
17
|
+
talib=talib,
|
|
18
|
+
)
|
|
19
|
+
return named_frame(
|
|
20
|
+
result,
|
|
21
|
+
"ta.tsi",
|
|
22
|
+
{
|
|
23
|
+
f"TSI_{fast}_{slow}_{signal}": "tsi",
|
|
24
|
+
f"TSIs_{fast}_{slow}_{signal}": "signal",
|
|
25
|
+
},
|
|
26
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""ta.uo: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.uo import uo as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, close, fast, medium, slow, fast_w, medium_w, slow_w, drift, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
high=high,
|
|
11
|
+
low=low,
|
|
12
|
+
close=close,
|
|
13
|
+
fast=fast,
|
|
14
|
+
medium=medium,
|
|
15
|
+
slow=slow,
|
|
16
|
+
fast_w=fast_w,
|
|
17
|
+
medium_w=medium_w,
|
|
18
|
+
slow_w=slow_w,
|
|
19
|
+
drift=drift,
|
|
20
|
+
talib=talib,
|
|
21
|
+
)
|
|
22
|
+
return named_series(result, "ta.uo", "uo")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""ta.vwmacd: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.vwmacd import vwmacd as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, volume, fast, slow, signal, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close, volume=volume, fast=fast, slow=slow, signal=signal, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_frame(
|
|
13
|
+
result,
|
|
14
|
+
"ta.vwmacd",
|
|
15
|
+
{
|
|
16
|
+
f"VWMACD_{fast}_{slow}_{signal}": "macd",
|
|
17
|
+
f"VWMACDh_{fast}_{slow}_{signal}": "histogram",
|
|
18
|
+
f"VWMACDs_{fast}_{slow}_{signal}": "signal",
|
|
19
|
+
},
|
|
20
|
+
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""ta.wavetrend: Independent formula with a fixed initialization contract."""
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
from ..calculus import average as ema
|
|
6
|
+
from ..calculus import clean, ratio
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def compute(*, high, low, close, length, average, signal):
|
|
10
|
+
price = (clean(high) + clean(low) + clean(close)) / 3
|
|
11
|
+
basis = ema(price, length, seeded=False)
|
|
12
|
+
deviation = ema((price - basis).abs(), length, seeded=False)
|
|
13
|
+
normalized = ratio(price - basis, 0.015 * deviation)
|
|
14
|
+
wave = ema(normalized, average, seeded=False)
|
|
15
|
+
return pd.DataFrame({"wave": wave, "signal": wave.rolling(signal).mean()})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.willr: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.willr import willr as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, close, length, talib):
|
|
9
|
+
result = _calculate(high=high, low=low, close=close, length=length, talib=talib)
|
|
10
|
+
return named_series(result, "ta.willr", "willr")
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""ta.alligator: Independent formula with a fixed initialization contract."""
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
from ..calculus import average, clean
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, jaw, teeth, lips):
|
|
9
|
+
middle = (clean(high) + clean(low)) / 2
|
|
10
|
+
j = average(middle, jaw, alpha=1 / jaw)
|
|
11
|
+
t = average(middle, teeth, alpha=1 / teeth)
|
|
12
|
+
l = average(middle, lips, alpha=1 / lips)
|
|
13
|
+
return pd.DataFrame({"jaw": j, "teeth": t, "lips": l})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""ta.alma: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
from pandas_ta_classic.overlap.alma import alma as _calculate
|
|
6
|
+
|
|
7
|
+
from ..common import named_series
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def compute(*, close, length, sigma, distribution_offset, talib, floor):
|
|
11
|
+
if floor:
|
|
12
|
+
center = np.floor(distribution_offset * (length - 1))
|
|
13
|
+
distance = np.arange(length, dtype=float) - center
|
|
14
|
+
# The center is an integer, ensuring at least one weight is exactly 1; other weights can safely underflow for extreme sigma.
|
|
15
|
+
with np.errstate(over="ignore", under="ignore"):
|
|
16
|
+
scaled = distance * (sigma / length)
|
|
17
|
+
weights = np.exp(-0.5 * scaled * scaled)
|
|
18
|
+
weights /= weights.sum()
|
|
19
|
+
output = np.full(len(close), np.nan)
|
|
20
|
+
if len(close) >= length:
|
|
21
|
+
windows = np.lib.stride_tricks.sliding_window_view(close.to_numpy(), length)
|
|
22
|
+
with np.errstate(invalid="ignore", over="ignore"):
|
|
23
|
+
values = windows @ weights[::-1]
|
|
24
|
+
output[length - 1 :] = np.where(np.isfinite(windows).all(axis=1), values, np.nan)
|
|
25
|
+
return pd.Series(output, index=close.index, name="alma")
|
|
26
|
+
result = _calculate(
|
|
27
|
+
close=close,
|
|
28
|
+
length=length,
|
|
29
|
+
sigma=sigma,
|
|
30
|
+
distribution_offset=distribution_offset,
|
|
31
|
+
talib=talib,
|
|
32
|
+
)
|
|
33
|
+
return named_series(result, "ta.alma", "alma")
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Weighted accumulation with explicit condition anchors; no inference of sessions or higher timeframes."""
|
|
2
|
+
|
|
3
|
+
from math import isfinite, sqrt
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
import pandas as pd
|
|
7
|
+
|
|
8
|
+
from ..calculus import condition
|
|
9
|
+
from ..types import IndicatorError
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _calculate(*, source, volume, anchor, indicator, stdev_mult):
|
|
13
|
+
reset = condition(anchor, indicator)
|
|
14
|
+
if reset.isna().any():
|
|
15
|
+
raise IndicatorError("invalid-input", indicator, "Anchors must not be missing")
|
|
16
|
+
if ((volume < 0) & np.isfinite(volume)).any():
|
|
17
|
+
raise IndicatorError("invalid-input", indicator, "Volume must not be negative")
|
|
18
|
+
values = np.full((len(source), 3), np.nan)
|
|
19
|
+
started = False
|
|
20
|
+
weight = mean = moment = 0.0
|
|
21
|
+
for i, (x, v, flag) in enumerate(zip(source, volume, reset)):
|
|
22
|
+
if flag == 1:
|
|
23
|
+
started = True
|
|
24
|
+
weight = mean = moment = 0.0
|
|
25
|
+
if not started or not (isfinite(x) and isfinite(v)):
|
|
26
|
+
continue
|
|
27
|
+
if v > 0:
|
|
28
|
+
total = weight + v
|
|
29
|
+
if weight == 0:
|
|
30
|
+
mean = x
|
|
31
|
+
else:
|
|
32
|
+
delta = x - mean
|
|
33
|
+
mean += delta * (v / total)
|
|
34
|
+
# Equivalent to weighted Welford central-moment increments; all factors are nonnegative, avoiding negative variance from cancellation.
|
|
35
|
+
moment += delta * delta * (weight / total) * v
|
|
36
|
+
weight = total
|
|
37
|
+
if weight == 0:
|
|
38
|
+
continue
|
|
39
|
+
spread = stdev_mult * sqrt(moment / weight)
|
|
40
|
+
row = mean, mean - spread, mean + spread
|
|
41
|
+
if not all(isfinite(value) for value in (*row, weight, moment)):
|
|
42
|
+
raise IndicatorError("calculation-failed", indicator, "VWAP accumulation or output overflow")
|
|
43
|
+
values[i] = row
|
|
44
|
+
return pd.DataFrame(values, index=source.index, columns=["vwap", "lower", "upper"])
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def compute(*, source, volume, anchor):
|
|
48
|
+
return _calculate(
|
|
49
|
+
source=source, volume=volume, anchor=anchor, indicator="ta.anchored_vwap", stdev_mult=0.0
|
|
50
|
+
)["vwap"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Volume-weighted population standard-deviation bands for conditional VWAP."""
|
|
2
|
+
|
|
3
|
+
from .anchored_vwap import _calculate
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def compute(*, source, volume, anchor, stdev_mult):
|
|
7
|
+
return _calculate(
|
|
8
|
+
source=source,
|
|
9
|
+
volume=volume,
|
|
10
|
+
anchor=anchor,
|
|
11
|
+
indicator="ta.anchored_vwap_bands",
|
|
12
|
+
stdev_mult=stdev_mult,
|
|
13
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.avgprice: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.overlap.avgprice import avgprice as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, open_, high, low, close, talib):
|
|
9
|
+
result = _calculate(open_=open_, high=high, low=low, close=close, talib=talib)
|
|
10
|
+
return named_series(result, "ta.avgprice", "avgprice")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.dema: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.overlap.dema import dema as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, talib):
|
|
9
|
+
result = _calculate(close=close, length=length, talib=talib)
|
|
10
|
+
return named_series(result, "ta.dema", "dema")
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""ta.ema: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.overlap.ema import ema as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, adjust, sma, offset, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close, length=length, adjust=adjust, sma=sma, offset=offset, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_series(result, "ta.ema", "ema")
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""ta.frama: Independent formula with a fixed initialization contract."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
|
|
6
|
+
from ..calculus import clean
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def compute(*, high, low, close, length):
|
|
10
|
+
high, low, close = clean(high), clean(low), clean(close)
|
|
11
|
+
half = length // 2
|
|
12
|
+
small = (high.rolling(half).max() - low.rolling(half).min()) / half
|
|
13
|
+
full = (high.rolling(length).max() - low.rolling(length).min()) / length
|
|
14
|
+
combined = small + small.shift(half)
|
|
15
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
16
|
+
dimension = np.log(combined / full) / np.log(2)
|
|
17
|
+
alpha = np.exp(-4.6 * (dimension - 1)).clip(0.01, 1)
|
|
18
|
+
alpha = alpha.mask((combined == 0) & (full == 0), 1.0)
|
|
19
|
+
result = np.full(len(close), np.nan)
|
|
20
|
+
previous = np.nan
|
|
21
|
+
for i, (price, weight) in enumerate(zip(close, alpha)):
|
|
22
|
+
if not np.isfinite(price) or not np.isfinite(weight):
|
|
23
|
+
previous = np.nan
|
|
24
|
+
else:
|
|
25
|
+
previous = (
|
|
26
|
+
price if not np.isfinite(previous) else weight * price + (1 - weight) * previous
|
|
27
|
+
)
|
|
28
|
+
result[i] = previous
|
|
29
|
+
return pd.Series(result, index=close.index, name="frama")
|