Giter Club home page Giter Club logo

deposit_plan's Introduction

Deposit Plan

Build Status Run on Repl.it

Table of Contents

Approach

I have followed TDD approach to get to a solution.

in order to make customers reference code unique i have used md5(email, name).

There are 2 types of Deposit plans in this application:

OneTime Plan:

will only execute once and in order to be successfull the customer must deposit the exact amount of money to the portfolio.

Monthly Plan:

This will be a recurring plan so the customer can deposit the amount monthly.

Once customer reaches target amount portfolio will be credited with the amount. a flag will be set to true to indicate that the plan has reached the target.

Directory Structure

|-- deposit_plan
|   |-- config
|   |   |-- exception.py
|-- |-- customer
|   |   |-- customer.py
|   |   |-- portfolio.py
|   |   |-- __init__.py
|-- |-- deposit
|   |   |-- deposit_plan.py
|   |   |-- __init__.py

Running Test case

$ python3 test_sample.py

Scope

Below is my findings and assumptions about the problem.

User Story

  • As a Customer i will have a unique Reference code to do all operations
  • As a Customer i can create max of 2 unique Deposit Plan with portfolio
  • As a Customer i can deposit fund via bank transfer to my portfolio

Actions:

  • Create Customer
  • Create Deposit Plan with respective portfolio plan types either one time or reccuring/monthly can specify the percentage or ratio of amount to be deposited per portfolio
  • Start depositing update portfolio with deposit amount

Ratio calculation:

Once we created a deposit plan we will have to calculate the ratio of the amount to be credited to each portfolio.

for finding ratio

x_ratio = x / x + y
y_ratio = y / x + y

when the customer deposit an amount we will use this ratio to allocate the amount to each portfolio.

allocation of amount based on ratio

portfolio_1 = (x_ratio / x_ratio + y_ratio) * deposited_amount
portfolio_2 = (y_ratio / x_ratio + y_ratio) * deposited_amount

Schema

Customer:
    - name: string
    - email: string
    - age: int
    - reference_code: md5(email, name)
    - deposit_plans: [DepositPlan]
Portfolio:
    - reference_code: customer_reference_code
    - name: string
    - balance: float
    - target_amount: float
    - target_achieved: boolean
DepositPlan:
    - reference_code: customer_reference_code
    - portfolios: [{portfolio: Portfolio, amount: float}]
    - recurring: boolean, default: false

deposit_plan's People

Watchers

James Cloos avatar Vishal Taj PM avatar

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.