Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Node.js module to fetch stock information from Yahoo Finance.

License

Notifications You must be signed in to change notification settings

josecoelhomelo/yahoo-finance-webscraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js module to fetch stock information from Yahoo Finance.

Originally created by unknown author.

Installation

npm install yahoo-finance-webscraper

Usage

getSingleStockInfo

Retrieves information about a single stock symbol.

Single output

const yahoo = require('yahoo-finance-webscraper');

yahoo.getSingleStockInfo('AAPL').then(data => {
    console.log(data)
});

getStocksInfo

Retrieves information about a multiple stock symbols.

Multiple outputs

const yahoo = require('yahoo-finance-webscraper');

yahoo.getStocksInfo(['AAPL', 'TSLA']).then(data => {
    console.log(data)
});

Examples

Single output example

{
    summaryDetail: {
        maxAge: 1,
        priceHint: 2,
        previousClose: 166.47,
        open: 165.8,
        dayLow: 165.54,
        dayHigh: 168.16,
        regularMarketPreviousClose: 166.47,
        regularMarketOpen: 165.8,
        regularMarketDayLow: 165.54,
        regularMarketDayHigh: 168.16,
        dividendRate: 0.92,
        dividendYield: 0.0056,
        exDividendDate: 1675987200,
        payoutRatio: 0.1545,
        fiveYearAvgDividendYield: 0.94,
        beta: 1.296885,
        trailingPE: 28.508503,
        forwardPE: 25.360062,
        volume: 47601874,
        regularMarketVolume: 47601874,
        averageVolume: 64442759,
        averageVolume10days: 49785270,
        averageDailyVolume10Day: 49785270,
        bid: 167.38,
        ask: 167.44,
        bidSize: 1000,
        askSize: 1800,
        marketCap: 2652225142784,
        fiftyTwoWeekLow: 124.17,
        fiftyTwoWeekHigh: 176.15,
        priceToSalesTrailing12Months: 6.843798,
        fiftyDayAverage: 155.7492,
        twoHundredDayAverage: 150.0101,
        trailingAnnualDividendRate: 0.91,
        trailingAnnualDividendYield: 0.0054664505,
        currency: 'USD',
        fromCurrency: null,
        toCurrency: null,
        lastMarket: null,
        coinMarketCapLink: null,
        algorithm: null,
        tradeable: false
    },
    price: {
        maxAge: 1,
        preMarketChangePercent: -0.00342408,
        preMarketChange: -0.570007,
        preMarketTime: 1681910999,
        preMarketPrice: 165.9,
        preMarketSource: 'FREE_REALTIME',
        postMarketChangePercent: -0.0011036064,
        postMarketChange: -0.18499756,
        postMarketTime: 1681942486,
        postMarketPrice: 167.445,
        postMarketSource: 'FREE_REALTIME',
        regularMarketChangePercent: 0.0069682444,
        regularMarketChange: 1.1600037,
        regularMarketTime: 1681934404,
        priceHint: 2,
        regularMarketPrice: 167.63,
        regularMarketDayHigh: 168.16,
        regularMarketDayLow: 165.54,
        regularMarketVolume: 47601874,
        averageDailyVolume10Day: 49785270,
        averageDailyVolume3Month: 64442759,
        regularMarketPreviousClose: 166.47,
        regularMarketSource: 'FREE_REALTIME',
        regularMarketOpen: 165.8,
        exchange: 'NMS',
        exchangeName: 'NasdaqGS',
        exchangeDataDelayedBy: 0,
        marketState: 'POST',
        quoteType: 'EQUITY',
        symbol: 'AAPL',
        underlyingSymbol: null,
        shortName: 'Apple Inc.',
        longName: 'Apple Inc.',
        currency: 'USD',
        quoteSourceName: 'Nasdaq Real Time Price',
        currencySymbol: '$',
        fromCurrency: null,
        toCurrency: null,
        lastMarket: null,
        marketCap: 2652225142784
    },
    financialData: {
        maxAge: 86400,
        currentPrice: 167.63,
        targetHighPrice: 205,
        targetLowPrice: 116,
        targetMeanPrice: 170.5,
        targetMedianPrice: 173.5,
        recommendationMean: 2,
        recommendationKey: 'buy',
        numberOfAnalystOpinions: 38,
        totalCash: 51355000832,
        totalCashPerShare: 3.246,
        ebitda: 125287997440,
        totalDebt: 111109996544,
        quickRatio: 0.769,
        currentRatio: 0.938,
        totalRevenue: 387537010688,
        debtToEquity: 195.868,
        revenuePerShare: 24.084,
        returnOnAssets: 0.19569999,
        returnOnEquity: 1.47943,
        grossProfits: 170782000000,
        freeCashflow: 84729126912,
        operatingCashflow: 109189996544,
        earningsGrowth: -0.105,
        revenueGrowth: -0.055,
        grossMargins: 0.43058997,
        ebitdaMargins: 0.32329,
        operatingMargins: 0.29408002,
        profitMargins: 0.24558,
        financialCurrency: 'USD'
    }
}

Multiple output example

[
    {
        summaryDetail: {
            maxAge: 1,
            priceHint: 2,
            previousClose: 166.47,
            open: 165.8,
            dayLow: 165.54,
            dayHigh: 168.16,
            regularMarketPreviousClose: 166.47,
            regularMarketOpen: 165.8,
            regularMarketDayLow: 165.54,
            regularMarketDayHigh: 168.16,
            dividendRate: 0.92,
            dividendYield: 0.0056,
            exDividendDate: 1675987200,
            payoutRatio: 0.1545,
            fiveYearAvgDividendYield: 0.94,
            beta: 1.296885,
            trailingPE: 28.508503,
            forwardPE: 25.360062,
            volume: 47601874,
            regularMarketVolume: 47601874,
            averageVolume: 64442759,
            averageVolume10days: 49785270,
            averageDailyVolume10Day: 49785270,
            bid: 167.38,
            ask: 167.44,
            bidSize: 1000,
            askSize: 1800,
            marketCap: 2652225142784,
            fiftyTwoWeekLow: 124.17,
            fiftyTwoWeekHigh: 176.15,
            priceToSalesTrailing12Months: 6.843798,
            fiftyDayAverage: 155.7492,
            twoHundredDayAverage: 150.0101,
            trailingAnnualDividendRate: 0.91,
            trailingAnnualDividendYield: 0.0054664505,
            currency: 'USD',
            fromCurrency: null,
            toCurrency: null,
            lastMarket: null,
            coinMarketCapLink: null,
            algorithm: null,
            tradeable: false
        },
        price: {
            maxAge: 1,
            preMarketChangePercent: -0.00342408,
            preMarketChange: -0.570007,
            preMarketTime: 1681910999,
            preMarketPrice: 165.9,
            preMarketSource: 'FREE_REALTIME',
            postMarketChangePercent: -0.0011036064,
            postMarketChange: -0.18499756,
            postMarketTime: 1681942486,
            postMarketPrice: 167.445,
            postMarketSource: 'FREE_REALTIME',
            regularMarketChangePercent: 0.0069682444,
            regularMarketChange: 1.1600037,
            regularMarketTime: 1681934404,
            priceHint: 2,
            regularMarketPrice: 167.63,
            regularMarketDayHigh: 168.16,
            regularMarketDayLow: 165.54,
            regularMarketVolume: 47601874,
            averageDailyVolume10Day: 49785270,
            averageDailyVolume3Month: 64442759,
            regularMarketPreviousClose: 166.47,
            regularMarketSource: 'FREE_REALTIME',
            regularMarketOpen: 165.8,
            exchange: 'NMS',
            exchangeName: 'NasdaqGS',
            exchangeDataDelayedBy: 0,
            marketState: 'POST',
            quoteType: 'EQUITY',
            symbol: 'AAPL',
            underlyingSymbol: null,
            shortName: 'Apple Inc.',
            longName: 'Apple Inc.',
            currency: 'USD',
            quoteSourceName: 'Nasdaq Real Time Price',
            currencySymbol: '$',
            fromCurrency: null,
            toCurrency: null,
            lastMarket: null,
            marketCap: 2652225142784
        },
        financialData: {
            maxAge: 86400,
            currentPrice: 167.63,
            targetHighPrice: 205,
            targetLowPrice: 116,
            targetMeanPrice: 170.5,
            targetMedianPrice: 173.5,
            recommendationMean: 2,
            recommendationKey: 'buy',
            numberOfAnalystOpinions: 38,
            totalCash: 51355000832,
            totalCashPerShare: 3.246,
            ebitda: 125287997440,
            totalDebt: 111109996544,
            quickRatio: 0.769,
            currentRatio: 0.938,
            totalRevenue: 387537010688,
            debtToEquity: 195.868,
            revenuePerShare: 24.084,
            returnOnAssets: 0.19569999,
            returnOnEquity: 1.47943,
            grossProfits: 170782000000,
            freeCashflow: 84729126912,
            operatingCashflow: 109189996544,
            earningsGrowth: -0.105,
            revenueGrowth: -0.055,
            grossMargins: 0.43058997,
            ebitdaMargins: 0.32329,
            operatingMargins: 0.29408002,
            profitMargins: 0.24558,
            financialCurrency: 'USD'
        }
    },
    {
        summaryDetail: {
            maxAge: 1,
            priceHint: 2,
            previousClose: 184.31,
            open: 179.1,
            dayLow: 177.65,
            dayHigh: 183.5,
            regularMarketPreviousClose: 184.31,
            regularMarketOpen: 179.1,
            regularMarketDayLow: 177.65,
            regularMarketDayHigh: 183.5,
            payoutRatio: 0,
            beta: 2.01211,
            trailingPE: 50.444134,
            forwardPE: 33.319187,
            volume: 110822202,
            regularMarketVolume: 110822202,
            averageVolume: 163578086,
            averageVolume10days: 121010810,
            averageDailyVolume10Day: 121010810,
            bid: 180.54,
            ask: 180.55,
            bidSize: 1400,
            askSize: 800,
            marketCap: 572345679872,
            fiftyTwoWeekLow: 101.81,
            fiftyTwoWeekHigh: 364.07333,
            priceToSalesTrailing12Months: 7.0259223,
            fiftyDayAverage: 192.4822,
            twoHundredDayAverage: 213.348,
            trailingAnnualDividendRate: 0,
            trailingAnnualDividendYield: 0,
            currency: 'USD',
            fromCurrency: null,
            toCurrency: null,
            lastMarket: null,
            coinMarketCapLink: null,
            algorithm: null,
            tradeable: false
        },
        price: {
            maxAge: 1,
            preMarketChangePercent: -0.0281591,
            preMarketChange: -5.19,
            preMarketTime: 1681910999,
            preMarketPrice: 179.12,
            preMarketSource: 'FREE_REALTIME',
            postMarketChangePercent: -0.04081014,
            postMarketChange: -7.3699036,
            postMarketTime: 1681942489,
            postMarketPrice: 173.2201,
            postMarketSource: 'FREE_REALTIME',
            regularMarketChangePercent: -0.020183394,
            regularMarketChange: -3.7200012,
            regularMarketTime: 1681934404,
            priceHint: 2,
            regularMarketPrice: 180.59,
            regularMarketDayHigh: 183.5,
            regularMarketDayLow: 177.65,
            regularMarketVolume: 110822202,
            averageDailyVolume10Day: 121010810,
            averageDailyVolume3Month: 163578086,
            regularMarketPreviousClose: 184.31,
            regularMarketSource: 'FREE_REALTIME',
            regularMarketOpen: 179.1,
            exchange: 'NMS',
            exchangeName: 'NasdaqGS',
            exchangeDataDelayedBy: 0,
            marketState: 'POST',
            quoteType: 'EQUITY',
            symbol: 'TSLA',
            underlyingSymbol: null,
            shortName: 'Tesla, Inc.',
            longName: 'Tesla, Inc.',
            currency: 'USD',
            quoteSourceName: 'Nasdaq Real Time Price',
            currencySymbol: '$',
            fromCurrency: null,
            toCurrency: null,
            lastMarket: null,
            marketCap: 572345679872
        },
        financialData: {
            maxAge: 86400,
            currentPrice: 180.59,
            targetHighPrice: 300,
            targetLowPrice: 24.33,
            targetMeanPrice: 197.13,
            targetMedianPrice: 210,
            recommendationMean: 2.4,
            recommendationKey: 'buy',
            numberOfAnalystOpinions: 35,
            totalCash: 22185000960,
            totalCashPerShare: 7.011,
            ebitda: 17439000576,
            totalDebt: 5747999744,
            quickRatio: 0.947,
            currentRatio: 1.532,
            totalRevenue: 81462001664,
            debtToEquity: 12.523,
            revenuePerShare: 26.026,
            returnOnAssets: 0.11847,
            returnOnEquity: 0.32490003,
            grossProfits: 20853000000,
            freeCashflow: 4208124928,
            operatingCashflow: 14723999744,
            earningsGrowth: 0.569,
            revenueGrowth: 0.372,
            grossMargins: 0.25597998,
            ebitdaMargins: 0.21406999,
            operatingMargins: 0.16808,
            profitMargins: 0.15413,
            financialCurrency: 'USD'
        }
    }
]

Releases

No releases published

Packages

No packages published