Skip to content

Commit

Permalink
Merge pull request #374 from vaibhav-sangwan/payables-turnover-ratio
Browse files Browse the repository at this point in the history
Add endpoint: Accounts Payable Turnover Ratio
  • Loading branch information
ighoshsubho authored Jun 26, 2023
2 parents 378d02a + 9131f23 commit 7cbd9ad
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
15 changes: 15 additions & 0 deletions ENDPOINTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1984,6 +1984,21 @@ Sample Output

```

**GET** `/accounts_payable_turnover_ratio`

- Required parameters : `total_supply_purchases`, `beginning_accounts_payable` and `ending_accounts_payable`
- Sample output

```py
{
"Tag": "Accounts Payable Turnover Ratio",
"Total Supply Purchases": 1000,
"Beginning Accounts Payable": 200,
"Ending Accounts Payable": 300,
"Accounts Payable Turnover Ratio": 4
}
```

**GET** `/capitalization_rate`

-Required parameters: `rental_income`, `amenities`, `propertyManagement`, `propertyTaxes`, `insurance`, `current_market_value`
Expand Down
12 changes: 11 additions & 1 deletion helpers/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1936,6 +1936,17 @@ def calculate_financial_leverage(total_assets : float,
return financial_leverage


# Function to calculate Accounts Payable Turnover Ratio
def accounts_payable_turnover_ratio(total_supply_purchases: float,
beginning_accounts_payable: float,
ending_accounts_payable: float):

average_accounts_payable = (beginning_accounts_payable + ending_accounts_payable)/2
ap_turnover_ratio = total_supply_purchases/average_accounts_payable

return ap_turnover_ratio


# Function to Calculate Capitalization Rate

def capitalization_rate(
Expand All @@ -1962,4 +1973,3 @@ def net_worth_calculation(assets: float, liabilities: float, loans: float, mortg
"Liabilities": total_liabilities,
"Net Worth": net_worth,
}

22 changes: 22 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3237,3 +3237,25 @@ def capitalization_rate(
}
except:
return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)

@app.get(
"/accounts_payable_turnover_ratio",
tags=["accounts_payable_turnover_ratio"],
description="Calculates the Accounts Payable Turnover Ratio",
)
def accounts_payable_turnover_ratio(total_supply_purchases: float,
beginning_accounts_payable: float,
ending_accounts_payable: float):
try:
ap_turnover_ratio = functions.accounts_payable_turnover_ratio(total_supply_purchases,
beginning_accounts_payable,
ending_accounts_payable)
return {
"Tag": "Accounts Payable Turnover Ratio",
"Total Supply Purchases": total_supply_purchases,
"Beginning Accounts Payable": beginning_accounts_payable,
"Ending Accounts Payable": ending_accounts_payable,
"Accounts Payable Turnover Ratio": ap_turnover_ratio
}
except:
return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)

0 comments on commit 7cbd9ad

Please sign in to comment.