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

Uploaded Python 3

File details

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

File metadata

  • Download URL: carpool_fare_engine-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 db9a0cf35c0ab173224481cceca18259f09a4b4e277bd6f21c15037360133f21
MD5 f240fc2445d666021f495e804b47b305
BLAKE2b-256 746121d60c1ff5357b00d1c2dacffcc36d48bf36fa2b4d69d60316259054963f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for carpool_fare_engine-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e121919c284bd588f7c27ab7e031c1d0e80683f58fe87edbc40d9b6004fbed08
MD5 7f402b545c373754f042f4da36caa152
BLAKE2b-256 a949b75b828b698783673cb01ce1d76cd9bffb913a69deae6142744251600807

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