motosan-ta-sdk
Core Python SDK for technical analysis — 20 indicators, pattern detection, screening, and risk assessment. Strict parity with pandas-ta reference vectors.
- GitHub: daiwanwei/motosan-ta
- Changelog: CHANGELOG.md
- Rust crates: motosan-ta-math, motosan-ta-stream
Installation
pip install motosan-ta-sdk
# With disk caching support
pip install motosan-ta-sdk[cache]
Quick Start
from ta_sdk import YFinanceProvider, sma, ema, rsi, macd, atr, check_stage2, detect_vcp
provider = YFinanceProvider()
ohlcv = provider.get_ohlcv("AAPL", period="1y", interval="1d")
df = ohlcv.df
# Indicators
sma_50 = sma(df["close"], 50)
ema_21 = ema(df["close"], 21)
rsi_14 = rsi(df["close"], 14)
macd_line, signal, hist = macd(df["close"])
atr_14 = atr(df["high"], df["low"], df["close"], 14)
# Screen for Stage 2 trend
result = check_stage2(df)
print(f"Stage 2: {result['passes']} ({result['score']}/{result['max_score']})")
# Detect VCP pattern
vcp = detect_vcp(df)
print(f"VCP: {vcp.detected} (confidence: {vcp.confidence:.0%})")
Indicators (20 total)
Moving Averages (7): SMA, EMA, KAMA, DEMA, TEMA, HMA, SMMA Momentum (10): RSI, MACD, Stochastic, CCI, Williams %R, MFI, ROC, Aroon, TSI, Fisher Transform, TRIX Volatility (6): ATR, Bollinger Bands, ADX, Keltner Channels, Donchian Channels, Supertrend Volume (2): OBV, CMF
All indicators use SMA-seeded EMA / Wilder's RMA to match pandas-ta output.
Top-Level Exports
from ta_sdk import (
# Data
OHLCVData, Quote, PatternResult, AnalysisReport,
YFinanceProvider, BinanceProvider, MultiProvider,
# Indicators — Moving Averages
sma, ema, kama, dema, tema, hma, smma,
# Indicators — Momentum
rsi, macd, aroon, tsi, fisher_transform, trix,
# Indicators — Volatility
atr, bollinger_bands,
# Indicators — Volume
obv, cmf,
# Screeners
check_stage2, check_entry_signal,
# Patterns
detect_vcp, detect_cup_handle, detect_double_bottom,
# Analysis
analyze_stock,
)
Additional indicators available via direct module import:
from ta_sdk.indicators.momentum import stochastic, cci, roc, williams_r, mfi
from ta_sdk.indicators.volatility import adx, keltner, donchian, supertrend
Module Overview
| Module | Description | Key Exports |
|---|---|---|
data |
Data providers, models, caching | YFinanceProvider, BinanceProvider, MultiProvider, CachedProvider |
indicators.moving_averages |
Moving averages | sma, ema, kama, dema, tema, hma, smma |
indicators.momentum |
Momentum oscillators | rsi, macd, stochastic, cci, roc, williams_r, mfi, aroon, tsi, fisher_transform, trix |
indicators.volatility |
Volatility & trend | atr, bollinger_bands, adx, keltner, donchian, supertrend |
indicators.volume |
Volume indicators | obv, cmf |
screeners |
Stock screening criteria | check_stage2, check_entry_signal |
patterns |
Chart pattern detection | detect_vcp, detect_cup_handle, detect_double_bottom |
analysis |
Full analysis & reports | analyze_stock |
risk |
Risk management | calc_position_size, calc_rr_ratio |
Data Providers
| Provider | Class | Markets | API Key |
|---|---|---|---|
| Yahoo Finance | YFinanceProvider |
US, TW | Not required |
| Binance | BinanceProvider |
Crypto | Not required |
| FMP | FMPProvider |
US (fundamentals) | Required |
| Multi | MultiProvider |
Auto-routed | -- |
| Cached | CachedProvider |
Wraps any provider | -- |
MultiProvider
Routes symbols to the correct provider automatically based on symbol format:
from ta_sdk import YFinanceProvider, BinanceProvider, MultiProvider
from ta_sdk.data.models import Market
multi = MultiProvider()
multi.register(Market.US, YFinanceProvider())
multi.register(Market.TW, YFinanceProvider())
multi.register(Market.CRYPTO, BinanceProvider())
multi.get_ohlcv("AAPL") # Auto-detected as US
multi.get_ohlcv("2330.TW") # Auto-detected as TW
multi.get_ohlcv("BTCUSDT") # Auto-detected as Crypto
CachedProvider
Wraps any DataProvider with disk-based caching. Requires the [cache] extra.
from ta_sdk.data.cached_provider import CachedProvider
cached = CachedProvider(
provider=YFinanceProvider(),
cache_dir=".ta_cache",
ohlcv_ttl=3600, # 1 hour
quote_ttl=60, # 1 minute
)
ohlcv = cached.get_ohlcv("AAPL")
Supported Markets
| Market | Example Symbol | Provider | Currency | Timezone |
|---|---|---|---|---|
| US Stocks | AAPL |
YFinance | USD | America/New_York |
| TW Stocks | 2330.TW |
YFinance | TWD | Asia/Taipei |
| Crypto | BTCUSDT |
Binance | USDT | UTC |
Requirements
- Python >= 3.12
- pandas >= 2.2
- numpy >= 1.26
- yfinance >= 0.2.36
- python-binance >= 1.0.19
- requests >= 2.31
- diskcache >= 5.6 (optional, for
[cache]extra)
License
Metadata
Release files for motosan-ta-sdk 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| motosan_ta_sdk-0.6.0.tar.gz | 61.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| motosan_ta_sdk-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 111.5 kB
Release files / motosan_ta_sdk-0.6.0.tar.gz
| Download URL | motosan_ta_sdk-0.6.0.tar.gz |
|---|---|
| Size | 61.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a8ce602938c0ab384075966b535f17a04057c5933d40be8cf211d39e2cfa336
|
|
BLAKE2b-256 checksum How to use checksums |
2850af1b0b4fe1e42d93647805a4a9b2167e7795695ac59ac3139ebdbf99031f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Release files / motosan_ta_sdk-0.6.0-py3-none-any.whl
| Download URL | motosan_ta_sdk-0.6.0-py3-none-any.whl |
|---|---|
| Size | 50.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50a6916a2de846cca2459e6ac6a29a7318550054edf4839def90ec04427e39d0
|
|
BLAKE2b-256 checksum How to use checksums |
5fed39db35fb7d3f7760ecbb9cf16f15781407c644c8ebd1b521d4d62472769a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Security for motosan-ta-sdk 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.