Peak Pricing API Reference
This page documents the API for the peak pricing module in Pypulate.
calculate_peak_pricing(base_price, usage_time, peak_hours, peak_multiplier=1.5, off_peak_multiplier=0.8)
Calculate price based on peak/off-peak hours.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_price
|
float
|
Base price per unit |
required |
usage_time
|
str
|
Time of usage (format: "HH:MM") |
required |
peak_hours
|
dict
|
Dictionary of weekdays and their peak hours Format: {"monday": ("09:00", "17:00")} |
required |
peak_multiplier
|
float
|
Price multiplier during peak hours |
1.5
|
off_peak_multiplier
|
float
|
Price multiplier during off-peak hours |
0.8
|
Returns:
Type | Description |
---|---|
float
|
Calculated price |
Examples: