Git Product home page Git Product logo

car-loan-api's Introduction

🚗 Car Loan Api

Car Loan is a RESTful API written in Python. The main objective is to calculate auto loans in a simple and fast way.

https://carloan.netlify.app/

Installation

To install Car Loan, you need to clone car-loan-api repository and set your workspace.

  1. You can use the command below to clone the car-loan-api repository on your terminal
$ git clone https://github.com/WilliamSilveiraF/car-loan-api.git
  1. Then install all project dependencies
$ pip install -r requirements.txt

Unitary Tests

Run the commands below to execute the tests

$ cd app
$ python3 -m unittest test_app.py

Quick start

# Run the below command in repository root to execute the project on your local machine
$ python3 wsgi.py

The application will be ready on port http://localhost:5000/

Deploy

We have a demo api running on heroku https://car-loan-api.herokuapp.com/, you can use this url to consume the api too

Requests

# Route: POST https://car-loan-api.herokuapp.com/api/calculateloan
payload = {
  "carprice": 50000,  #required
  "downpayment": 0,   #required
  "tradeinvalue": 0,  #required
  "lengthofloan": 18, #required
  "rate": 0.06        #required
}
# Return
{
  "carprice": 50000,
  "downpayment": 0,
  "message": "success",
  "monthlyPayment": 2897.1,
  "status": 200,
  "totalInterestPaid": 2147.8,
  "totalLoan": 50000,
  "totalLoanAndInterestPaid": 52147.8,
  "tradeinvalue": 0
}

Developed by

car-loan-api's People

Contributors

gatitoz-luan avatar williamsilveiraf avatar

Watchers

 avatar

car-loan-api's Issues

API - criar rota /api/calculateloan

1- Set uma rota POST "/api/calculateloan"

2- O body do request é composto por esse json:
{
"carprice": ${preço do carro},
"downpayment": ${valor da entrada do empréstimo},
"tradeinvalue": ${valor de troca (opcional)},
"lengthofloan": ${quantidade de meses do empréstimo},
"rate": ${juros anual}
}

3 - Calcule a parcela mensal usando a formula payment!
OBS: o parâmetro RATE da função da função payment deve ser obtido com a função getRates(FRONTEND_RATE)["monthlyRealNetRate"], onde FRONT_RATE é o valor rate": ${juros anual}" contido no request para pegar o juros após a inflação

2- O body do response é composto por esse json:
{
"carprice",
"downpayment",
"tradeinvalue",
"totalInterestPaid" : ${juros totais pagos},
"totalLoanInterestPaid": ${soma de tradeinvalue e totalInterestPaid},
"monthlyPayment": ${resultado da função payment}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.