Skip to main content

Dynamic fare calculation engine for carpool platforms

Project description

carpool-fare-engine

Reusable pricing engine for carpool marketplaces. It computes a transparent fare suggestion with a detailed breakdown so applications can explain each component of the final price.

Features

  • Base fare + per-km + per-minute pricing
  • Demand surge multiplier
  • Time-of-day multiplier
  • Fuel surcharge support
  • Promo, loyalty, eco incentives, and holiday pricing rules
  • Full calculation breakdown

Quick start

from carpool_fare_engine import FareConfig, FareRequest, calculate_fare

config = FareConfig(
    base_fare=40.0,
    per_km_rate=9.5,
    per_min_rate=0.6,
    default_distance_km=12.0,
    default_duration_min=28.0,
)
request = FareRequest(distance_km=14.0, duration_min=25.0, demand_multiplier=1.15)
result = calculate_fare(config, request)
print(result.total)
print(result.as_dict())

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

carpool_fare_engine-0.3.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

carpool_fare_engine-0.3.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: carpool_fare_engine-0.3.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for carpool_fare_engine-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f60c4bbdfc1e02efed1902ad97e8d51344025e144e47664604b92edb90d91940
MD5 4d4c7db580003049609037dc43a63e47
BLAKE2b-256 6b8ce8c078170e716a9fa3b32e9e1b9283b64a9beb05905ca0ffe5deda8a1ae0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for carpool_fare_engine-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d160bf46a7a47198008f9a29bafd303591072e909c90c1e40338ab718b210541
MD5 7cd61fdf0c6a0562ece66329cd680bc9
BLAKE2b-256 0611ec5f2b3ce025e98ecb8f8539b9e2676bd1e963cc65a09b25c3bf7c945858

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