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
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""ta.ac: Independent formula with a fixed initialization contract."""
|
|
2
|
+
|
|
3
|
+
from ..calculus import clean
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def compute(*, high, low, fast, slow, signal):
|
|
7
|
+
middle = (clean(high) + clean(low)) / 2
|
|
8
|
+
ao = middle.rolling(fast).mean() - middle.rolling(slow).mean()
|
|
9
|
+
return (ao - ao.rolling(signal).mean()).rename("ac")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.ao: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.ao import ao as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, fast, slow, talib):
|
|
9
|
+
result = _calculate(high=high, low=low, fast=fast, slow=slow, talib=talib)
|
|
10
|
+
return named_series(result, "ta.ao", "ao")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.apo: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.apo import apo as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, fast, slow, mamode, talib):
|
|
9
|
+
result = _calculate(close=close, fast=fast, slow=slow, mamode=mamode, talib=talib)
|
|
10
|
+
return named_series(result, "ta.apo", "apo")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.bias: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.bias import bias as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, mamode, talib):
|
|
9
|
+
result = _calculate(close=close, length=length, mamode=mamode, talib=talib)
|
|
10
|
+
return named_series(result, "ta.bias", "bias")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.bop: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.bop import bop as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, open_, high, low, close, scalar, talib):
|
|
9
|
+
result = _calculate(open_=open_, high=high, low=low, close=close, scalar=scalar, talib=talib)
|
|
10
|
+
return named_series(result, "ta.bop", "bop")
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""ta.brar: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.brar import brar as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, open_, high, low, close, length, scalar, drift, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
open_=open_,
|
|
11
|
+
high=high,
|
|
12
|
+
low=low,
|
|
13
|
+
close=close,
|
|
14
|
+
length=length,
|
|
15
|
+
scalar=scalar,
|
|
16
|
+
drift=drift,
|
|
17
|
+
talib=talib,
|
|
18
|
+
)
|
|
19
|
+
return named_frame(
|
|
20
|
+
result,
|
|
21
|
+
"ta.brar",
|
|
22
|
+
{
|
|
23
|
+
f"AR_{length}": "ar",
|
|
24
|
+
f"BR_{length}": "br",
|
|
25
|
+
},
|
|
26
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.cci: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.cci import cci as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, close, length, c, talib):
|
|
9
|
+
result = _calculate(high=high, low=low, close=close, length=length, c=c, talib=talib)
|
|
10
|
+
return named_series(result, "ta.cci", "cci")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.cfo: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.cfo import cfo 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.cfo", "cfo")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.cg: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.cg import cg 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.cg", "cg")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.cmo: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.cmo import cmo 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.cmo", "cmo")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.coppock: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.coppock import coppock as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, fast, slow, talib):
|
|
9
|
+
result = _calculate(close=close, length=length, fast=fast, slow=slow, talib=talib)
|
|
10
|
+
return named_series(result, "ta.coppock", "coppock")
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""ta.crsi: Independent formula with a fixed initialization contract."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
|
|
6
|
+
from ..calculus import clean, strength
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def compute(*, close, length, streak, rank):
|
|
10
|
+
close = clean(close)
|
|
11
|
+
delta = close.diff()
|
|
12
|
+
streaks = np.full(len(close), np.nan)
|
|
13
|
+
previous = 0.0
|
|
14
|
+
for i, value in enumerate(delta):
|
|
15
|
+
if not np.isfinite(value):
|
|
16
|
+
previous = 0.0
|
|
17
|
+
elif value == 0:
|
|
18
|
+
previous = 0.0
|
|
19
|
+
streaks[i] = previous
|
|
20
|
+
else:
|
|
21
|
+
sign = np.sign(value)
|
|
22
|
+
previous = previous + sign if previous * sign > 0 else sign
|
|
23
|
+
streaks[i] = previous
|
|
24
|
+
streak_series = pd.Series(streaks, index=close.index)
|
|
25
|
+
roc = (close / close.shift(1) - 1).where(close.shift(1) > 0)
|
|
26
|
+
percentile = (roc.rolling(rank + 1).rank(method="min") - 1) * 100 / rank
|
|
27
|
+
result = (strength(delta, length) + strength(streak_series.diff(), streak) + percentile) / 3
|
|
28
|
+
return result.rename("crsi")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.cti: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.cti import cti 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.cti", "cti")
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""ta.dm: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.dm import dm as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, length, mamode, drift, talib):
|
|
9
|
+
result = _calculate(high=high, low=low, length=length, mamode=mamode, drift=drift, talib=talib)
|
|
10
|
+
return named_frame(
|
|
11
|
+
result,
|
|
12
|
+
"ta.dm",
|
|
13
|
+
{
|
|
14
|
+
f"DMP_{length}": "positive",
|
|
15
|
+
f"DMN_{length}": "negative",
|
|
16
|
+
},
|
|
17
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.er: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.er import er 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.er", "er")
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""ta.eri: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.eri import eri as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
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_frame(
|
|
11
|
+
result,
|
|
12
|
+
"ta.eri",
|
|
13
|
+
{
|
|
14
|
+
f"BULLP_{length}": "bull_power",
|
|
15
|
+
f"BEARP_{length}": "bear_power",
|
|
16
|
+
},
|
|
17
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""ta.fisher: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.fisher import fisher as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, length, signal, talib):
|
|
9
|
+
result = _calculate(high=high, low=low, length=length, signal=signal, talib=talib)
|
|
10
|
+
return named_frame(
|
|
11
|
+
result,
|
|
12
|
+
"ta.fisher",
|
|
13
|
+
{
|
|
14
|
+
f"FISHERT_{length}_{signal}": "fisher",
|
|
15
|
+
f"FISHERTs_{length}_{signal}": "signal",
|
|
16
|
+
},
|
|
17
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.fosc: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.fosc import fosc 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.fosc", "fosc")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""ta.gator: 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({"upper": (j - t).abs(), "lower": -(t - l).abs()})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""ta.inertia: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.inertia import inertia as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, high, low, length, rvi_length, scalar, refined, thirds, mamode, drift, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close,
|
|
11
|
+
high=high,
|
|
12
|
+
low=low,
|
|
13
|
+
length=length,
|
|
14
|
+
rvi_length=rvi_length,
|
|
15
|
+
scalar=scalar,
|
|
16
|
+
refined=refined,
|
|
17
|
+
thirds=thirds,
|
|
18
|
+
mamode=mamode,
|
|
19
|
+
drift=drift,
|
|
20
|
+
talib=talib,
|
|
21
|
+
)
|
|
22
|
+
return named_series(result, "ta.inertia", "inertia")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""ta.kdj: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.kdj import kdj as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, high, low, close, length, signal, talib):
|
|
9
|
+
result = _calculate(high=high, low=low, close=close, length=length, signal=signal, talib=talib)
|
|
10
|
+
return named_frame(
|
|
11
|
+
result,
|
|
12
|
+
"ta.kdj",
|
|
13
|
+
{
|
|
14
|
+
f"K_{length}_{signal}": "k",
|
|
15
|
+
f"D_{length}_{signal}": "d",
|
|
16
|
+
f"J_{length}_{signal}": "j",
|
|
17
|
+
},
|
|
18
|
+
)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""ta.kst: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.kst import kst as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, roc1, roc2, roc3, roc4, sma1, sma2, sma3, sma4, signal, drift, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close,
|
|
11
|
+
roc1=roc1,
|
|
12
|
+
roc2=roc2,
|
|
13
|
+
roc3=roc3,
|
|
14
|
+
roc4=roc4,
|
|
15
|
+
sma1=sma1,
|
|
16
|
+
sma2=sma2,
|
|
17
|
+
sma3=sma3,
|
|
18
|
+
sma4=sma4,
|
|
19
|
+
signal=signal,
|
|
20
|
+
drift=drift,
|
|
21
|
+
talib=talib,
|
|
22
|
+
)
|
|
23
|
+
return named_frame(
|
|
24
|
+
result,
|
|
25
|
+
"ta.kst",
|
|
26
|
+
{
|
|
27
|
+
f"KST_{roc1}_{roc2}_{roc3}_{roc4}_{sma1}_{sma2}_{sma3}_{sma4}": "kst",
|
|
28
|
+
f"KSTs_{signal}": "signal",
|
|
29
|
+
},
|
|
30
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.lrsi: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.lrsi import lrsi as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, gamma, talib):
|
|
9
|
+
result = _calculate(close=close, length=length, gamma=gamma, talib=talib)
|
|
10
|
+
return named_series(result, "ta.lrsi", "lrsi")
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""ta.macd: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.macd import macd as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, fast, slow, signal, offset, asmode, signal_indicators, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close,
|
|
11
|
+
fast=fast,
|
|
12
|
+
slow=slow,
|
|
13
|
+
signal=signal,
|
|
14
|
+
offset=offset,
|
|
15
|
+
asmode=asmode,
|
|
16
|
+
signal_indicators=signal_indicators,
|
|
17
|
+
talib=talib,
|
|
18
|
+
)
|
|
19
|
+
return named_frame(
|
|
20
|
+
result,
|
|
21
|
+
"ta.macd",
|
|
22
|
+
{
|
|
23
|
+
f"MACD_{fast}_{slow}_{signal}": "macd",
|
|
24
|
+
f"MACDh_{fast}_{slow}_{signal}": "histogram",
|
|
25
|
+
f"MACDs_{fast}_{slow}_{signal}": "signal",
|
|
26
|
+
},
|
|
27
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""ta.macdext: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.macdext import macdext as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, fast, slow, signal, fastmatype, slowmatype, signalmatype, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close,
|
|
11
|
+
fast=fast,
|
|
12
|
+
slow=slow,
|
|
13
|
+
signal=signal,
|
|
14
|
+
fastmatype=fastmatype,
|
|
15
|
+
slowmatype=slowmatype,
|
|
16
|
+
signalmatype=signalmatype,
|
|
17
|
+
talib=talib,
|
|
18
|
+
)
|
|
19
|
+
return named_frame(
|
|
20
|
+
result,
|
|
21
|
+
"ta.macdext",
|
|
22
|
+
{
|
|
23
|
+
f"MACDEXT_{fast}_{slow}_{signal}": "macd",
|
|
24
|
+
f"MACDEXTs_{fast}_{slow}_{signal}": "signal",
|
|
25
|
+
f"MACDEXTh_{fast}_{slow}_{signal}": "histogram",
|
|
26
|
+
},
|
|
27
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""ta.macdfix: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.macdfix import macdfix as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, signal, talib):
|
|
9
|
+
result = _calculate(close=close, signal=signal, talib=talib)
|
|
10
|
+
return named_frame(
|
|
11
|
+
result,
|
|
12
|
+
"ta.macdfix",
|
|
13
|
+
{
|
|
14
|
+
f"MACDFIX_{signal}_{signal}": "macd",
|
|
15
|
+
f"MACDFIXh_{signal}_{signal}": "histogram",
|
|
16
|
+
f"MACDFIXs_{signal}_{signal}": "signal",
|
|
17
|
+
},
|
|
18
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.mom: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.mom import mom 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.mom", "mom")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.pgo: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.pgo import pgo 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.pgo", "pgo")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""ta.pmo: 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(*, close, length, smooth, signal):
|
|
9
|
+
close = clean(close)
|
|
10
|
+
roc = 100 * (ratio(close, close.shift(1)) - 1)
|
|
11
|
+
first = average(roc, length, alpha=2 / length)
|
|
12
|
+
pmo = average(first * 10, smooth, alpha=2 / smooth)
|
|
13
|
+
return pd.DataFrame({"pmo": pmo, "signal": average(pmo, signal)})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.po: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.po import po 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.po", "po")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""ta.ppo: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.ppo import ppo as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, fast, slow, signal, scalar, mamode, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close, fast=fast, slow=slow, signal=signal, scalar=scalar, mamode=mamode, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_frame(
|
|
13
|
+
result,
|
|
14
|
+
"ta.ppo",
|
|
15
|
+
{
|
|
16
|
+
f"PPO_{fast}_{slow}_{signal}": "ppo",
|
|
17
|
+
f"PPOh_{fast}_{slow}_{signal}": "histogram",
|
|
18
|
+
f"PPOs_{fast}_{slow}_{signal}": "signal",
|
|
19
|
+
},
|
|
20
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""ta.psl: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.psl import psl as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, scalar, drift, open_, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close, length=length, scalar=scalar, drift=drift, open_=open_, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_series(result, "ta.psl", "psl")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""ta.pvo: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.pvo import pvo as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, volume, fast, slow, signal, scalar, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
volume=volume, fast=fast, slow=slow, signal=signal, scalar=scalar, talib=talib
|
|
11
|
+
)
|
|
12
|
+
return named_frame(
|
|
13
|
+
result,
|
|
14
|
+
"ta.pvo",
|
|
15
|
+
{
|
|
16
|
+
f"PVO_{fast}_{slow}_{signal}": "pvo",
|
|
17
|
+
f"PVOh_{fast}_{slow}_{signal}": "histogram",
|
|
18
|
+
f"PVOs_{fast}_{slow}_{signal}": "signal",
|
|
19
|
+
},
|
|
20
|
+
)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""ta.qqe: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.qqe import qqe as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_frame
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, smooth, factor, mamode, drift, talib):
|
|
9
|
+
result = _calculate(
|
|
10
|
+
close=close,
|
|
11
|
+
length=length,
|
|
12
|
+
smooth=smooth,
|
|
13
|
+
factor=factor,
|
|
14
|
+
mamode=mamode,
|
|
15
|
+
drift=drift,
|
|
16
|
+
talib=talib,
|
|
17
|
+
)
|
|
18
|
+
mode = mamode[0] if mamode != "ema" else ""
|
|
19
|
+
return named_frame(
|
|
20
|
+
result,
|
|
21
|
+
"ta.qqe",
|
|
22
|
+
{
|
|
23
|
+
f"QQE{mode}_{length}_{smooth}_{factor}": "qqe",
|
|
24
|
+
f"QQE{mode}_{length}_{smooth}_{factor}_RSI{mode.upper()}MA": "smoothed_rsi",
|
|
25
|
+
f"QQEl{mode}_{length}_{smooth}_{factor}": "long",
|
|
26
|
+
f"QQEs{mode}_{length}_{smooth}_{factor}": "short",
|
|
27
|
+
f"QQEb_l{mode}_{length}_{smooth}_{factor}": "basis_long",
|
|
28
|
+
f"QQEb_s{mode}_{length}_{smooth}_{factor}": "basis_short",
|
|
29
|
+
f"QQEd{mode}_{length}_{smooth}_{factor}": "direction",
|
|
30
|
+
},
|
|
31
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""ta.rci: Independent formula with a fixed initialization contract."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
from ..calculus import clean
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length):
|
|
9
|
+
time = np.arange(length, dtype=float)
|
|
10
|
+
time -= time.mean()
|
|
11
|
+
time_norm = np.dot(time, time)
|
|
12
|
+
|
|
13
|
+
def correlation(values):
|
|
14
|
+
_, inverse, counts = np.unique(values, return_inverse=True, return_counts=True)
|
|
15
|
+
ranks = (np.cumsum(counts) - (counts - 1) / 2)[inverse]
|
|
16
|
+
ranks -= ranks.mean()
|
|
17
|
+
norm = np.dot(ranks, ranks)
|
|
18
|
+
return 100 * np.dot(time, ranks) / np.sqrt(time_norm * norm) if norm else np.nan
|
|
19
|
+
|
|
20
|
+
return clean(close).rolling(length).apply(correlation, raw=True).rename("rci")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.roc: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.roc import roc as _calculate
|
|
4
|
+
|
|
5
|
+
from ..common import named_series
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def compute(*, close, length, scalar, talib):
|
|
9
|
+
result = _calculate(close=close, length=length, scalar=scalar, talib=talib)
|
|
10
|
+
return named_series(result, "ta.roc", "roc")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.rocp: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.rocp import rocp 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.rocp", "rocp")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""ta.rocr: Computation wrapper for the pinned dependency with canonical outputs."""
|
|
2
|
+
|
|
3
|
+
from pandas_ta_classic.momentum.rocr import rocr 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.rocr", "rocr")
|