← Back to all products
$49
Pricing Engine Toolkit
Dynamic pricing rules, competitor price monitoring, margin calculator, discount scheduling, and A/B price testing framework.
JSONMarkdownYAMLPython
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 23 files
pricing-engine-toolkit/
├── LICENSE
├── README.md
├── configs/
│ └── pricing_config.yaml
├── data/
│ ├── sample_competitor_prices.csv
│ ├── sample_products.csv
│ └── sample_rules.json
├── free-sample.zip
├── guide/
│ ├── 01-pricing-strategy-foundations.md
│ ├── 02-dynamic-pricing-models.md
│ ├── 03-discount-optimization.md
│ ├── 04-margin-analysis.md
│ └── 05-competitor-monitoring.md
├── guides/
│ └── pricing_guide.md
├── index.html
├── scripts/
│ └── run_pricing.py
├── src/
│ ├── __init__.py
│ ├── ab_testing.py
│ ├── competitor.py
│ ├── engine.py
│ ├── margin.py
│ ├── models.py
│ └── scheduler.py
└── tests/
└── test_pricing.py
📖 Documentation Preview README excerpt
Pricing Engine Toolkit
A rules-based pricing engine with competitor monitoring, margin analysis, discount scheduling, and A/B price testing — all in pure Python with zero external dependencies.
What's Inside
| Module | File | Description |
|---|---|---|
| Pricing Engine | src/engine.py | Priority-ordered rule evaluation: fixed price, markup, discount, competitor match, margin floor |
| Data Models | src/models.py | Dataclasses for products, rules, competitor prices, discounts, A/B tests |
| Competitor Monitor | src/competitor.py | Track competitor prices, detect undercuts, identify pricing opportunities |
| Margin Calculator | src/margin.py | Margin/markup analysis, break-even, what-if scenarios, discount impact |
| Discount Scheduler | src/scheduler.py | Time-based discounts, stacking rules, usage tracking, promo calendar |
| A/B Testing | src/ab_testing.py | Statistical price experiments with z-test and t-test analysis |
Features
- Priority-based rule engine — rules evaluated in order, first match wins, with price floor/ceiling enforcement
- 7 rule types — fixed price, percentage markup, percentage discount, competitor match, volume tier, time-based, margin floor
- Competitor intelligence — pluggable feed adapters (CSV, JSON, or your own API), undercut alerts with severity levels, pricing opportunity reports
- Margin analysis — margin vs markup calculations, break-even with target profit, what-if price scenarios, discount impact showing the volume increase needed to compensate
- Discount management — percentage/fixed/fixed-price discounts, category/SKU/tag targeting, stackable vs non-stackable, usage limits, scheduled activation
- Statistical A/B testing — deterministic visitor assignment, two-proportion z-test, Welch's t-test for revenue, sample size calculator, confidence-level-aware recommendations
- Pure Python — zero pip dependencies, Python 3.10+ stdlib only
Quick Start
# Run the complete demo (all 5 modules)
cd pricing-engine-toolkit/
python scripts/run_pricing.py
# Run the test suite
python -m pytest tests/test_pricing.py -v
Project Structure
pricing-engine-toolkit/
├── src/
│ ├── __init__.py # Package exports
│ ├── models.py # PricedProduct, PricingRule, CompetitorPrice, Discount, ABTestConfig
│ ├── engine.py # PricingEngine with rule evaluation and match/case dispatch
│ ├── competitor.py # CompetitorMonitor, CsvCompetitorFeed, undercut detection
│ ├── margin.py # MarginCalculator, break-even, scenarios, discount impact
│ ├── scheduler.py # DiscountScheduler, stacking, calendar view
│ └── ab_testing.py # ABTestRunner, statistical tests, sample size calculator
├── configs/
│ └── pricing_config.yaml # All configuration options with comments
├── data/
│ ├── sample_products.csv # 15 sample products across 3 categories
│ ├── sample_rules.json # 7 sample pricing rules
│ └── sample_competitor_prices.csv # Competitor price observations
├── scripts/
│ └── run_pricing.py # Full demo script showing all modules
├── tests/
│ └── test_pricing.py # 25+ unit tests covering all modules
├── guides/
│ └── pricing_guide.md # Detailed setup and usage guide
*... continues with setup instructions, usage examples, and more.*
📄 Code Sample .py preview
src/ab_testing.py
"""
A/B Price Testing Framework — Pricing Engine Toolkit
======================================================
Statistical framework for running price experiments. Test whether a
different price point generates more revenue, better conversion rates,
or higher units sold — with confidence.
Why A/B test prices?
Gut-feel pricing leaves money on the table. A 5% price increase with
no conversion impact goes straight to profit. But you need data to
know if it impacts conversion. This module gives you the tools to
test price changes rigorously and read the results correctly.
Statistical approach:
Uses a two-proportion z-test for conversion rate comparisons and
a Welch's t-test approximation for revenue comparisons. Both
implemented with stdlib math only (no numpy/scipy needed).
"""
from __future__ import annotations
import hashlib
import logging
import math
import random
from dataclasses import dataclass, field
from datetime import datetime, timezone
from typing import Any, Dict, List, Optional, Tuple
from src.models import ABTestConfig
logger = logging.getLogger(__name__)
# ---------------------------------------------------------------------------
# Result types
# ---------------------------------------------------------------------------
@dataclass
class TestObservation:
"""A single transaction in an A/B test."""
group: str # "control" or "variant"
price_shown: float
purchased: bool
quantity: int = 1
revenue: float = 0.0
visitor_id: str = ""
timestamp: str = field(
default_factory=lambda: datetime.now(timezone.utc).isoformat()
)
# ... 501 more lines ...