Skip to content

Commit 8519c53

Browse files
cryptocurrency api
1 parent 5ea8061 commit 8519c53

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed
44.6 KB
Loading
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Detect Language API 🗣
2+
3+
## 🔹Introduction
4+
<ul>
5+
<li>This project allows you to fetch latest rate of cryptocurrency in USD, and percentage change in 24 hours, with time when the rates are updated last.</li>
6+
</ul>
7+
8+
## 🔹Purpose
9+
<ul>
10+
<li>User can fetch latest rates of cryptocurrencies and percentage change in 24 </li>
11+
<li>User can detect language type of his data in .txt format files</li>
12+
<li>It is mini version of language detector on your local machine</li>
13+
</ul>
14+
15+
## 🔹Requirements
16+
<ul>
17+
<li>requests</li>
18+
</ul>
19+
20+
21+
22+
### Example API Request:
23+
### 'https://cryptantapi.root.sx/getPrice/Bitcoin'
24+
25+
<br>
26+
27+
# Setup Instructions
28+
29+
1. Have Python 3.x setup in the system
30+
2. Install the necessary packages
31+
3. Run the code using the command
32+
33+
```
34+
python cryptocurrency_rates.py
35+
```
36+
and obtain the Output
37+
38+
<br>
39+
40+
# Workflow of the Program
41+
42+
1. Enter number of requests
43+
2. Enter currency name
44+
5. Obtain the Output
45+
46+
<br>
47+
48+
# Output
49+
50+
<img src="Images/a.png">
51+
52+
53+
## 🔹Author
54+
Drashti Patel
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import requests
2+
req=int(input("Enter number of requests "))
3+
print("Enter currency: \n e.g. Bitcoin\n Ethereum \n Dogecoin \n Litecoin \n Cardano \n Stellar \n Polkadot \n ")
4+
for i in range(req):
5+
url='https://cryptantapi.root.sx/getPrice/'
6+
a=input("Enter currency \n")
7+
print("----------------------------------------------------------------------------------")
8+
url+=a
9+
response = requests.get(url)
10+
status_code = response.status_code
11+
if status_code == 200:
12+
13+
print( "Currency: ", a)
14+
print( "Price in USD: ",response.json()['priceUsd'],'$')
15+
print( "Percentage change in 24 hrs: ",response.json()['percentChange24hUsd'],'%')
16+
print( "last updated: ",response.json()['lastUpdated'][:10])
17+
else:
18+
print("Enter valid currency")
19+
20+
print("Done")

APIScripts/Cryptocurrency API/requirements.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)