13 lines
390 B
TypeScript
13 lines
390 B
TypeScript
import YahooFinance from 'yahoo-finance2';
|
|
const yahooFinance = new YahooFinance({ suppressNotices: ['ripHistorical'] });
|
|
|
|
async function test() {
|
|
try {
|
|
const res = await yahooFinance.chart('AAPL', { period1: '2024-01-01', period2: '2024-01-05', interval: '1d' });
|
|
console.log(JSON.stringify(res.quotes[0], null, 2));
|
|
} catch (e) {
|
|
console.error("Error:", e);
|
|
}
|
|
}
|
|
test();
|