Skip to content

Commit 38831bb

Browse files
Merge branch 'king04aman:main' into feature/add-text-summarizer
2 parents f0bcfd9 + 93ae641 commit 38831bb

File tree

15 files changed

+573
-8
lines changed

15 files changed

+573
-8
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Project Suggestion
3+
about: Propose an idea for a new project
4+
title: ""
5+
labels: "Project Suggestion"
6+
assignees: ""
7+
---
8+
9+
### Project Suggestion Title
10+
_A concise title for your project suggestion._
11+
12+
### Description
13+
_Provide a detailed description of the project idea or feature you would like to propose._
14+
15+
### Benefits
16+
_Explain how this project or feature would benefit the community or improve the existing repository._
17+
18+
### Implementation Ideas
19+
_Offer any initial thoughts on how the project could be implemented, including potential technologies or approaches._
20+
21+
### Additional Context
22+
_Include any other relevant information, links, or references that might help._
23+
24+
### Suggested Contributors
25+
_If you have specific contributors in mind who might be interested in this project, please list them here._
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: "Bug Report"
3+
about: "Report a bug or issue."
4+
title: "Bug Report Title"
5+
labels: ["bug", "help wanted"]
6+
---
7+
8+
## Description
9+
Please describe the bug you encountered, including steps to reproduce it.
10+
11+
## Steps to Reproduce
12+
1. Step 1
13+
2. Step 2
14+
3. Step 3 ...
15+
16+
## Expected Behavior
17+
What did you expect to happen?
18+
19+
## Actual Behavior
20+
What actually happened?
21+
22+
## Additional Context
23+
Add any other context about the problem, screenshots, or logs that might be helpful.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
blank_issues_enabled: false
2+
contact: false
3+
4+
templates:
5+
- name: "Project Suggestion"
6+
description: "Propose an idea for a new project."
7+
title: "Project Suggestion Title"
8+
labels: ["Project Suggestion"]
9+
10+
- name: "Bug Report"
11+
description: "Report a bug or issue."
12+
title: "Bug Report Title"
13+
labels: ["bug", "help wanted"]
14+
15+
- name: "Feature Request"
16+
description: "Request a new feature or enhancement."
17+
title: "Feature Request Title"
18+
labels: ["feature", "enhancement"]
19+
20+
- name: "Other"
21+
description: "Use this template for any other issues or inquiries."
22+
title: "Other Issue Title"
23+
labels: ["question", "others"]
24+
25+
choose_template:
26+
title: "Choose an Issue Template"
27+
description: "Please select one of the templates below to create your issue."
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: "Feature Request"
3+
about: "Request a new feature or enhancement."
4+
title: "Feature Request Title"
5+
labels: ["feature", "enhancement"]
6+
---
7+
8+
## Feature Description
9+
Please describe the feature you would like to request.
10+
11+
## Use Cases
12+
How will this feature be used? Please provide examples.
13+
14+
## Additional Context
15+
Add any other context about the feature request, including design ideas or potential impacts.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: "Other"
3+
about: "Use this template for any other issues or inquiries."
4+
title: "Other Issue Title"
5+
labels: ["question", "other"]
6+
---
7+
8+
## Description
9+
Please provide a detailed description of your inquiry or issue.
10+
11+
## Context
12+
Add any relevant context or background information that may help in addressing your request.
13+
14+
## Additional Information
15+
If applicable, include any additional information, screenshots, or references.

.github/workflows/welcome.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: New Contributor Welcome
22

33
permissions:
4+
actions: write
5+
checks: write
6+
contents: write
47
issues: write
58
pull-requests: write
69

@@ -14,24 +17,24 @@ jobs:
1417
greet_new_contributor:
1518
runs-on: ubuntu-latest
1619
steps:
17-
- uses: wow-actions/welcome@v1.3.1
20+
- uses: bubkoo/welcome-action@v1
1821
with:
1922
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2023
FIRST_ISSUE_REACTIONS: "+1, hooray, rocket, heart"
2124
FIRST_ISSUE: >
2225
👋 Greetings @{{ author }}!
23-
26+
2427
We're thrilled to see you opening your first issue! Your input is invaluable to us. Don’t forget to adhere to our issue template for the best experience.
2528
2629
FIRST_PR: >
2730
👋 Welcome aboard, @{{ author }}!
28-
31+
2932
We're delighted to have your first pull request! Please take a moment to check our contributing guidelines to ensure a smooth process.
3033
3134
FIRST_PR_MERGED: >
3235
🎉 Kudos @{{ author }}!
33-
36+
3437
You've just merged your first pull request! We're excited to have you in our community. Keep up the fantastic contributions!
35-
STAR_MESSAGE: If you enjoy this project, please consider ⭐ starring ⭐ our repository!
38+
STAR_MESSAGE: If you enjoy this project, please consider ⭐ starring ⭐ this repository!
3639
env:
3740
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTORS.svg

Lines changed: 9 additions & 3 deletions
Loading

PROJECTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
* [QR Code Generator](https://github.com/king04aman/All-In-One-Python-Projects/tree/main/QR%20Code%20Generator)
2626
* [Random Movie Selector](https://github.com/king04aman/All-In-One-Python-Projects/tree/main/Random%20Movie%20Selector)
2727
* [Random Quotes Generator](https://github.com/king04aman/All-In-One-Python-Projects/tree/main/Random%20Quotes%20Generator)
28+
* [Real-Time Cryptocurrency Price Tracker](https://github.com/king04aman/All-In-One-Python-Projects/tree/main/Real-Time%20Cryptocurrency%20Price%20Tracker)
2829
* [Recipe Finder with Meal Planner](https://github.com/king04aman/All-In-One-Python-Projects/tree/main/Recipe%20Finder%20with%20Meal%20Planner)
30+
* [Resume Builder](https://github.com/king04aman/All-In-One-Python-Projects/tree/main/Resume%20Builder)
2931
* [Simple Assistant](https://github.com/king04aman/All-In-One-Python-Projects/tree/main/Simple%20Assistant)
3032
* [Speech To Text](https://github.com/king04aman/All-In-One-Python-Projects/tree/main/Speech%20To%20Text)
3133
* [Spell Checker](https://github.com/king04aman/All-In-One-Python-Projects/tree/main/Spell%20Checker)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Cryptocurrency Price Tracker with CoinGecko API
2+
3+
## Project Overview
4+
5+
The **Real-Time Cryptocurrency Price Tracker** is a Python script that allows users to retrieve real-time cryptocurrency prices, percentage price changes, and historical price data using the CoinGecko public API. The script also offers a simple visualization of historical price trends. Refer to [CoinGecko API](https://docs.coingecko.com/v3.0.1/reference/introduction) and [CoinGecko Coins List](https://api.coingecko.com/api/v3/coins/list) for more information.
6+
7+
## Features
8+
9+
- **Real-Time Price Retrieval**: Input the name of a cryptocurrency (eg. bitcoin) to retrieve its current price in USD
10+
- **24-Hour Price Change**: Displays the 24-hour percentage change in price for the selected cryptocurrency
11+
- **Historical Price Data**: Retrieve historical price data for a specified number of days (eg. 1 day, 7 days, or 30 days) and visualize it in a chart
12+
- **Data Visualization**: Uses matplotlib to generate a line chart displaying the historical price data
13+
14+
15+
## Technologies Used
16+
17+
- **Python**: The core programming language used to build the script
18+
- **CoinGecko API**: A free API used to fetch cryptocurrency prices, percentage changes, and historical data
19+
- **Requests**: A Python library for making HTTP requests to the CoinGecko API
20+
- **Matplotlib**: A Python library used to visualize historical cryptocurrency price data in a line chart format
21+
- **Datetime**: Python datetime module is used to convert and handle timestamps when retrieving historical price data
22+
23+
## Prerequisites
24+
25+
Before running the application, ensure you have the following:
26+
27+
- [Python 3.x](https://www.python.org/downloads/) installed on your system
28+
- `requests` and `matplotlib` libraries are installed. Refer to `requirements.txt` for a specific version
29+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import requests
2+
import matplotlib.pyplot as plt
3+
import datetime
4+
5+
COINGECKO_API_URL = "https://api.coingecko.com/api/v3"
6+
7+
8+
def get_crypto_price(crypto_symbol):
9+
headers = {"accept": "application/json"}
10+
response = requests.get(f"{COINGECKO_API_URL}/simple/price", params={
11+
'ids': crypto_symbol,
12+
'vs_currencies': 'usd',
13+
'include_24hr_change': 'true'
14+
}, headers=headers)
15+
16+
if response.status_code == 200:
17+
data = response.json()
18+
if crypto_symbol in data:
19+
price = data[crypto_symbol]['usd']
20+
change_percentage = data[crypto_symbol]['usd_24h_change']
21+
return price, change_percentage
22+
else:
23+
raise ValueError(f"Cryptocurrency '{crypto_symbol}' not found.")
24+
else:
25+
raise Exception(f"Failed to fetch data: {response.status_code} - {response.reason}")
26+
27+
28+
def get_historical_data(crypto_symbol, days):
29+
response = requests.get(f"{COINGECKO_API_URL}/coins/{crypto_symbol}/market_chart", params={
30+
'vs_currency': 'usd',
31+
'days': days
32+
})
33+
34+
if response.status_code == 200:
35+
data = response.json()
36+
if 'prices' in data:
37+
return data['prices'] # Returns price data over the days
38+
else:
39+
raise ValueError(f"No historical data available for '{crypto_symbol}'.")
40+
else:
41+
raise Exception(f"Failed to fetch historical data: {response.status_code} - {response.reason}")
42+
43+
44+
def plot_historical_data(historical_data, crypto_symbol):
45+
dates = [datetime.datetime.fromtimestamp(item[0] / 1000) for item in historical_data]
46+
prices = [item[1] for item in historical_data]
47+
48+
plt.figure(figsize=(10, 6))
49+
plt.plot(dates, prices, marker='o', linestyle='-', color='b')
50+
plt.title(f'Historical Price Data for {crypto_symbol.capitalize()}')
51+
plt.xlabel('Date')
52+
plt.ylabel('Price (USD)')
53+
plt.xticks(rotation=45)
54+
plt.grid(True)
55+
plt.tight_layout()
56+
plt.show()
57+
58+
59+
def main():
60+
crypto = input("Enter cryptocurrency symbol (eg. bitcoin, ethereum): ").lower()
61+
62+
try:
63+
# Get real-time price and 24-hour change
64+
price, change = get_crypto_price(crypto)
65+
print(f"Current price of {crypto}: ${price}")
66+
print(f"24-hour change: {change:.2f}%")
67+
except ValueError as e:
68+
print(f"Error: {e}")
69+
return
70+
except Exception as e:
71+
print(f"Error fetching price data: {e}")
72+
return
73+
74+
# Validate and get historical data
75+
while True:
76+
try:
77+
days = int(input("Enter the number of days for historical data (eg. 1, 7, 30): "))
78+
if days <= 0:
79+
raise ValueError("The number of days must be a positive integer.")
80+
break
81+
except ValueError as e:
82+
print(f"Invalid input: {e}. Please enter a valid number.")
83+
84+
try:
85+
historical_data = get_historical_data(crypto, days)
86+
print("Historical data retrieved successfully.")
87+
plot_historical_data(historical_data, crypto)
88+
except ValueError as e:
89+
print(f"Error: {e}")
90+
except Exception as e:
91+
print(f"Error fetching historical data: {e}")
92+
93+
94+
if __name__ == "__main__":
95+
main()

0 commit comments

Comments
 (0)