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

Uploaded Python 3

File details

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

File metadata

  • Download URL: carpool_fare_engine-0.5.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.5.0.tar.gz
Algorithm Hash digest
SHA256 58ceda39bd10a5cb9e0b8f4f34e9fa73eae4a7535b5c5ac7d2f26e680513c3c0
MD5 9610e4ffb9a3b709203499b076dcc526
BLAKE2b-256 2d2dbe50c468000d9aa33d6c15865a2b68fd879c11058a4e4e4cc40e4efb1cb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for carpool_fare_engine-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 624cd045e7f431b9c2ef01320132f679e47cb24a52eb94de1d123963bc11f589
MD5 14926a1bbd2b2e8faa83dea6cb692142
BLAKE2b-256 7ef10ea07b820306f4476b53a34a4fc525e0735cd934b5bddf0f2fcc90549fe1

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