-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-yahoo.js
More file actions
27 lines (23 loc) · 796 Bytes
/
test-yahoo.js
File metadata and controls
27 lines (23 loc) · 796 Bytes
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
const pkg = require('yahoo-finance2');
console.log('Package keys:', Object.keys(pkg));
console.log('Default keys:', pkg.default ? Object.keys(pkg.default) : 'No default');
async function test() {
try {
const yahooFinance = pkg.default || pkg;
const symbol = 'RELIANCE.NS';
console.log('Testing historical fetch...');
try {
const result = await yahooFinance.historical(symbol, {
period1: '2025-01-01',
period2: '2025-01-05',
interval: '1d'
});
console.log('Success (default)! Result len:', result.length);
} catch (e) {
console.error('Error with default:', e.message);
}
} catch (err) {
console.error('Fatal:', err);
}
}
test();