{"id":20663507,"url":"https://github.com/victorcezeh/crypto-analytics-project","last_synced_at":"2025-10-14T14:15:13.888Z","repository":{"id":222415695,"uuid":"744779056","full_name":"victorcezeh/crypto-analytics-project","owner":"victorcezeh","description":"This project involves analyzing cryptocurrency data, including members' activities, historical prices, and transaction details. To start, I set up a database and created a user called cryptoverse_admin with the necessary attributes, including CREATEDB and CREATEROLE.","archived":false,"fork":false,"pushed_at":"2024-05-14T22:43:00.000Z","size":668,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T09:03:02.447Z","etag":null,"topics":["dbeaver","postgresql","psql-database"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/victorcezeh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-18T01:36:52.000Z","updated_at":"2024-05-14T22:43:03.000Z","dependencies_parsed_at":"2024-11-16T21:16:18.249Z","dependency_job_id":null,"html_url":"https://github.com/victorcezeh/crypto-analytics-project","commit_stats":null,"previous_names":["victorcezeh/crypto_analytics_project","victorcezeh/crypto-analytics-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/victorcezeh/crypto-analytics-project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorcezeh%2Fcrypto-analytics-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorcezeh%2Fcrypto-analytics-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorcezeh%2Fcrypto-analytics-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorcezeh%2Fcrypto-analytics-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victorcezeh","download_url":"https://codeload.github.com/victorcezeh/crypto-analytics-project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorcezeh%2Fcrypto-analytics-project/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268338244,"owners_count":24234540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dbeaver","postgresql","psql-database"],"created_at":"2024-11-16T19:18:23.659Z","updated_at":"2025-10-14T14:15:08.837Z","avatar_url":"https://github.com/victorcezeh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crypto Analytics Project\n\n\n\n![Crypto Analytics](https://images.pexels.com/photos/8370752/pexels-photo-8370752.jpeg?auto=compress\u0026cs=tinysrgb\u0026w=1260\u0026h=750\u0026dpr=1)\n\n\n\n## Project Introduction\n\nI've been assigned the task of analyzing cryptocurrency data as a data engineer. My manager has provided CSV files containing crucial information required to address inquiries from company executives. This project will walk you through the process of loading and analyzing the data, step by step, to derive insights and answer pertinent business questions.\n\n\n## Table of Contents\n\n- [Task 1 - Setting up the database.](#task-1---setting-up-the-database)\n- [Task 2 - Answering business questions.](#task-2---answering-business-questions)\n  - [1. How many buy and sell transactions are there for Bitcoin?](#1-how-many-buy-and-sell-transactions-are-there-for-bitcoin)\n  - [2. For each year, calculate the following buy and sell metrics for bitcoin:](#2-for-each-year-calculate-the-following-buy-and-sell-metrics-for-bitcoin)\n  - [3. What was the **monthly** total quantity **purchased and sold** for Ethereum in 2020?](#3-what-was-the-monthly-total-quantity-purchased-and-sold-for-ethereum-in-2020)\n  - [4. Who are the top 3 members with the most bitcoin quantity?](#4-who-are-the-top-3-members-with-the-most-bitcoin-quantity)\n- [Tools Used](#Tools-Used)\n- [Project Structure](#Project-Structure)\n- [Acknowledgement](#Acknowledgement)\n\n\n## Task 1 - Setting up the database.\n\n#### Using psql (an interactive terminal-based front-end to PostgreSQL), I created a user named 'cryptoverse_admin' with the attributes CREATEDB and CREATEROLE.\n\n\nThis command will create a new user with the specified privileges, along with a password.\n\n```sql\n\nCREATE USER cryptoverse_admin WITH CREATEDB CREATEROLE PASSWORD **********;\n\n```\n\n\n#### Using the user from the first step, I created a database called metaverse.\n\n\nThis command creates a new database named **metaverse** with **cryptoverse_admin** as its owner.\n\n```sql\n\nCREATE DATABASE metaverse OWNER cryptoverse_admin;\n\n```\n\nBelow shows the list of databases with their respective owners. In psql, you can get the list of databases using the ` \\l meta-command `. \n\nPeep metaverse and cryptoverse_admin. 😉\n\n![Screenshot (992)](https://github.com/victorcezeh/Crypto_Analytics_Project/assets/129629266/ec2e8645-f4e0-45ad-a265-b0a250076a71)\n\n\n\n#### I proceeded to create a schema in the metaverse database called **raw**.\n\nThis command will create a new schema named raw in the metaverse database.\n\n```sql\nCREATE SCHEMA raw;\n\n```\n\n\nBelow shows the list of all database schemas with their respective owners. In psql, you can get the list of all schemas using the ` \\dn meta-command `. \n\nPeep the raw schema and cryptoverse_admin. 😉\n\n![Schema \u0026 Admin](https://github.com/victorcezeh/Crypto_Analytics_Project/assets/129629266/7fafd5a5-eca4-42f1-a66a-e0a74222b42a)\n\n\n#### Data Importation\n\nI used DBeaver UI, a SQL client software application and a database administration tool, to add the Members, Prices, and Transactions tables.\n\n![DBeaver UI)](https://github.com/victorcezeh/crypto-analytics-project/assets/129629266/f8d51df1-b596-4ea5-9078-0865055c95f2)\n\n#### Sneak peak into the various table imported tables.\n\n## Members table\n\nThe Members table contains information about users registered on the cryptocurrency platform.\n\n![Members](https://github.com/victorcezeh/crypto-analytics-project/assets/129629266/ed406474-1b49-404d-8730-cbbac877851d)\n\n## Prices table\n\nThe Prices table records historical price data for various cryptocurrencies.\n\n![Prices](https://github.com/victorcezeh/crypto-analytics-project/assets/129629266/e33623cc-58ff-4aa3-82e7-6773062fef1c)\n\n## Transactions table\n\nThe Transactions table tracks all transactions executed on the cryptocurrency platform.\n\n![Transactions)](https://github.com/victorcezeh/crypto-analytics-project/assets/129629266/b8360907-25ff-4240-a873-ca11c1201fc9)\n\n\n\n\n\n\n## Task 2 - Answering business questions.\n\n### 1. How many buy and sell transactions are there for Bitcoin?\n\n```sql\n-- Number of buy and sell transactions for Bitcoin\n\nSELECT \n    txn_type, \n    COUNT(txn_type) AS transaction_count\nFROM \n    raw.transactions\nWHERE \n    ticker = 'BTC'\nGROUP BY \n    txn_type;\n\n```\n\n#### Result of SQL Query\n\n| txn_type    | transaction_count |\n|-------------|-------------------|\n| SELL        | 2,044             |\n| BUY         | 10,440            |\n\n![Result of SQL Query](https://github.com/victorcezeh/crypto-analytics-project/assets/129629266/dbf008d1-64b3-4eec-9527-1ce3303d65e6)\n\n\n### 2. For each year, calculate the following buy and sell metrics for bitcoin:\n\n- Total transaction count\n- Total quantity\n- Average quantity\n\n ```sql\n/* For each year, calculate the following buy and sell metrics for Bitcoin:\na. Total transaction count\nb. Total quantity\nc. Average quantity */\n\nSELECT \n    EXTRACT(YEAR FROM txn_date::DATE) AS txn_year,\n    txn_type,\n    COUNT(txn_id) AS txn_count,\n    SUM(quantity) AS total_quantity,\n    AVG(quantity) AS average_quantity\nFROM \n    raw.transactions\nWHERE \n    ticker = 'BTC'\nGROUP BY \n    txn_year, txn_type\nORDER BY \n    txn_year, txn_type;\n```\n\n#### Result of SQL Query\n![Result of SQL Query](https://github.com/victorcezeh/crypto-analytics-project/assets/129629266/25e3a3fa-909f-453e-a112-a120a316c002)\n\n\n\n### 3. What was the **monthly** total quantity **purchased and sold** for Ethereum in 2020?\n\n```sql\n\n-- Monthly total quantity purchased and sold for Ethereum in 2020\n\nSELECT \n    EXTRACT(MONTH FROM txn_date::DATE) AS calendar_month,\n    SUM(quantity) FILTER (WHERE txn_type = 'BUY') AS buy_quantity,\n    SUM(quantity) FILTER (WHERE txn_type = 'SELL') AS sell_quantity\nFROM \n    raw.transactions\nWHERE \n    ticker = 'ETH' \n    AND txn_date BETWEEN '2020-01-01' AND '2020-12-31'\nGROUP BY \n    calendar_month\nORDER BY \n    calendar_month;\n```\n#### Result of SQL Query\n![Result of SQL Query](https://github.com/victorcezeh/crypto-analytics-project/assets/129629266/aef0e3d9-1aa0-42a3-9d34-49ba3e340639)\n\n\n### 4. Who are the top 3 members with the most bitcoin quantity?\n\n```sql\n-- Who are the top 3 members with the most bitcoin quantity?\n\nwith buy as(\nselect\n\tmember_id,\n\tsum(quantity) as bought_btc\nfrom raw.transactions\nwhere txn_type = 'BUY' and ticker = 'BTC'\ngroup by member_id\n)\n\n, sell as (\nselect \n\tmember_id\n\t,sum(quantity) as sold_btc\nfrom raw.transactions\nwhere txn_type = 'SELL' and ticker = 'BTC'\ngroup by member_id\n)\n\nselect \n\tmembers.first_name\n\t,buy.bought_btc - sell.sold_btc as total_quantity\nfrom buy \nfull join sell using (member_id)\njoin raw.members\nusing (member_id)\norder by total_quantity desc\nlimit 3;\n```\n\n#### Result of SQL Query\n#### Top 3 Members with the Most Bitcoin Quantity.\n\n| First Name | Total Quantity |\n|------------|----------------|\n| Nandita    | 3775           |\n| Leah       | 3649           |\n| Ayush      | 3554           |\n\n![Result of SQL Query](https://github.com/victorcezeh/crypto-analytics-project/assets/129629266/7f54772a-04a8-4c4e-ace2-9717190524e6)\n\n\n## Tools Used\n\n- [Dbeaver](https://dbeaver.io/download/) (version 24.0.0)\n- [SQL Shell (psql)](https://www.postgresql.org/download/)\n  \n\n## Project Structure\n\n`README.md`: This file serves as the project documentation, providing an overview of the project, its purpose, and other relevant information.\n\n`crypto-analytics.py`: This file contains a Python script with each SQL statement added to a variable representing the corresponding business question number.\n\n`crypto-analytics.sql`: This file contains all the SQL statements written in the README.md file, with each SQL statement representing the corresponding business question.\n\n`members.csv`: This file contains information about the members or users registered on the cryptocurrency platform.\n\n`prices.csv`: This file contains historical price data for various cryptocurrencies. \n\n`transactions.csv`: This file tracks all transactions executed on the cryptocurrency platform.\n\n\n## Acknowledgement\n\nA heartfelt thank you to [Altschool Africa](https://altschoolafrica.com/) for providing me with the necessary skillset to tackle this project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorcezeh%2Fcrypto-analytics-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorcezeh%2Fcrypto-analytics-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorcezeh%2Fcrypto-analytics-project/lists"}