Skip to content

Time-Based Pricing API Reference

This page documents the API for the time-based pricing module in Pypulate.

calculate_time_based_price(base_price, duration, time_unit='hour', minimum_duration=1.0, rounding_method='up')

Calculate price based on time duration.

Parameters:

Name Type Description Default
base_price float

Base price per time unit

required
duration float

Duration of usage

required
time_unit str

Unit of time ('minute', 'hour', 'day')

'hour'
minimum_duration float

Minimum billable duration

1.0
rounding_method str

How to round partial units ('up', 'down', 'nearest')

'up'

Returns:

Type Description
float

Calculated price

Examples:

>>> calculate_time_based_price(100, 2.5, 'hour')
250.0  # 2.5 hours at $100/hour