A comprehensive banking system package with accounts, loans, rewards, and utilities.
Project description
bank_creator
The bank_creator package provides some basic set of tools for managing various types of bank accounts, including savings, checking, loan, and reward accounts. It also simulates the creation and management of banks and their branches.
Table of Contents
- bank_creator
- Create a bank with an initial investment
- Create branches
- Add branches to the bank
- Create a savings account
- Add the savings account to a branch
- Create a checking account
- Add the checking account to a branch
- Create a loan account
- Add the loan account to a branch
- Create a reward savings account
- Create a reward checking account
- Add the reward accounts to branches
- Deposit into savings account
- Withdraw from checking account
- Repay loan
- Earn rewards on reward account
- Redeem rewards on reward account
- Transfer funds from one account to another
- Perform custom operation
Installation
To install the bank_creator package, use pip:
pip install bank_creator
Creating a Bank and Branches
Creating a Bank
To create a bank, instantiate the Bank class with a name and an initial investment amount:
python
Copy code
from bank import Bank
# Create a bank with an initial investment
my_bank = Bank(name="My Bank", initial_investment=100000)
Creating Branches
You can create branches for the bank using the BankBranch class and add them to the bank:
python
Copy code
from bank import BankBranch
# Create branches
branch1 = BankBranch(name="Branch 1")
branch2 = BankBranch(name="Branch 2")
# Add branches to the bank
my_bank.add_branch(branch1)
my_bank.add_branch(branch2)
Creating Accounts
Savings Account
A savings account can be created using the SavingsAccount class. It requires an account number, account holder's name, initial balance, and interest rate:
python
Copy code
from account import SavingsAccount
# Create a savings account
savings_account = SavingsAccount(account_number="123456789", account_holder="John Doe", balance=1000, interest_rate=0.03)
# Add the savings account to a branch
branch1.add_account(savings_account)
Checking Account
A checking account can be created using the CheckingAccount class. It requires an account number, account holder's name, and initial balance:
python
Copy code
from account import CheckingAccount
# Create a checking account
checking_account = CheckingAccount(account_number="987654321", account_holder="Jane Doe", balance=500)
# Add the checking account to a branch
branch2.add_account(checking_account)
Loan Account
A loan account can be created using the LoanAccount class. It requires an account number, account holder's name, initial balance, and loan amount:
python
Copy code
from loan import LoanAccount
# Create a loan account
loan_account = LoanAccount(account_number="1122334455", account_holder="Alice", balance=0, loan_amount=10000)
# Add the loan account to a branch
branch1.add_account(loan_account)
Reward Accounts
Reward accounts combine the features of savings or checking accounts with a reward points system. They can be created using the RewardSavingsAccount and RewardCheckingAccount classes:
python
Copy code
from enhanced_bank import RewardSavingsAccount, RewardCheckingAccount
# Create a reward savings account
reward_savings_account = RewardSavingsAccount(account_number="123123123", account_holder="Bob", balance=2000, interest_rate=0.03, reward_points=100)
# Create a reward checking account
reward_checking_account = RewardCheckingAccount(account_number="321321321", account_holder="Charlie", balance=1000, reward_points=50)
# Add the reward accounts to branches
branch2.add_account(reward_savings_account)
branch1.add_account(reward_checking_account)
Performing Operations on Accounts
Deposit
To deposit an amount into an account, use the deposit method:
python
Copy code
# Deposit into savings account
savings_account.deposit(500)
Withdraw
To withdraw an amount from an account, use the withdraw method:
python
Copy code
# Withdraw from checking account
checking_account.withdraw(200)
Repay Loan
To repay a loan, use the repay_loan method on a loan account:
python
Copy code
# Repay loan
loan_account.repay_loan(1000)
Earn Rewards
To earn reward points on a reward account, use the earn_rewards method:
python
Copy code
# Earn rewards on reward account
reward_savings_account.earn_rewards(500)
Redeem Rewards
To redeem reward points, use the redeem_rewards method:
python
Copy code
# Redeem rewards on reward account
reward_checking_account.redeem_rewards(20)
Utility Functions
Transfer Funds
To transfer funds from one account to another, use the transfer function:
python
Copy code
from utilities import transfer
# Transfer funds from one account to another
transfer(from_account=savings_account, to_account=checking_account, amount=300)
Logging Operations
The package includes a decorator to log operations performed on accounts. This can be useful for tracking account activity:
python
Copy code
from decorators import log_operation
@log_operation
def custom_operation(account, amount):
account.deposit(amount)
# Perform custom operation
custom_operation(savings_account, 150)
Database Management
The package uses SQLite to manage account and bank details. All account and bank operations are automatically saved to the database. This ensures that all changes are persistent and can be retrieved later.
Contributing
Contributions are welcome! If you have suggestions for improvements or new features, feel free to submit a Pull Request on GitHub.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bank_creator-0.1.0.tar.gz
(3.5 kB
view details)
Built Distribution
File details
Details for the file bank_creator-0.1.0.tar.gz
.
File metadata
- Download URL: bank_creator-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5b27f829f09b35d2222105b54d2b2c26e8b5330b9b90bca59b4a3b9b1ee1269 |
|
MD5 | 5eebdd206eed9730423ad322b68ee20d |
|
BLAKE2b-256 | 3c3afb1b5f802ed95a2dda3efff282914e5979762cb5f560a0ecadd60a9a11a3 |
File details
Details for the file bank_creator-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: bank_creator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82fbed7862a275b12f3361fc625a5715bc14c2b09576ca1644325e4cdf8b51e5 |
|
MD5 | df7b81e54e3ac6ce65f6cc4ac54f3e68 |
|
BLAKE2b-256 | 235350ef459f219a5401f7357087bb17e18756cb703e7dad9025cd4a4b3f02a9 |