File size: 2,177 Bytes
ffcf62f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def calculate_monthly_charge(
    development_time_hours: float,
    hourly_rate: float,
    amortization_months: int,
    api_calls_per_month: int,
    cost_per_api_call: float,
    monthly_maintenance: float,
    additional_monthly_costs: float,
    profit_margin_percentage: float,
) -> float:
    """
    Calculate the monthly charge for a service based on various cost factors.

    Parameters:
    - development_time_hours (float): The total number of hours spent on development and setup.
    - hourly_rate (float): The rate per hour for development and setup.
    - amortization_months (int): The number of months over which to amortize the development and setup costs.
    - api_calls_per_month (int): The number of API calls made per month.
    - cost_per_api_call (float): The cost per API call.
    - monthly_maintenance (float): The monthly maintenance cost.
    - additional_monthly_costs (float): Any additional monthly costs.
    - profit_margin_percentage (float): The desired profit margin as a percentage.

    Returns:
    - monthly_charge (float): The calculated monthly charge for the service.
    """

    # Calculate Development and Setup Costs (amortized monthly)
    development_and_setup_costs_monthly = (
        development_time_hours * hourly_rate
    ) / amortization_months

    # Calculate Operational Costs per Month
    operational_costs_monthly = (
        (api_calls_per_month * cost_per_api_call)
        + monthly_maintenance
        + additional_monthly_costs
    )

    # Calculate Total Monthly Costs
    total_monthly_costs = (
        development_and_setup_costs_monthly
        + operational_costs_monthly
    )

    # Calculate Pricing with Profit Margin
    monthly_charge = total_monthly_costs * (
        1 + profit_margin_percentage / 100
    )

    return monthly_charge


# Example usage:
monthly_charge = calculate_monthly_charge(
    development_time_hours=100,
    hourly_rate=500,
    amortization_months=12,
    api_calls_per_month=500000,
    cost_per_api_call=0.002,
    monthly_maintenance=1000,
    additional_monthly_costs=300,
    profit_margin_percentage=10000,
)

print(f"Monthly Charge: ${monthly_charge:.2f}")