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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file carpool_fare_engine-0.4.0.tar.gz.
File metadata
- Download URL: carpool_fare_engine-0.4.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ccf9ac104717d9eac7e30debc53f088283d4754f6698788a9655b4f080bc252
|
|
| MD5 |
1c01c4f8b4afb8062b11064d33e8db88
|
|
| BLAKE2b-256 |
6a883f218b963847916f3980149e2bdc4482fd88cc1ef6b6ec228eda45627da3
|
File details
Details for the file carpool_fare_engine-0.4.0-py3-none-any.whl.
File metadata
- Download URL: carpool_fare_engine-0.4.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae3badeaf9bcaaff2af12913b300258ddcfe50e64a3a7e5b56cfb98ffcda09f2
|
|
| MD5 |
8f765d5d1304e6b01dc885ed2f5da617
|
|
| BLAKE2b-256 |
a2a80bbd112fe4a302a7fdbf53005df7299d8a7a0d6d4f337007970ff6ecb442
|