diff --git a/.ipynb_checkpoints/Fraud_Detection-checkpoint.ipynb b/.ipynb_checkpoints/Fraud_Detection-checkpoint.ipynb index b3c8dba..a0a116c 100644 --- a/.ipynb_checkpoints/Fraud_Detection-checkpoint.ipynb +++ b/.ipynb_checkpoints/Fraud_Detection-checkpoint.ipynb @@ -3,22 +3,64 @@ { "cell_type": "markdown", "id": "6dec910b-0599-45ce-8722-0e85df9fcac6", + "metadata": { + "tags": [] + }, + "source": [ + "

BANKING SYSTEM WITH FRAUD DETECTION ALGORITHM

" + ] + }, + { + "cell_type": "markdown", + "id": "352b99c3-d89c-4f13-9fec-99305b6d78ec", + "metadata": { + "tags": [] + }, + "source": [ + "### Table Of Content\n" + ] + }, + { + "cell_type": "markdown", + "id": "f7abb32e-fef0-40ff-9829-025de01006a0", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, + "source": [ + "* 1. A class that Initializes the personal Information of the Bank Account Owner" + ] + }, + { + "cell_type": "markdown", + "id": "f7460b64-7f41-4f75-9718-802c9bd915d1", "metadata": {}, "source": [ - "# BANKING SYSTEM WITH FRAUD DETECTION ALGORITHM" + "* 2. A class that has method for different Bank Transaction that can be performed on each Bank Account " ] }, { - "cell_type": "code", - "execution_count": null, - "id": "ba77fb99-68ba-40e0-a5bc-eb58a4fb946c", + "cell_type": "markdown", + "id": "5e74d108-8bef-427e-a383-6ef484cf0f90", "metadata": {}, - "outputs": [], - "source": [] + "source": [ + "* 3. A function that read into an already stored Bank Transaction and Check for Suspected Fradulent Activity" + ] + }, + { + "cell_type": "markdown", + "id": "6262698e-3ba6-4890-a791-1a298bbef9e4", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, + "source": [ + "### - BANK ACCOUNT INITIALIZATION CLASS" + ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 1, "id": "7bcb262b-9111-4044-ba9f-463bf55a8137", "metadata": {}, "outputs": [], @@ -58,7 +100,7 @@ " bucket = [0 for i in range(max_element+1)]\n", " \n", " for element in lists:\n", - " bucket[element]+=1\n", + " bucket[int(element)]+=1\n", " sorted_list = []\n", " for idx,count in enumerate(bucket):\n", " sorted_list.extend([idx]*count)\n", @@ -97,9 +139,20 @@ " return (count,transaction)" ] }, + { + "cell_type": "markdown", + "id": "e4b66805-e2f8-46e5-8d35-00206ce9f6ef", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, + "source": [ + "### - BANK OPERATION CLASS" + ] + }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 2, "id": "bed2771e-5f20-4655-bf6c-774bc9e71cb4", "metadata": {}, "outputs": [], @@ -217,9 +270,20 @@ " " ] }, + { + "cell_type": "markdown", + "id": "941e825f-778e-4839-9ad5-f81229d7d595", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, + "source": [ + "### FRADULENT TRANSACTION CHECK FUNCTION" + ] + }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 3, "id": "146480c5-fefa-411c-9ce2-1b4a8233e857", "metadata": {}, "outputs": [], @@ -239,306 +303,64 @@ "\n", "\n", "\n", - " return detail #print(type(items))" + " return detail " ] }, { - "cell_type": "code", - "execution_count": 10, - "id": "fab21de7-45d2-4ad7-91c7-c89bddc7169f", - "metadata": {}, - "outputs": [], + "cell_type": "markdown", + "id": "aaae6dc2-b997-40ce-8824-99e7b86187dd", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, "source": [ - "b = Bank()" + "### CONTRIBUTORS" ] }, { - "cell_type": "code", - "execution_count": 11, - "id": "4987f296-b7ae-4fb0-aee6-b1efff640700", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Create account!!\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter First Name anfd\n", - "Enter Last Name sdjd\n", - "Enter Middle Name asd\n", - "Enter Age 23\n", - "Enter Gender \n", - "(M, F or Other): M\n", - "Create a 4-digit PIN 2001\n", - "Confirm PIN 2001\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Welcome, Anfd. Your account number is 793996264.\n", - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{'793996264': Anfd -Account Balance-- 0, Withdrawals - []}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 2\n", - "Enter your account number: 793996264\n", - "Enter an amount: 23000\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{'793996264': Anfd -Account Balance-- 23000.0, Withdrawals - []}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 3\n", - "Enter your account number: 793996264\n", - "Enter an amount: 2345\n", - "Enter your pin: 2001\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{'793996264': Anfd -Account Balance-- 20655.0, Withdrawals - [2345.0]}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 3\n", - "Enter your account number: 793996264\n", - "Enter an amount: 2356\n", - "Enter your pin: 2001\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{'793996264': Anfd -Account Balance-- 18299.0, Withdrawals - [2345.0, 2356.0]}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 6\n", - "Enter your account number: 793996264\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "\n", - "The Number of Suspected Fradulent Activity on your Account is -(0, [])\n", - "\n", - "\n", - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{'793996264': Anfd -Account Balance-- 18299.0, Withdrawals - [2345.0, 2356.0]}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 3\n", - "Enter your account number: 793996264\n", - "Enter an amount: 2452\n", - "Enter your pin: 2001\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{'793996264': Anfd -Account Balance-- 15847.0, Withdrawals - [2345.0, 2356.0, 2452.0]}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 5000\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{'793996264': Anfd -Account Balance-- 15847.0, Withdrawals - [2345.0, 2356.0, 2452.0]}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 3\n", - "Enter your account number: 793996264\n", - "Enter an amount: 5000\n", - "Enter your pin: 2001\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{'793996264': Anfd -Account Balance-- 10847.0, Withdrawals - [2345.0, 2356.0, 2452.0, 5000.0]}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 6\n", - "Enter your account number: 793996264\n" - ] - }, - { - "ename": "TypeError", - "evalue": "'float' object cannot be interpreted as an integer", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_9776/1959780054.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbank_operations\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/tmp/ipykernel_9776/1916542840.py\u001b[0m in \u001b[0;36mbank_operations\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 21\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwithdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0moption\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"6\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 23\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf'\\n\\nThe Number of Suspected Fradulent Activity on your Account is -{self.check_for_fraud()}\\n\\n'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 24\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/tmp/ipykernel_9776/1916542840.py\u001b[0m in \u001b[0;36mcheck_for_fraud\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 108\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 109\u001b[0m \u001b[0maccount\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maccounts\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0maccount_number\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 110\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0maccount\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfraudulent_alert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0maccount\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtransaction\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 111\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/tmp/ipykernel_9776/2743080599.py\u001b[0m in \u001b[0;36mfraudulent_alert\u001b[0;34m(self, lists)\u001b[0m\n\u001b[1;32m 66\u001b[0m \u001b[0mlow_index\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlength\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0mlength_of_trailing_days\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 67\u001b[0m \u001b[0mnew_list\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcut_list\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mlow_index\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0mlength\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 68\u001b[0;31m \u001b[0mmedian\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msort_median\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnew_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 69\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mmedian\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0mlists\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0midx\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 70\u001b[0m \u001b[0mcount\u001b[0m\u001b[0;34m+=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/tmp/ipykernel_9776/2743080599.py\u001b[0m in \u001b[0;36msort_median\u001b[0;34m(self, lists)\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0msort_median\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mlists\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 32\u001b[0m \u001b[0mmax_element\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlists\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 33\u001b[0;31m \u001b[0mbucket\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmax_element\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 34\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 35\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0melement\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mlists\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mTypeError\u001b[0m: 'float' object cannot be interpreted as an integer" - ] - } - ], + "cell_type": "markdown", + "id": "2b6514b5-b1f7-4713-b8fd-67e72e8c38a3", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, "source": [ - "b.bank_operations()" + "##### DATA STRUCTURE AND ALGORITHM GROUP 4" ] }, { - "cell_type": "code", - "execution_count": 12, - "id": "5eaeb772-b9cd-455f-a7e7-0566e61fcf92", + "cell_type": "markdown", + "id": "d6aaae9a-9eb2-4672-8b79-68da839998b5", "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "'float' object cannot be interpreted as an integer", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_9776/1327007261.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mbucket\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m10.0\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m: 'float' object cannot be interpreted as an integer" - ] - } - ], "source": [ - "bucket = [0 for i in range(10.0+1.0)]" + "
\n", + "
\n", + " 1. Ameen Abdulrasheed

\n", + " 2. Adeola Odusami

\n", + " 3. Ezike Nkemdili Jane

\n", + " 4. Chisom Edoka

\n", + "
" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "bc6d449c-5f16-4a89-b047-f53a50127388", + "cell_type": "markdown", + "id": "98591f17-04ba-4324-af1b-b5ca2d4cc0b6", + "metadata": { + "tags": [] + }, + "source": [ + "##### GITHUB REPO " + ] + }, + { + "cell_type": "markdown", + "id": "a9f8dd8f-3fb3-4743-993b-24a4fa1e3a8a", "metadata": {}, - "outputs": [], - "source": [] + "source": [ + "
\n", + " Link:
https://github.com/rashadmin/Banking-System-and-Fraud-detection-Algorithm.git\n", + "
" + ] } ], "metadata": { diff --git a/Fraud_Detection.ipynb b/Fraud_Detection.ipynb index ea2c06b..a0a116c 100644 --- a/Fraud_Detection.ipynb +++ b/Fraud_Detection.ipynb @@ -3,22 +3,64 @@ { "cell_type": "markdown", "id": "6dec910b-0599-45ce-8722-0e85df9fcac6", + "metadata": { + "tags": [] + }, + "source": [ + "

BANKING SYSTEM WITH FRAUD DETECTION ALGORITHM

" + ] + }, + { + "cell_type": "markdown", + "id": "352b99c3-d89c-4f13-9fec-99305b6d78ec", + "metadata": { + "tags": [] + }, + "source": [ + "### Table Of Content\n" + ] + }, + { + "cell_type": "markdown", + "id": "f7abb32e-fef0-40ff-9829-025de01006a0", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, + "source": [ + "* 1. A class that Initializes the personal Information of the Bank Account Owner" + ] + }, + { + "cell_type": "markdown", + "id": "f7460b64-7f41-4f75-9718-802c9bd915d1", "metadata": {}, "source": [ - "# BANKING SYSTEM WITH FRAUD DETECTION ALGORITHM" + "* 2. A class that has method for different Bank Transaction that can be performed on each Bank Account " ] }, { - "cell_type": "code", - "execution_count": null, - "id": "ba77fb99-68ba-40e0-a5bc-eb58a4fb946c", + "cell_type": "markdown", + "id": "5e74d108-8bef-427e-a383-6ef484cf0f90", "metadata": {}, - "outputs": [], - "source": [] + "source": [ + "* 3. A function that read into an already stored Bank Transaction and Check for Suspected Fradulent Activity" + ] + }, + { + "cell_type": "markdown", + "id": "6262698e-3ba6-4890-a791-1a298bbef9e4", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, + "source": [ + "### - BANK ACCOUNT INITIALIZATION CLASS" + ] }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 1, "id": "7bcb262b-9111-4044-ba9f-463bf55a8137", "metadata": {}, "outputs": [], @@ -97,9 +139,20 @@ " return (count,transaction)" ] }, + { + "cell_type": "markdown", + "id": "e4b66805-e2f8-46e5-8d35-00206ce9f6ef", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, + "source": [ + "### - BANK OPERATION CLASS" + ] + }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 2, "id": "bed2771e-5f20-4655-bf6c-774bc9e71cb4", "metadata": {}, "outputs": [], @@ -217,9 +270,20 @@ " " ] }, + { + "cell_type": "markdown", + "id": "941e825f-778e-4839-9ad5-f81229d7d595", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, + "source": [ + "### FRADULENT TRANSACTION CHECK FUNCTION" + ] + }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 3, "id": "146480c5-fefa-411c-9ce2-1b4a8233e857", "metadata": {}, "outputs": [], @@ -239,147 +303,64 @@ "\n", "\n", "\n", - " return detail #print(type(items))" + " return detail " ] }, { - "cell_type": "code", - "execution_count": 21, - "id": "fab21de7-45d2-4ad7-91c7-c89bddc7169f", - "metadata": {}, - "outputs": [], + "cell_type": "markdown", + "id": "aaae6dc2-b997-40ce-8824-99e7b86187dd", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, "source": [ - "b = Bank()" + "### CONTRIBUTORS" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "4987f296-b7ae-4fb0-aee6-b1efff640700", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Create account!!\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter First Name sedf\n", - "Enter Last Name sdfg\n", - "Enter Middle Name df\n", - "Enter Age 24\n", - "Enter Gender \n", - "(M, F or Other): M\n", - "Create a 4-digit PIN 2001\n", - "Confirm PIN 2001\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Welcome, Sedf. Your account number is 505871805.\n", - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{'505871805': Sedf -Account Balance-- 0, Withdrawals - []}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 2\n", - "Enter your account number: 505871805\n", - "Enter an amount: 20000\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 1. Create an Account \n", - " 2. Deposits \n", - " 3. Withdrawals \n", - " 4. Get balance\n", - " 5. Exit \n", - " 6. Fraud Check \n", - "\n", - "{'505871805': Sedf -Account Balance-- 20000.0, Withdrawals - []}\n" - ] - }, - { - "name": "stdin", - "output_type": "stream", - "text": [ - "Enter option: 3\n", - "Enter your account number: 505871805\n" - ] - } - ], + "cell_type": "markdown", + "id": "2b6514b5-b1f7-4713-b8fd-67e72e8c38a3", + "metadata": { + "jp-MarkdownHeadingCollapsed": true, + "tags": [] + }, "source": [ - "b.bank_operations()" + "##### DATA STRUCTURE AND ALGORITHM GROUP 4" ] }, { - "cell_type": "code", - "execution_count": 12, - "id": "5eaeb772-b9cd-455f-a7e7-0566e61fcf92", + "cell_type": "markdown", + "id": "d6aaae9a-9eb2-4672-8b79-68da839998b5", "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "'float' object cannot be interpreted as an integer", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_9776/1327007261.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mbucket\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m10.0\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m: 'float' object cannot be interpreted as an integer" - ] - } - ], "source": [ - "bucket = [0 for i in range(10.0+1.0)]" + "
\n", + "
\n", + " 1. Ameen Abdulrasheed

\n", + " 2. Adeola Odusami

\n", + " 3. Ezike Nkemdili Jane

\n", + " 4. Chisom Edoka

\n", + "
" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "bc6d449c-5f16-4a89-b047-f53a50127388", + "cell_type": "markdown", + "id": "98591f17-04ba-4324-af1b-b5ca2d4cc0b6", + "metadata": { + "tags": [] + }, + "source": [ + "##### GITHUB REPO " + ] + }, + { + "cell_type": "markdown", + "id": "a9f8dd8f-3fb3-4743-993b-24a4fa1e3a8a", "metadata": {}, - "outputs": [], - "source": [] + "source": [ + "
\n", + " Link:
https://github.com/rashadmin/Banking-System-and-Fraud-detection-Algorithm.git\n", + "
" + ] } ], "metadata": { diff --git a/README.md b/README.md new file mode 100644 index 0000000..62630df --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# Banking-System-and-Fraud-detection-Algorithm + +## Problem +Build a banking system that: +i. Creates user accounts +ii. Receives Deposits +iii. Withdrawals +iv. Fraudulent Detection + +## Project Descripton +This project was part of the CSA Africa bootcamp requirement for the fulfilment of the successful completion of the workshop.. A group of 4 colloborated together to create this. +We used the divide and conquer rule by dividing the problem into two; first part being creating bank classes. These bank classes were used to create bank user objects +where we stored information like personal details then generated 10 digit random account number addded deposits and withdrawals as methods. +The second part was creating a check_for_fraud function which uses the count sorting algorithm (was tweaked to our taste), the function sorts previous transactions in +ascending order, then compare their median with the next transaction. If the next transaction is greater than the median of previous transactions then the bank owner +gets an alert that this could be a possible fraudulent transaction and list out the transactions that were flagged.