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.6.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.6.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: carpool_fare_engine-0.6.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.6.0.tar.gz
Algorithm Hash digest
SHA256 576a277045ad9b46f13627adf595f548cb171774d1936af5ca23273f7653b9d6
MD5 73e75f441ceaf1a1a0d250fcd6b25980
BLAKE2b-256 75c2fc62c17ab887b80e39f831b523fb3eaad1c9fe07b32fbede75e67b239540

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for carpool_fare_engine-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9155d3392eb8e7dd2cbf44d1d0aa553acddb9906e69847c6b198908d2b35da7c
MD5 41a7753637eac8eab4f0f8e1b9c84ea3
BLAKE2b-256 425ddbcf9f6a78b91b3c525137358713c783cc9bb3ec9fe15f687e0971aae4d1

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