← 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
scripts/run_pricing.py#!/usr/bin/env python3
"""
Pricing Engine Toolkit — Demo Runner
======================================
Demonstrates every module in the pricing toolkit:
1. Load products and pricing rules from sample data
2. Run the pricing engine with rule evaluation
3. Feed in competitor prices and detect undercuts
4. Analyze margins and run break-even analysis
5. Schedule discounts and show the calendar
6. Set up and simulate an A/B price test
Run from the product root directory:
python scripts/run_pricing.py
"""
from __future__ import annotations
import csv
import json
import logging
import os
import sys
# Add project root to path so "from src.X import Y" works
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from src.models import (
ABTestConfig, CompetitorPrice, Discount, PricedProduct, PricingRule, RuleType,
)
from src.engine import PricingEngine
from src.competitor import CompetitorMonitor, CsvCompetitorFeed
from src.margin import MarginCalculator
from src.scheduler import DiscountScheduler
from src.ab_testing import ABTestRunner, TestObservation, required_sample_size
# Configure logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",