Services

Backend Engineering, Product

Industry

B2B Marketplace

Year

2023-2024

Every listing. The right price. Right now.

A B2B marketplace needed prices that reacted to market conditions without manual intervention. Static pricing left money on the table during high-demand periods and failed to attract buyers during slow weeks. The platform needed a system where non-technical account managers could define pricing rules, preview their effects, and deploy them instantly - with full auditability and zero deployment cycles.

01.
THE CHALLENGE

The Spreadsheet Problem

Before the pricing engine, account managers maintained pricing adjustments in a shared spreadsheet. Every Monday morning, a developer would copy the new multipliers into a Django management command and run it against the database. The process had three failure modes: typos in the spreadsheet caused incorrect prices visible to buyers, the weekly cadence meant prices were always 3-7 days stale, and there was no way to preview what a rule change would do before it went live. When a seasonal multiplier was accidentally set to 12.5 instead of 1.25, premium listings appeared at ten times their intended price for six hours.

Pricing belongs in the product, not in a spreadsheet that a developer copies into a management command every Monday morning.

02.
THE SOLUTION

Rule-Based Evaluation Pipeline

The engine evaluates pricing rules as an ordered pipeline. Each rule is a Python class with an apply() method that receives the current price and market context, and returns the adjusted price. Rules are stored as database records with a priority field that determines evaluation order. Account managers configure rules through Django admin: set a demand threshold, a supply floor, a seasonal modifier. The pipeline evaluates all active rules in priority order and returns the final price. Every evaluation is logged with the input context, each rule's contribution, and the final output - a complete audit trail for every price change.

The rule evaluation pipeline:

Python
class PricingEngine:
    def evaluate(self, listing, context):
        """Evaluate all active rules in priority order."""
        price = listing.base_price
        log = []

        rules = PricingRule.objects.filter(
            is_active=True,
            category=listing.category,
        ).order_by('priority')

        for rule in rules:
            handler = rule.get_handler()
            old_price = price
            price = handler.apply(price, context)
            log.append({
                'rule': rule.name,
                'input': old_price,
                'output': price,
                'delta': price - old_price,
            })

        # Clamp to category bounds
        price = max(listing.category.price_floor, price)
        price = min(listing.category.price_ceiling, price)

        PriceEvaluation.objects.create(
            listing=listing,
            base_price=listing.base_price,
            final_price=price,
            rules_applied=log,
            context=context,
        )
        return price

Play with the Engine

Adjust demand, supply, and seasonal factors to see how pricing rules compose. The curve shows the price across the demand spectrum. Rule cards light up when their conditions are met.

Demand50%
Supply50%
Season
Base €120 €120
€300€60
Demand Surge
Inactive
Low Inventory
Inactive
Seasonal Modifier
0% standard
€120
Base Price
€120
Dynamic Price
+0%
Adjustment
0
Rules Active

A concrete pricing rule implementation:

Python
class DemandSurgeRule(BasePricingRule):
    """Increase price when demand exceeds threshold."""

    def apply(self, price, context):
        demand = context.get('demand_percentile', 50)
        if demand > self.config['threshold']:
            surplus = demand - self.config['threshold']
            multiplier = 1 + (surplus * self.config['rate'])
            return round(price * multiplier, 2)
        return price

Production Safeguards

Price Floor and Ceiling

Every listing category has a configured minimum and maximum price. No combination of rules can push a price below the floor or above the ceiling. The engine clamps the final output after all rules have evaluated. This prevents runaway adjustments: even if three rules compound to a 200% markup, the ceiling caps the actual price. The floor protects against negative-margin edge cases during off-peak discounting.

Rule Preview Mode

Account managers can toggle any rule into preview mode. Preview rules are evaluated but their adjustments are logged without being applied to live prices. The admin panel shows a side-by-side comparison: current live price vs. projected price with the preview rule active. This eliminated the most common deployment anxiety: 'what will this rule actually do to our prices?' Now they know before publishing.

Full Audit Trail

Every price computation is logged as a PriceEvaluation record: the listing, the base price, each rule that fired, each rule's individual adjustment, and the final computed price. When a buyer questions a price, support pulls the evaluation log and sees exactly which rules contributed, in what order, and by how much. The average dispute resolution time dropped from 45 minutes to 3 minutes.

03.
THE RESULT

Pricing That Runs Itself

Revenue per listing increased 18% in the first quarter after launch. Account managers went from weekly spreadsheet updates to real-time rule management. Zero pricing incidents since launch - down from one per month during the spreadsheet era. The preview mode feature alone prevented 14 misconfigured rules from reaching production in the first six months. The engine now evaluates 50,000+ prices daily across 200 listing categories.

KEY METRICS

+0%Revenue Uplift
0Pricing Incidents
0kDaily Evaluations
WHAT THE CLIENT SAYS

"We used to dread Monday mornings because that was 'pricing day.' Now rules update in real time and we can see exactly what they will do before we publish. The preview mode alone was worth the investment."

Head of Sales

B2B Marketplace · Commercial

FAQ

Why not use a third-party pricing tool?

How do you prevent rule conflicts?

What happens during traffic spikes?

TECHNOLOGY STACK