Skip to main content

High-performance financial and business analytics framework for Python

Project description

Pypulate

Pypulate Logo

PyPI Python License Tests Coverage Documentation Code style: black Downloads

High-performance financial and business analytics framework for Python

Pypulate is a comprehensive Python framework designed for financial analysis, business metrics tracking, portfolio management, and service pricing. It provides powerful tools for quantitative analysts, business analysts, and financial professionals to analyze data, track KPIs, manage portfolios, and implement pricing strategies.

✨ Features

Parray (Pypulate Array)

  • Technical indicators (30+ implementations)
  • Signal detection and pattern recognition
  • Time series transformations
  • Built-in filtering methods
  • Method chaining support

KPI (Key Performance Indicators)

  • Customer metrics (churn, retention, LTV)
  • Financial metrics (ROI, CAC, ARR)
  • Engagement metrics (NPS, CSAT)
  • Health scoring system
  • Metric tracking and history

Portfolio Management

  • Return calculations (simple, log, time-weighted)
  • Risk metrics (Sharpe, VaR, drawdown)
  • Performance attribution
  • Portfolio health assessment
  • Risk management tools

Portfolio Allocation

  • Mean-Variance Optimization
  • Risk Parity Portfolio
  • Kelly Criterion (with half-Kelly option)
  • Black-Litterman model
  • Hierarchical Risk Parity
  • Custom constraints support
  • Multiple optimization methods

Service Pricing

  • Tiered pricing models
  • Subscription pricing with features
  • Usage-based pricing
  • Dynamic pricing adjustments
  • Volume discounts
  • Custom pricing rules
  • Pricing history tracking

🚀 Installation

pip install pypulate

🔧 Quick Start

Technical Analysis

from pypulate import Parray

# Create a price array
prices = Parray([10, 11, 12, 11, 10, 9, 10, 11, 12, 13, 15, 11])

# Technical Analysis with method chaining
result = (prices
    .sma(3)                    # Simple Moving Average
    .ema(3)                    # Exponential Moving Average
    .rsi(7)                    # Relative Strength Index
)

# Signal Detection
golden_cross = prices.sma(5).crossover(prices.sma(10))

Business KPIs

from pypulate import KPI

kpi = KPI()

# Calculate Customer Metrics
churn = kpi.churn_rate(
    customers_start=1000,
    customers_end=950,
    new_customers=50
)

# Get Business Health
health = kpi.health
print(f"Business Health Score: {health['overall_score']}")

Portfolio Analysis

from pypulate import Portfolio

portfolio = Portfolio()

# Calculate Returns and Risk
returns = portfolio.simple_return([100, 102, 105], [102, 105, 108])
sharpe = portfolio.sharpe_ratio(returns, risk_free_rate=0.02)
var = portfolio.value_at_risk(returns, confidence_level=0.95)

# Get Portfolio Health
health = portfolio.health
print(f"Portfolio Health: {health['status']}")

Portfolio Allocation

from pypulate import Allocation
import numpy as np

allocation = Allocation()

# Sample returns data (252 days, 5 assets)
returns = np.random.normal(0.0001, 0.02, (252, 5))
risk_free_rate = 0.04

# Mean-Variance Optimization
weights, ret, risk = allocation.mean_variance(
    returns, 
    risk_free_rate=risk_free_rate
)
print(f"Mean-Variance Portfolio:")
print(f"Expected Return: {ret:.2%}")
print(f"Risk: {risk:.2%}")

# Risk Parity Portfolio
weights, ret, risk = allocation.risk_parity(returns)

# Kelly Criterion (with half-Kelly)
weights, ret, risk = allocation.kelly_criterion(
    returns, 
    kelly_fraction=0.5
)

# Black-Litterman with views
views = {0: 0.15, 1: 0.12}  # Views on first two assets
view_confidences = {0: 0.8, 1: 0.7}
market_caps = np.array([1000, 800, 600, 400, 200])
weights, ret, risk = allocation.black_litterman(
    returns, market_caps, views, view_confidences
)

Service Pricing

from pypulate import ServicePricing

pricing = ServicePricing()

# Calculate Tiered Price
price = pricing.calculate_tiered_price(
    usage_units=1500,
    tiers={
        "0-1000": 0.10,
        "1001-2000": 0.08,
        "2001+": 0.05
    }
)

# Calculate Subscription Price
sub_price = pricing.calculate_subscription_price(
    base_price=99.99,
    features=['premium', 'api_access'],
    feature_prices={'premium': 49.99, 'api_access': 29.99},
    duration_months=12,
    discount_rate=0.10
)

📊 Key Capabilities

Data Analysis

  • Time series analysis and transformations
  • Technical indicators and signal detection
  • Pattern recognition
  • Performance metrics

Business Analytics

  • Customer analytics
  • Financial metrics
  • Health scoring
  • Metric tracking and history

Risk Management

  • Portfolio optimization
  • Risk assessment
  • Performance attribution
  • Health monitoring
  • Asset allocation strategies
  • Multiple optimization methods

Pricing Strategies

  • Multiple pricing models
  • Dynamic adjustments
  • Custom rule creation
  • History tracking

📚 Documentation

Comprehensive documentation is available at https://a111ir.github.io/pypulate or in the docs directory:

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❤️ for financial and business analytics

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

pypulate-0.2.0.tar.gz (322.9 kB view details)

Uploaded Source

Built Distribution

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

pypulate-0.2.0-py3-none-any.whl (77.9 kB view details)

Uploaded Python 3

File details

Details for the file pypulate-0.2.0.tar.gz.

File metadata

  • Download URL: pypulate-0.2.0.tar.gz
  • Upload date:
  • Size: 322.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pypulate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c3fc1308987a1d709ba12d9ca8bccb852ac2c9f23115a5d12d192af983de1f10
MD5 93586c8b3c3abbe40c7a0fe01a52684b
BLAKE2b-256 23a3781b3e9568fc394c95e061951d9bb22863e1c575a7f3278e84ddde50b754

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypulate-0.2.0.tar.gz:

Publisher: publish.yml on A111ir/pypulate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypulate-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pypulate-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 77.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pypulate-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f424e6a674e9a2f49ee921b4213dd447b677f486011b65de0afaba01d2eee68a
MD5 58c48748c1aa9685f5dbb74a93a4fd66
BLAKE2b-256 d29dce80e00272a871e5701fecba0a10bdca15d5ecf953e7e7386ff236953bce

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypulate-0.2.0-py3-none-any.whl:

Publisher: publish.yml on A111ir/pypulate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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