Skip to main content

Core Python SDK for technical analysis — OHLCV data, indicators, pattern detection, screening, and risk assessment.

Project description

motosan-ta-sdk

Core Python SDK for technical analysis — OHLCV data fetching, indicators, pattern detection, screening, and risk assessment.

Installation

pip install motosan-ta-sdk

# With disk caching support
pip install motosan-ta-sdk[cache]

Or with uv from the monorepo root:

uv sync

Quick Start

from ta_sdk import YFinanceProvider, sma, ema, check_stage2, detect_vcp

provider = YFinanceProvider()

# Fetch OHLCV data
ohlcv = provider.get_ohlcv("AAPL", period="1y", interval="1d")

# Calculate indicators
sma_50 = sma(ohlcv.df["close"], 50)
ema_21 = ema(ohlcv.df["close"], 21)

# Screen for Stage 2 trend
result = check_stage2(ohlcv.df)
print(f"Stage 2: {result['passes']} ({result['score']}/{result['max_score']})")

# Detect VCP pattern
vcp = detect_vcp(ohlcv.df)
print(f"VCP: {vcp.detected} (confidence: {vcp.confidence:.0%})")

Top-Level Exports

All main APIs are available directly from ta_sdk:

from ta_sdk import (
    # Data
    OHLCVData, Quote, PatternResult, AnalysisReport,
    YFinanceProvider, BinanceProvider, MultiProvider,
    # Indicators
    sma, ema, rsi, macd, atr, bollinger_bands, obv,
    # Screeners
    check_stage2, check_entry_signal,
    # Patterns
    detect_vcp, detect_cup_handle, detect_double_bottom,
    # Analysis
    analyze_stock,
)

Module Overview

Module Description Key Exports
data Data providers, models, caching YFinanceProvider, BinanceProvider, MultiProvider, CachedProvider
indicators Technical indicators sma, ema, rsi, macd, atr, bollinger_bands, obv
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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

motosan_ta_sdk-0.3.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

motosan_ta_sdk-0.3.0-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file motosan_ta_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: motosan_ta_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for motosan_ta_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 68701e53080a392a668d4693118c1d7eb348b13312aab65b6fd4e5e7813725ff
MD5 bcdc6817e2d47ffce5aefc414f86ed9e
BLAKE2b-256 9e74cbdddfcbddf58c1ddd15198eef158826b3cb1e4f601294c4a4cf89b683eb

See more details on using hashes here.

File details

Details for the file motosan_ta_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: motosan_ta_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for motosan_ta_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f734ff76a0afd0e0d9f23df347d2f8910c1a5d78329f55cd9c178ad2c6f0f727
MD5 d8855e3d8784b97bee78892196d217be
BLAKE2b-256 0968a6b3b04a8de03f5091ad5ee67b3c16b0832d13f77100ba045c5dbaceef0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page