Journalism Finance - v2.0.6
    Preparing search index...

    Journalism Finance - v2.0.6

    The Journalism Library (finance)

    Useful TypeScript functions for financial calculations and data fetching in journalism projects. Part of the journalism library.

    The library is maintained by Nael Shiab, computational journalist and senior data producer for CBC News.

    Tip

    To learn how to use this library and more, check out Code Like a Journalist, a free and open-source data analysis and data visualization course in TypeScript. You might also find simple-data-analysis useful.

    npm install @nshiab/journalism-finance
    
    import { getYahooFinanceData } from "@nshiab/journalism-finance";

    const prices = await getYahooFinanceData(
    "AAPL",
    new Date("2025-03-13"),
    new Date("2025-03-14"),
    "close",
    "1d",
    );
    console.log(prices);

    For browser applications, import browser-safe calculations from @nshiab/journalism-finance/web with your JavaScript bundler.

    import { adjustToInflation } from "@nshiab/journalism-finance/web";

    const adjustedAmount = adjustToInflation(100, 120, 150);
    console.log(adjustedAmount); // 125

    To start a data project with folders, configuration and documentation for AI agents, run:

    npx @nshiab/setup-data-project
    

    See CONTRIBUTING.md for development commands.