From 7d66444de7eeb71ff4cf09cfe67a7cb5a4cba11a Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sun, 23 Jul 2023 02:21:52 +0530 Subject: [PATCH 01/17] Add files via upload --- tasks/break_even_point.py | 14 ++++++++++++++ tasks/cash_ratio.py | 15 +++++++++++++++ tasks/day_sales_in_inventory_ratio.py | 15 +++++++++++++++ tasks/net_income.py | 13 +++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 tasks/break_even_point.py create mode 100644 tasks/cash_ratio.py create mode 100644 tasks/day_sales_in_inventory_ratio.py create mode 100644 tasks/net_income.py diff --git a/tasks/break_even_point.py b/tasks/break_even_point.py new file mode 100644 index 00000000..4752d897 --- /dev/null +++ b/tasks/break_even_point.py @@ -0,0 +1,14 @@ +from helpers import functions +from fastapi import HTTPException, status +def break_even_point(fixed_costs: int, sales_price_per_unit: float, variable_price_per_unit: float): + try: + break_even_point_value = functions.break_even_point(fixed_costs,sales_price_per_unit,variable_price_per_unit) + return { + "Tag": "Break-even Point", + "Fixed Costs": fixed_costs, + "Sales Price Per Unit": sales_price_per_unit, + "Variable Price Per Unit":variable_price_per_unit , + "Break-even Point": break_even_point_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) \ No newline at end of file diff --git a/tasks/cash_ratio.py b/tasks/cash_ratio.py new file mode 100644 index 00000000..0df77de7 --- /dev/null +++ b/tasks/cash_ratio.py @@ -0,0 +1,15 @@ +from helpers import functions +from fastapi import HTTPException, status + +def cash_ratio(cash: float, cash_equivalents: float, current_liabilities: float): + try: + cash_ratio_value = functions.cash_ratio(cash,cash_equivalents,current_liabilities) + return { + "Tag": "Cash Ratio", + "Cash": cash, + "Cash Equivalents": cash_equivalents, + "Current Liabilities":current_liabilities , + "Cash Ratio": cash_ratio_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) diff --git a/tasks/day_sales_in_inventory_ratio.py b/tasks/day_sales_in_inventory_ratio.py new file mode 100644 index 00000000..7a8dcc9f --- /dev/null +++ b/tasks/day_sales_in_inventory_ratio.py @@ -0,0 +1,15 @@ +from helpers import functions +from fastapi import HTTPException, status + +def day_sales_in_inventory_ratio(avg_inventory: int, cost_of_goods_sold: int, no_of_days: int): + try: + day_sales_in_inventory_ratio_value = functions.day_sales_in_inventory_ratio(avg_inventory,cost_of_goods_sold,no_of_days) + return { + "Tag": "Day Sales in Inventory Ratio", + "Average Inventory": avg_inventory, + "Cost Of Goods Sold": cost_of_goods_sold, + "Number Of Days":no_of_days , + "Day Sales in Inventory Ratio": day_sales_in_inventory_ratio_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) diff --git a/tasks/net_income.py b/tasks/net_income.py new file mode 100644 index 00000000..298e8818 --- /dev/null +++ b/tasks/net_income.py @@ -0,0 +1,13 @@ +from helpers import functions +from fastapi import HTTPException, status +def net_income(revenue: float, expenses: int): + try: + net_income_value = functions.net_income(revenue,expenses) + return { + "Tag": "Net Income", + "Revenue": revenue, + "Expenses": expenses, + "Net Income": net_income_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) \ No newline at end of file From 4dbdbb5a26d71a3556447325ae3b4e4921ab2ad2 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sun, 23 Jul 2023 02:23:58 +0530 Subject: [PATCH 02/17] Update main.py --- main.py | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 6b97957f..6d12734e 100644 --- a/main.py +++ b/main.py @@ -1844,4 +1844,82 @@ def capitalization_rate( def accounts_payable_turnover_ratio(total_supply_purchases: float, beginning_accounts_payable: float, ending_accounts_payable: float): - return accounts_payable_turnover_ratio_task(total_supply_purchases, beginning_accounts_payable, ending_accounts_payable) \ No newline at end of file + return accounts_payable_turnover_ratio_task(total_supply_purchases, beginning_accounts_payable, ending_accounts_payable) + + + +# Endpoint to calculate the net income +@app.get( + "/net_income", + tags=["net_income"], + description="Calculating the Net Income", +) +def net_income(revenue: float, expenses: float): + try: + net_income_value = functions.net_income(revenue, expenses) + return { + "Tag": "Net Income", + "Revenue": revenue, + "Expenses": expenses, + "Net Income": net_income_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) + +# Endpoint to calculate the break-even point +@app.get( + "/break_even_point", + tags=["break_even_point"], + description="Calculating the Break-even Point", +) +def break_even_point(fixed_costs: int, sales_price_per_unit: float, variable_price_per_unit: float): + try: + break_even_point_value = functions.break_even_point(fixed_costs,sales_price_per_unit,variable_price_per_unit) + return { + "Tag": "Break-even Point", + "Fixed Costs": fixed_costs, + "Sales Price Per Unit": sales_price_per_unit, + "Variable Price Per Unit":variable_price_per_unit , + "Break-even Point": break_even_point_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) + +# Endpoint to calculate the Day Sales in Inventory Ratio +@app.get( + "/day_sales_in_inventory_ratio", + tags=["day_sales_in_inventory_ratio"], + description="Calculating the Day Sales in Inventory Ratio", +) +def day_sales_in_inventory_ratio(avg_inventory: int, cost_of_goods_sold: int, no_of_days: int): + try: + day_sales_in_inventory_ratio_value = functions.day_sales_in_inventory_ratio(avg_inventory,cost_of_goods_sold,no_of_days) + return { + "Tag": "Day Sales in Inventory Ratio", + "Average Inventory": avg_inventory, + "Cost Of Goods Sold": cost_of_goods_sold, + "Number Of Days":no_of_days , + "Day Sales in Inventory Ratio": day_sales_in_inventory_ratio_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) + +# Endpoint to calculate the Cash Ratio +@app.get( + "/cash_ratio", + tags=["cash_ratio"], + description="Calculating the Cash Ratio", +) +def cash_ratio(cash: float, cash_equivalents:float,current_liabilities:float): + try: + cash_ratio_value = functions.cash_ratio(cash,cash_equivalents,current_liabilities) + return { + "Tag": "Cash Ratio", + "Cash": cash, + "Cash Equivalents": cash_equivalents, + "Current Libilites":current_liabilities , + "Cash Ratio": cash_ratio_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) + From 9d7446c76a4bed4a9ad8e464cdc40dc9c41da9c6 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sun, 23 Jul 2023 02:28:07 +0530 Subject: [PATCH 03/17] Update main.py --- main.py | 74 --------------------------------------------------------- 1 file changed, 74 deletions(-) diff --git a/main.py b/main.py index 6d12734e..c863ed33 100644 --- a/main.py +++ b/main.py @@ -1848,78 +1848,4 @@ def accounts_payable_turnover_ratio(total_supply_purchases: float, -# Endpoint to calculate the net income -@app.get( - "/net_income", - tags=["net_income"], - description="Calculating the Net Income", -) -def net_income(revenue: float, expenses: float): - try: - net_income_value = functions.net_income(revenue, expenses) - return { - "Tag": "Net Income", - "Revenue": revenue, - "Expenses": expenses, - "Net Income": net_income_value, - } - except: - return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) - -# Endpoint to calculate the break-even point -@app.get( - "/break_even_point", - tags=["break_even_point"], - description="Calculating the Break-even Point", -) -def break_even_point(fixed_costs: int, sales_price_per_unit: float, variable_price_per_unit: float): - try: - break_even_point_value = functions.break_even_point(fixed_costs,sales_price_per_unit,variable_price_per_unit) - return { - "Tag": "Break-even Point", - "Fixed Costs": fixed_costs, - "Sales Price Per Unit": sales_price_per_unit, - "Variable Price Per Unit":variable_price_per_unit , - "Break-even Point": break_even_point_value, - } - except: - return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) - -# Endpoint to calculate the Day Sales in Inventory Ratio -@app.get( - "/day_sales_in_inventory_ratio", - tags=["day_sales_in_inventory_ratio"], - description="Calculating the Day Sales in Inventory Ratio", -) -def day_sales_in_inventory_ratio(avg_inventory: int, cost_of_goods_sold: int, no_of_days: int): - try: - day_sales_in_inventory_ratio_value = functions.day_sales_in_inventory_ratio(avg_inventory,cost_of_goods_sold,no_of_days) - return { - "Tag": "Day Sales in Inventory Ratio", - "Average Inventory": avg_inventory, - "Cost Of Goods Sold": cost_of_goods_sold, - "Number Of Days":no_of_days , - "Day Sales in Inventory Ratio": day_sales_in_inventory_ratio_value, - } - except: - return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) - -# Endpoint to calculate the Cash Ratio -@app.get( - "/cash_ratio", - tags=["cash_ratio"], - description="Calculating the Cash Ratio", -) -def cash_ratio(cash: float, cash_equivalents:float,current_liabilities:float): - try: - cash_ratio_value = functions.cash_ratio(cash,cash_equivalents,current_liabilities) - return { - "Tag": "Cash Ratio", - "Cash": cash, - "Cash Equivalents": cash_equivalents, - "Current Libilites":current_liabilities , - "Cash Ratio": cash_ratio_value, - } - except: - return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) From 1dc0a505e5c48ea180820203099e19646cb39322 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Mon, 31 Jul 2023 18:57:06 +0530 Subject: [PATCH 04/17] Update main.py --- main.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/main.py b/main.py index c863ed33..fa9f86f5 100644 --- a/main.py +++ b/main.py @@ -1846,6 +1846,42 @@ def accounts_payable_turnover_ratio(total_supply_purchases: float, ending_accounts_payable: float): return accounts_payable_turnover_ratio_task(total_supply_purchases, beginning_accounts_payable, ending_accounts_payable) +# Endpoint to calculate the Book Value Per Share Ratio +@app.post( + "/book_value_per_share_ratio", + tags=["book_value_per_share_ratio"], + description="Calculating the Book Value Per Share Ratio", +) +def book_value_per_share_ratio(shareholders_equity:int,preferred_equity:int,total_common_share_outstanding:int): + try: + book_value_per_share_ratio_value = functions.book_value_per_share_ratio(shareholders_equity,preferred_equity,total_common_share_outstanding) + return { + "Tag": "Book Value Per Share Ratio", + "Shareholders Equity": shareholders_equity , + "Preferred Equity":preferred_equity, + "Total Common Share Outstanding": total_common_share_outstanding , + "Book Value Per Share Ratio": book_value_per_share_ratio_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) + +# Endpoint to calculate the Operating Margin Ratio +@app.post( + "/operating_margin_ratio", + tags=["operating_margin_ratio"], + description="Calculating the Operating Margin Ratio", +) +def operating_margin_ratio(operating_income:int,net_sales:int): + try: + operating_margin_ratio_value = functions.operating_margin_ratio(operating_income,net_sales) + return { + "Tag": "Operating Margin Ratio", + "Operating Income": operating_income , + "Net Sales": net_sales , + "Operating Margin Ratio": operating_margin_ratio_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) From 75e8c8cfc079d908da082563554240c103046046 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Mon, 31 Jul 2023 18:57:47 +0530 Subject: [PATCH 05/17] Update ENDPOINTS.md --- ENDPOINTS.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ENDPOINTS.md b/ENDPOINTS.md index 0b1bb25f..0152bd23 100644 --- a/ENDPOINTS.md +++ b/ENDPOINTS.md @@ -2048,3 +2048,28 @@ Sample Output "Capitalization Rate": 6.16% } ``` +**POST** `book_value_per_share_ratio` +- Request body : `{ + "Shareholders Equity": 20, + "Preferred Equity": 5, + "Total Common Share Outstanding":5, + }` + - Sample output +```py +{ + "Tag": "Book Value Per Share Ratio", + - Sample Output +} +``` +**POST** `operating_margin_ratio` +- Request body : `{ + "Operating Income": 1000, + "Net Sales": 100, + }` + - Sample output +```py +{ + "Tag": "Operating Margin Ratio", + - Sample Output +} +``` From 788de197fa1f31504b9e49f3cb61dcd3161a0388 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Mon, 31 Jul 2023 18:58:43 +0530 Subject: [PATCH 06/17] Update request_validators.py --- validators/request_validators.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/validators/request_validators.py b/validators/request_validators.py index 8e845f5f..d49a6cce 100644 --- a/validators/request_validators.py +++ b/validators/request_validators.py @@ -855,4 +855,14 @@ class calculateMarketCap(BaseModel): class calculateBvps(BaseModel): total_equity: float - number_of_shares: float \ No newline at end of file + number_of_shares: float + +class book_value_per_share_ratio(BaseModel): + shareholders_equity :int + preferred_equity: int + total_common_share_outstanding:int + +class operating_margin_ratio(BaseModel): + operating_income:int + net_sales:int + From 6856b228d99f4eabe7733c137d9fbb14ded75e2a Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Mon, 31 Jul 2023 18:59:59 +0530 Subject: [PATCH 07/17] Update functions.py --- helpers/functions.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/helpers/functions.py b/helpers/functions.py index 7ba95169..0b97ee95 100644 --- a/helpers/functions.py +++ b/helpers/functions.py @@ -1998,3 +1998,11 @@ def net_worth_calculation(assets: float, liabilities: float, loans: float, mortg "Liabilities": total_liabilities, "Net Worth": net_worth, } + +# Endpoint to calculate the Book Value Per Share Ratio +def book_value_per_share_ratio(shareholders_equity: int,preferred_equity:int,total_common_share_outstanding:int): + return (shareholders_equity-preferred_equity)/total_common_share_outstanding + +# Endpoint to calculate the Operating Margin Ratio +def operating_margin_ratio(operating_income: int,net_sales:int): + return operating_income/net_sales From 7293a0aca7eb9d456c968f0e3341e9724cb32191 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Mon, 31 Jul 2023 19:00:43 +0530 Subject: [PATCH 08/17] Add files via upload --- tasks/book_value_per_share_ratio.py | 15 +++++++++++++++ tasks/operating_margin_ratio.py | 14 ++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tasks/book_value_per_share_ratio.py create mode 100644 tasks/operating_margin_ratio.py diff --git a/tasks/book_value_per_share_ratio.py b/tasks/book_value_per_share_ratio.py new file mode 100644 index 00000000..0fa659dd --- /dev/null +++ b/tasks/book_value_per_share_ratio.py @@ -0,0 +1,15 @@ +from helpers import functions +from fastapi import HTTPException, status + +def book_value_per_share_ratio(shareholders_equity:int,preferred_equity:int,total_common_share_outstanding:int): + try: + book_value_per_share_ratio_value = functions.book_value_per_share_ratio(shareholders_equity,preferred_equity,total_common_share_outstanding) + return { + "Tag": "Book Value Per Share Ratio", + "Shareholders Equity": shareholders_equity , + "Preferred Equity":preferred_equity, + "Total Common Share Outstanding": total_common_share_outstanding , + "Book Value Per Share Ratio": book_value_per_share_ratio_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) \ No newline at end of file diff --git a/tasks/operating_margin_ratio.py b/tasks/operating_margin_ratio.py new file mode 100644 index 00000000..55cb928c --- /dev/null +++ b/tasks/operating_margin_ratio.py @@ -0,0 +1,14 @@ +from helpers import functions +from fastapi import HTTPException, status + +def operating_margin_ratio(operating_income:int,net_sales:int): + try: + operating_margin_ratio_value = functions.operating_margin_ratio(operating_income,net_sales) + return { + "Tag": "Operating Margin Ratio", + "Operating Income": operating_income , + "Net Sales": net_sales , + "Operating Margin Ratio": operating_margin_ratio_value, + } + except: + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) \ No newline at end of file From 6b4d33afcde7323f7ddcd554401f2e36969cfb6f Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Mon, 31 Jul 2023 19:29:46 +0530 Subject: [PATCH 09/17] Update DOCUMENTATION.md --- DOCUMENTATION.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 4ce85ec1..8a686f2a 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -1,8 +1,16 @@ -| Endpoint | Description | Parameters | -|---------------------------|----------------------------------------|---------------------------------------------------------| -| GET /simple_interest_rate | Calculate simple interest rates | - `amount_paid` (float): The amount paid. | -| | | - `principle_amount` (float): The principle amount. | -| | | - `months` (int): The number of months. | -| GET /future_sip | Calculate Future Value of SIP | - `interval_investment` (float): The interval investment| -| | | - `rate_of_return` (float): The rate of return. | -| | | - `number_of_payments` (int): The number of payments. | +| Endpoint | Description | Parameters | +|--------------------------------|------------------------------------------|--------------------------------------------------------- | +| GET /simple_interest_rate | Calculate simple interest rates | - `amount_paid` (float): The amount paid. | +| | | - `principle_amount` (float): The principle amount. | +| | | - `months` (int): The number of months. | +| GET /future_sip | Calculate Future Value of SIP | - `interval_investment` (float): The interval investment | +| | | - `rate_of_return` (float): The rate of return. | +| | | - `number_of_payments` (int): The number of payments. | +|POST/book_value_per_share_ratio |Calculating the Book Value Per Share Ratio| - `shareholders_equity`(int):Shareholders Equity | +| | | - `preferred_equity`(int):Preferred Equity | +| | | -` total_common_share_outstanding`(int):Total Common Share Outstanding | +|POST/operating_margin_ratio |Calculating the Operating Margin Ratio | -` operating_income`(int):Operating Income | +| | | -` net_sales`(int):Net Sales | + + + From 12d42f6f3a052140d7f04fa5f4b1cd24713dcc64 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sat, 5 Aug 2023 21:16:32 +0530 Subject: [PATCH 10/17] Update main.py --- main.py | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/main.py b/main.py index fa9f86f5..0b0c2098 100644 --- a/main.py +++ b/main.py @@ -129,6 +129,8 @@ from tasks.personal_savings import personal_savings_task from tasks.portfolio_return_monte_carlo import portfolio_return_monte_carlo_task from validators.request_validators import SimpleInterestRateRequest, calculatePension, compoundInterest, futureSip, paybackPeriod +from tasks.operating_margin_ratio import operating_margin_ratio +from tasks.book_value_per_share_ratio import book_value_per_share_ratio # Creating the app app = FastAPI( @@ -1852,18 +1854,8 @@ def accounts_payable_turnover_ratio(total_supply_purchases: float, tags=["book_value_per_share_ratio"], description="Calculating the Book Value Per Share Ratio", ) -def book_value_per_share_ratio(shareholders_equity:int,preferred_equity:int,total_common_share_outstanding:int): - try: - book_value_per_share_ratio_value = functions.book_value_per_share_ratio(shareholders_equity,preferred_equity,total_common_share_outstanding) - return { - "Tag": "Book Value Per Share Ratio", - "Shareholders Equity": shareholders_equity , - "Preferred Equity":preferred_equity, - "Total Common Share Outstanding": total_common_share_outstanding , - "Book Value Per Share Ratio": book_value_per_share_ratio_value, - } - except: - return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) +def book_value_per_share_ratio(request: BookValuePerShareRatio): + return book_value_per_share_ratio(request.shareholders_equity, request.preferred_equity,request.total_common_share_outstanding) # Endpoint to calculate the Operating Margin Ratio @app.post( @@ -1871,17 +1863,8 @@ def book_value_per_share_ratio(shareholders_equity:int,preferred_equity:int,tota tags=["operating_margin_ratio"], description="Calculating the Operating Margin Ratio", ) -def operating_margin_ratio(operating_income:int,net_sales:int): - try: - operating_margin_ratio_value = functions.operating_margin_ratio(operating_income,net_sales) - return { - "Tag": "Operating Margin Ratio", - "Operating Income": operating_income , - "Net Sales": net_sales , - "Operating Margin Ratio": operating_margin_ratio_value, - } - except: - return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) +def operating_margin_ratio(request: OperatingMarginRatio): + return operating_margin_ratio(request.operating_income, request.net_sales) From a3f2b32f67ec2bf68e65efcf14a84a6597274df9 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sat, 5 Aug 2023 21:20:00 +0530 Subject: [PATCH 11/17] Update ENDPOINTS.md --- ENDPOINTS.md | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/ENDPOINTS.md b/ENDPOINTS.md index 0152bd23..60722d2d 100644 --- a/ENDPOINTS.md +++ b/ENDPOINTS.md @@ -2048,28 +2048,19 @@ Sample Output "Capitalization Rate": 6.16% } ``` -**POST** `book_value_per_share_ratio` +**POST** `/book_value_per_share_ratio` - Request body : `{ - "Shareholders Equity": 20, - "Preferred Equity": 5, - "Total Common Share Outstanding":5, - }` - - Sample output + "shareholders_equity": 20, + "preferred_equity": 5, + "total_common_share_outstanding":5 +}` +- Sample output ```py { - "Tag": "Book Value Per Share Ratio", - - Sample Output -} -``` -**POST** `operating_margin_ratio` -- Request body : `{ - "Operating Income": 1000, - "Net Sales": 100, - }` - - Sample output -```py -{ - "Tag": "Operating Margin Ratio", - - Sample Output -} -``` + "Tag": "Book Value Per Share Ratio", + "Shareholders Equity": 20, + "Preferred Equity": 5, + "Total Common Share Outstanding": 5, + "Book Value Per Share Ratio": "3" +} ``` + From 6878f5aa5789f6cd1d0da20e191f3fad4bbe2a79 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sat, 5 Aug 2023 21:32:34 +0530 Subject: [PATCH 12/17] Update ENDPOINTS.md --- ENDPOINTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ENDPOINTS.md b/ENDPOINTS.md index 60722d2d..8385e2bb 100644 --- a/ENDPOINTS.md +++ b/ENDPOINTS.md @@ -2064,3 +2064,4 @@ Sample Output "Book Value Per Share Ratio": "3" } ``` + From 3fef9b52ef3da7453ddac6e0b87f17ecba648254 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sat, 5 Aug 2023 21:34:40 +0530 Subject: [PATCH 13/17] Update request_validators.py --- validators/request_validators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validators/request_validators.py b/validators/request_validators.py index d49a6cce..d7411478 100644 --- a/validators/request_validators.py +++ b/validators/request_validators.py @@ -857,12 +857,12 @@ class calculateBvps(BaseModel): total_equity: float number_of_shares: float -class book_value_per_share_ratio(BaseModel): +class BookValuePerShareRatio(BaseModel): shareholders_equity :int preferred_equity: int total_common_share_outstanding:int -class operating_margin_ratio(BaseModel): +class OperatingMarginRatio(BaseModel): operating_income:int net_sales:int From de2c1aa40c9ce9b7007675b4b20b8d2a5cfe335a Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sat, 5 Aug 2023 21:38:06 +0530 Subject: [PATCH 14/17] Update main.py --- main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.py b/main.py index 0b0c2098..32c8a17d 100644 --- a/main.py +++ b/main.py @@ -129,8 +129,7 @@ from tasks.personal_savings import personal_savings_task from tasks.portfolio_return_monte_carlo import portfolio_return_monte_carlo_task from validators.request_validators import SimpleInterestRateRequest, calculatePension, compoundInterest, futureSip, paybackPeriod -from tasks.operating_margin_ratio import operating_margin_ratio -from tasks.book_value_per_share_ratio import book_value_per_share_ratio +from validators.request_validators import BookValuePerShareRatio, OperatingMarginRatio # Creating the app app = FastAPI( From b0bb2517f4b5a6bef9ecb5db2201e852e0666622 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sat, 5 Aug 2023 21:47:27 +0530 Subject: [PATCH 15/17] Update operating_margin_ratio.py --- tasks/operating_margin_ratio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/operating_margin_ratio.py b/tasks/operating_margin_ratio.py index 55cb928c..a96503c7 100644 --- a/tasks/operating_margin_ratio.py +++ b/tasks/operating_margin_ratio.py @@ -3,7 +3,7 @@ def operating_margin_ratio(operating_income:int,net_sales:int): try: - operating_margin_ratio_value = functions.operating_margin_ratio(operating_income,net_sales) + operating_margin_ratio_value = operating_income/net_sales return { "Tag": "Operating Margin Ratio", "Operating Income": operating_income , @@ -11,4 +11,4 @@ def operating_margin_ratio(operating_income:int,net_sales:int): "Operating Margin Ratio": operating_margin_ratio_value, } except: - return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) \ No newline at end of file + return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) From 2f474bd4c0079fc89cfef678a044468a4fb8961a Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sat, 5 Aug 2023 21:53:40 +0530 Subject: [PATCH 16/17] Update ENDPOINTS.md --- ENDPOINTS.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ENDPOINTS.md b/ENDPOINTS.md index 8385e2bb..cbb598d2 100644 --- a/ENDPOINTS.md +++ b/ENDPOINTS.md @@ -2064,4 +2064,21 @@ Sample Output "Book Value Per Share Ratio": "3" } ``` +**POST** `/operating_margin_ratio` +- Request body : `{ + "operating_income": 1000, + "net_sales": 100 +}` +- Sample output + +```py +{ + "Tag": "Operating Margin Ratio", + "Operating Income": 1000, + "Net Sales": 100, + "Operating Margin Ratio" : "10" +} ``` + + + From 41ce07441d1ee1c2a722eafb2d02455a64e823e3 Mon Sep 17 00:00:00 2001 From: Suvamita Sadhukhan <103322378+suvamita@users.noreply.github.com> Date: Sun, 6 Aug 2023 20:07:35 +0530 Subject: [PATCH 17/17] Update ENDPOINTS.md --- ENDPOINTS.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ENDPOINTS.md b/ENDPOINTS.md index cbb598d2..07b9e578 100644 --- a/ENDPOINTS.md +++ b/ENDPOINTS.md @@ -2049,12 +2049,14 @@ Sample Output } ``` **POST** `/book_value_per_share_ratio` + - Request body : `{ "shareholders_equity": 20, "preferred_equity": 5, "total_common_share_outstanding":5 }` -- Sample output +- Sample output + ```py { "Tag": "Book Value Per Share Ratio", @@ -2062,14 +2064,16 @@ Sample Output "Preferred Equity": 5, "Total Common Share Outstanding": 5, "Book Value Per Share Ratio": "3" -} ``` +} +``` **POST** `/operating_margin_ratio` + - Request body : `{ "operating_income": 1000, "net_sales": 100 }` -- Sample output +- Sample output ```py { @@ -2077,7 +2081,8 @@ Sample Output "Operating Income": 1000, "Net Sales": 100, "Operating Margin Ratio" : "10" -} ``` +} +```