Skip to content

Commit

Permalink
Merge pull request #4 from Clueless-Community/main
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
filza2112 authored Jul 20, 2023
2 parents 2c65f57 + d85f49f commit 0f872e8
Show file tree
Hide file tree
Showing 152 changed files with 6,712 additions and 1,957 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
60 changes: 60 additions & 0 deletions .github/workflows/auto-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Auto Comment
on:
issues:
types:
- opened
- closed
- assigned
pull_request:
types:
- opened
- closed

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Auto Comment on Issues Opened
uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
issuesOpened: |
👋 @{{ author }}
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
- name: Auto Comment on Issues Closed
uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
issuesClosed: |
👋 @{{ author }} This issue is closed.
- name: Auto Comment on Pull Request Merged
uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pullRequestMerged: |
👋 @{{ author }} 🎉 Congrats on your merged pull request! Thanks for the valuable contribution! 👏🎉 Congrats on your merged pull request! Thanks for the valuable contribution! 👏
- name: Auto Comment on Pull Request Opened
uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pullRequestOpened: |
Hello👋 @{{ author }}, I hope you are doing well!
<br>
Thank you for raising your pull request and contributing to our Community 🎉
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
- name: Auto Comment on Issues Assigned
uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
issuesAssigned: |
Hello @{{ author }}, thank you for raising an issue. 🙌 I have assigned the issue to you. You can now start working on it. If you encounter any problems, please feel free to connect with us. 👍
77 changes: 77 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '43 3 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Prettier Code Formatting

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
prettier-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Run prettier
run: |
npx prettier --check .
prettier_exit_code=$?
if [ $prettier_exit_code -ne 0 ]; then
echo "Prettier check failed. Please run 'npx prettier --write .' to fix formatting issues."
exit 1
fi
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"python.formatting.provider": "black"
"python.formatting.provider": "black",
"python.analysis.extraPaths": [
"./validators"
]
}
59 changes: 46 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ fintect-api
└───📂helpers
│ │ { Python functions for different calculations }
└───📂tasks
│ │ { Python functions for different tasks }
└───📂validators
│ │ { Pydantic Models for different validations }
📄.gitignore
📄CONTRIBUTING.md
Expand Down Expand Up @@ -112,14 +118,18 @@ def simple_interest_rate(amount_paid:float, principle_amount:float, months:int):
```
+ Cross-validate your endpoint output from some online calculators available or even manually.

+ Once the function is ready, create an endpoint in the `main.py` file following all the good practices of Fast API.
+ After completing with creating the function, create the request validation in `validators/request_validation.py` like this -

```python
class SimpleInterestRateRequest(BaseModel):
amount_paid: float
principle_amount: float
months: int
```

+ Once the validation is done, create a task called `simple_interest.py` in `./tasks` and the task like this -

```python
@app.get(
"/simple_interest_rate",
tags=["simple_interest_rate"],
description="Calculate simple interest rates",
)
def simple_interest_rate(amount_paid: float, principle_amount: float, months: int):
try:
rate = functions.simple_interest_rate(amount_paid, principle_amount, months)
Expand All @@ -134,22 +144,45 @@ def simple_interest_rate(amount_paid: float, principle_amount: float, months: in
return HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
```

+ Once the task is ready, create an endpoint in the `main.py` file following all the good practices of Fast API.

```python
@app.post(
"/simple_interest_rate",
tags=["simple_interest_rate"],
description="Calculate simple interest rates",
)
def simple_interest_rate(request: SimpleInterestRateRequest):
return simple_interest_rate_task(request.amount_paid, request.principle_amount, request.months)
```

+Also add your funtion in `ENDPOINTS.md`.
```
**GET** `/simple_interest_rate`
**POST** `/simple_interest_rate`
- Required parameters : `amount_paid`, `principle_amount` and `months`
- Request body : `{
"amount_paid": 20.23,
"principle_amount": 30.9,
"months": 5
}`
- Sample output
```py
{
"Tag": "Simple Interest Rate",
"Total amount paid": 5000.0,
"Principle amount": 4500.0,
"Interest Paid": 500.0,
"Interest Rate": "11.11111111111111%"
"Tag": "Simple Interest Rate",
"Total amount paid": 20.23,
"Principle amount": 30.9,
"Interest Paid": -10.669999999999998,
"Interest Rate": "-82.87378640776697%"
}
```
+Update the Docs
```
|---------------------------|----------------------------------------|---------------------------------------------------------|
| 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. |
```
```
+ And that's it, you are now ready to make your pull request.
Expand Down
68 changes: 68 additions & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
| 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 /capm | Calculate Capital Asset Pricing Model (CAPM) | - `risk_free_return` (float): Risk-free rate of return. |
| | | - `sensitivity` (float): Asset's sensitivity. |
| | | - `expected_market_return` (float): Expected return of the market. |
| --------------------------- | ---------------------------------------- | --------------------------------------------------------- |
| POST /debt_service_coverage_ratio | Calculate Debt Service Coverage Ratio | - `revenue` (float): Amount of Company Revenue. |
| | | - `operating_expenses` (float): Cost of operating expenses.|
| | | - `interest` (float): Amount of interest to be paid |
| | | - `tax_rate` (float): The tax rate applied. |
| | | - `principal` (float): Amount of principal borrowed. |
| ------------------------------- | ------------------------------------ | --------------------------------------------------------- |
| POST /profit_percent | Calculate profit percentage | - `profit` (float): Total profit earned. |
| | | - `cost_price` (float): The original price of the item |
| POST /loss_percent | Calculate loss percentage | - `loss` (float): Total loss occured. |
| | | - `cost_price` (float): The original price of the item |
| POST /defensive_interval_ratio | Calculate Defensive Interval Ratio | - `cash` (float): The amount of cash on hand. |
| | | - `marketable_securities` (float): The amount of marketable_securities.|
| | | - `net_receivables` (float): The amount of net_receivables.|
| | | - `annual_operating_expenses` (float): The amount of annual_operating_expenses.|
| | | - `non_cash_charges` (float): The amount of non cash charges.|
|-----------------------------|----------------------------------------------|-----------------------------------------------------------|
| post /rate_of_return | Calculate Rate of Return | - `initial_investment` (float): Initial amount invested. |
| | | - `final_value` (float): the value of the investment at the end of the investment. |
| | | - `time_period` (float): The number of months. |
| | | - `cash_flows` (float): A list of cash flows over the investment period. |
| | | - `holding_period` (float): The specific holding period of the investment. |
| --------------------------- | ---------------------------------------- | --------------------------------------------------------- |
| GET /financial_assest_ratio | Calculate financial assest ratio | - `current_assets` (float): used up within a short period. |
| | | - `current_liabilities` (float): debts that are due . |
| | | - `total_debt` (float): aggregate amount of money. |
| | | - `total_equity`(float): residual interest in the assets. |
| | | - `net_income` (float): net earnings. |
| | | - `total_revenue` (float): sum of all sales. |

|----------------------------|----------------------------------------|-------------------------------------------------------------------------------|
| GET /cash_conversion_cycle | Calculate Cash Conversion Cycle | - `beginning_inventory` (float): The amount of inventory beginning the cycle. |
| | | - `ending_inventory` (float): The final amount of inventory ending the cycle. |
| | | - `beginning_receivables` (float): The amount of receivables beginning the cycle. |
| | | - `ending_receivables` (float): The final amount of receivables ending the cycle. |
| | | - `beginning_payable` (float): The amount of payable beginning the cycle. |
| | | - `ending_payable` (float): The final amount of payable ending the cycle. |
| | | - `cost_of_goods_sold` (float): The total cost related to producing goods sold by a business. |
| | | - `net_credit_sales` (float): Sales where the cash is collected at a later date. |
|----------------------------|----------------------------------------|----------------------------------------------------------------------|
| GET /policy_premium | Calculate Policy Premium | - `policy_type` (str): The type of insurance policy. |
| | | - `age` (int): The age of the policyholder. |
| | | - `coverage_amount` (int): The desired coverage amount for the policy. |
| | | - `deductible` (int): The deductible amount for the policy.|
| | | - `num_claims` (int): The number of claims made by the policyholder. |
| | | - `num_accidents` (int): The number of accidents the policyholder has been involved in. |
| GET /price_elasticity | Price Elasticity for Demand Calculator | - `initial_price` (float):
The initial price of the product or service. |
| | | - `final_price` (float): The final price of the product or service. |
| | | - `initial_quantity` (float): The initial quantity demanded of the product or service. |
| | | - `final_quantity` (float): The final quantity demanded of the product or service. |
|----------------------------|----------------------------------------|----------------------------------------------------------------------|
| GET /average_payment_period | Calculate Average Payment Period | - `beginning_accounts_payable` (float): The amount of accounts payable beginning the cycle. |
| | | - `ending_inventory` (float): The final amount of accounts payable ending the cycle. |
| | | - `total_credit_purchases` (float): The amount of purchases on credit during the cycle. |
|-----------------------------|----------------------------------------|---------------------------------------------------------------------|
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM python:3.9


WORKDIR /usr/src/application
WORKDIR ./app

COPY requirements.txt ./

Expand Down
Loading

0 comments on commit 0f872e8

Please sign in to comment.