stonks-dashboard 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,54 +1,79 @@
1
+ <div align="center">
2
+
1
3
  # Stonks Dashboard
2
4
 
3
- Minimal real-time market dashboard for your terminal.
5
+ [![GitHub stars](https://img.shields.io/github/stars/praffall/stonks-dashboard?style=social)](https://github.com/praffall/stonks-dashboard/stargazers)
6
+ [![npm version](https://img.shields.io/npm/v/stonks-dashboard.svg)](https://www.npmjs.com/package/stonks-dashboard)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+
9
+ **Minimal real-time market dashboard for your terminal**
10
+
11
+ ![Dashboard](assets/dashboard.png)
12
+
13
+ </div>
14
+
15
+ ---
4
16
 
5
- **Features**
17
+ ## Features
6
18
 
7
19
  - **Watchlist:** Crypto, stocks, ETFs in one view
8
20
  - **Trend chart:** Periods 1D, 7D, 30D, 90D
9
21
  - **Details panel:** Key metrics (price, change, highs/lows)
10
22
  - **Caching & rate limits:** Smooth updates with fewer API errors
11
23
 
12
- **Requirements**
24
+ ## Quick Start
13
25
 
14
- - Node.js (LTS recommended)
26
+ ```bash
27
+ npx stonks-dashboard
28
+ ```
15
29
 
16
- **Install**
30
+ Or install globally:
17
31
 
18
32
  ```bash
19
- npm install
33
+ npm install -g stonks-dashboard
34
+ stonks-dashboard
20
35
  ```
21
36
 
22
- **Run**
37
+ ## Local Development
23
38
 
24
39
  ```bash
40
+ git clone https://github.com/praffall/stonks-dashboard.git
41
+ cd stonks-dashboard
42
+ npm install
25
43
  npm start
26
44
  ```
27
45
 
28
- **Controls**
46
+ ## Controls
47
+
48
+ - `↑`/`↓`: Navigate watchlist
49
+ - `1`–`4`: Switch period (1D/7D/30D/90D)
50
+ - `q` or `Ctrl+C`: Quit
29
51
 
30
- - Up/Down: Navigate
31
- - 1–4: Switch period (1D/7D/30D/90D)
32
- - q or Ctrl+C: Quit
52
+ ## Configuration
33
53
 
34
- **Configuration**
54
+ Edit `config.json` to customize:
35
55
 
36
- - Edit `config.json` to adjust:
37
- - `tickers`: symbols to display
38
- - `cryptoIds`: CoinGecko IDs for crypto (e.g., "BTC": "bitcoin")
39
- - `updateInterval`: polling interval in ms
56
+ ```json
57
+ {
58
+ "tickers": ["BTC", "ETH", "AAPL", "TSLA"],
59
+ "cryptoIds": { "BTC": "bitcoin", "ETH": "ethereum" },
60
+ "updateInterval": 120000
61
+ }
62
+ ```
40
63
 
41
- **Screenshot**
64
+ ## Data Sources
42
65
 
43
- ![Dashboard](assets/dashboard.png)
66
+ - **Crypto:** CoinGecko API
67
+ - **Stocks/ETFs:** Yahoo Finance API
44
68
 
45
- **Data Sources**
69
+ Requests are rate-limited and cached (`cache.json`). Crypto details cache ~30 min; price series cache ~1 min.
46
70
 
47
- - Crypto: CoinGecko
48
- - Stocks/ETFs: Yahoo Finance
71
+ If `cache.json` is missing on first run, it will be seeded from `cache.example.json` (published with the package) and created automatically.
49
72
 
50
- Notes: Requests are paced and responses cached (`cache.json`). Crypto details cache ~30 min; price series cache ~1 min.
73
+ ## Requirements
74
+
75
+ - Node.js (LTS recommended)
51
76
 
52
- **License**
77
+ ## License
53
78
 
54
- See [LICENSE](LICENSE).
79
+ MIT - See [LICENSE](LICENSE)
@@ -0,0 +1,24 @@
1
+ {
2
+ "_comment": "Example cache. Real cache is created at runtime in cache.json.",
3
+ "example": {
4
+ "symbol": "BTC",
5
+ "type": "crypto",
6
+ "price": 0,
7
+ "change": 0,
8
+ "change24h": 0,
9
+ "history": [0],
10
+ "timestamps": [],
11
+ "open": 0,
12
+ "high": 0,
13
+ "low": 0,
14
+ "high52w": 0,
15
+ "low52w": 0,
16
+ "marketCap": 0,
17
+ "volume": 0,
18
+ "circulatingSupply": 0,
19
+ "totalSupply": 0,
20
+ "rank": 0,
21
+ "timestamp": 0,
22
+ "error": false
23
+ }
24
+ }
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "stonks-dashboard",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A cyberpunk-style real-time financial monitor for the terminal",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
7
+ "files": [
8
+ "src",
9
+ "README.md",
10
+ "LICENSE",
11
+ "config.json",
12
+ "assets",
13
+ "cache.example.json"
14
+ ],
7
15
  "bin": {
8
16
  "stonks-dashboard": "./src/index.js"
9
17
  },
@@ -52,6 +52,17 @@ export class DataService {
52
52
  this.cache.set(key, value);
53
53
  }
54
54
  console.log(`[Cache] Loaded ${Object.keys(data).length} entries from file`);
55
+ } else if (existsSync('./cache.example.json')) {
56
+ // Seed cache from example on first run
57
+ const example = readFileSync('./cache.example.json', 'utf-8');
58
+ writeFileSync(CACHE_FILE, example);
59
+ const data = JSON.parse(example);
60
+ for (const [key, value] of Object.entries(data)) {
61
+ // If example entries have timestamps, refresh them
62
+ if (value && typeof value === 'object') value.timestamp = Date.now();
63
+ this.cache.set(key, value);
64
+ }
65
+ console.log('[Cache] Seeded cache.json from cache.example.json');
55
66
  }
56
67
  } catch (error) {
57
68
  console.error('[Cache] Error loading cache file:', error.message);
package/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto