-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.md
More file actions
181 lines (117 loc) · 2.7 KB
/
Copy pathREADME.md
File metadata and controls
181 lines (117 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Crypto Tracker CLI 🚀
A lightweight and fast CLI tool to fetch real-time cryptocurrency prices directly from your terminal.
Built with TypeScript using the CoinGecko public API — no API key required.
---
## ✨ Features
* 📈 Real-time cryptocurrency prices
* ⚡ Fast and minimal CLI output
* 🔒 Input validation & error handling
* 🧠 Strong typing with TypeScript
* 🌍 Supports multiple fiat & crypto currencies
* 🔓 No API key required
---
## 📦 Installation
Install globally via npm:
```bash
npm install -g @nilesh-padiyar/crypto-tracker
```
Before installing, make sure you have
* [Node.js](https://nodejs.org) (v14 or higher recommended)
* npm (comes with Node.js)
---
## ⚡ Usage
```bash
crypto <coin> <currency>
```
### Examples
```bash
crypto bitcoin usd
crypto ethereum inr
crypto dogecoin usd
```
### Example Output
```bash
BITCOIN price: 46662 USD
```
---
## 💱 Supported Currencies
Supports all currencies available from the CoinGecko API.
To see the full list of supported currencies, run:
```bash
crypto --currencies
```
---
## 🧠 How It Works
* Fetches live price data from the CoinGecko API
* Validates user input
* Displays clean output in the terminal
---
## Notes on Rate-Limiting
CoinGecko public API allows up to 50 requests per minute per IP.
* If you hit the limit, the CLI will automatically retry with exponential backoff.
* Example warning:
```bash
⚠ 429 Rate limit hit, retrying in 1000ms...
⚠ 429 Rate limit hit, retrying in 2000ms...
⚠ 429 Rate limit hit, retrying in 4000ms...
✖ Something went wrong
```
* This ensures users understand their usage limits while preventing the CLI from failing silently.
* Cached and fallback currencies help reduce unnecessary API calls.
---
## 🛠️ Development Setup
If you want to work on the project locally:
```bash
git clone https://github.com/nilesh-padiyar/crypto-tracker.git
cd crypto-tracker
npm install
npm run build
```
Run locally:
```bash
node dist/index.js bitcoin usd
```
---
## 🔗 Using Locally (Optional)
```bash
npm link
crypto bitcoin usd
```
---
## ⚙️ CLI Configuration
Make sure your `package.json` includes:
```json
"bin": {
"crypto": "dist/index.js"
}
```
And your entry file starts with:
```bash
#!/usr/bin/env node
```
---
## 🔄 Updating
```bash
npm update -g @nilesh-padiyar/crypto-tracker
```
---
## 🧪 Tech Stack
* Node.js
* TypeScript
* Async/Await
* CoinGecko Public API
---
## 🤝 Contributing
Contributions are welcome!
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request
Please keep commits clean and meaningful.
---
## 📜 License
MIT — free to use, modify, and distribute
---
## 🙌 Author
Nilesh Padiyar
---