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

Uploaded Python 3

File details

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

File metadata

  • Download URL: carpool_fare_engine-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 dae1813f4cb793f90708efb0c6fca1e2bc13413a8f08e3d60a592cef882d2800
MD5 130f8b9a1be9b02928fab792f86a8022
BLAKE2b-256 3856aa6cf6c2710728d04b669ad5af120e36ce58a6f24e595f34c7684ad0614e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for carpool_fare_engine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44e354bc8601be7d2ce0243afd81b1b15a6cff29e3c355c307a3c92b33c8d3a1
MD5 1974d32272afe4b06f19a6cb03e2ef40
BLAKE2b-256 7475a1b154dbf9531ac225e11e9da39ab6bec2dd801b67719ee7d2409e3bf133

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