Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    hkstock-holdingspublic

    node-hkstock-holdings

    Scrape HKExnews share holdings page and output JSON data.

    HKExnews will return data for the previous day if the day requested is a public holiday.

    If the period is greater than 30 calender days, weekly data for each Friday within the period will be used.

    Note: Date object prototype will be extended by this package

    Installation

    npm install hkstock-holdings

    Usage

    See bin/hkstock-holdings.

    Data Returned

    var _result = {
        code,  // code of the stock
        name,  // name of the stock
        // period specified by user
        startDate,
        endDate,
        // actual dates where data is retrieved
        // this is a subset of the input peroid (minus public holidays)
        period,
        series  // array with each element corresponding to data of one
                // parti over the period, filling missing records and have
                // some statistics computed, suitable for plotting
    };

    Performance

    user field can be taken as the time spent by this (and under-lying) modules

    20140211

    time ./bin/hkstock-holdings 1 -t 1m -e 2014-01-31 -j
    
    real    0m8.275s
    user    0m2.512s
    sys     0m0.288s
    
    time ./bin/hkstock-holdings 700 -t 1m -e 2014-01-31 -j
    
    real    0m8.108s
    user    0m2.360s
    sys     0m0.196s
    

    20140223

    time ./bin/hkstock-holdings 1 -t 1m -e 2014-01-31 -j
    
    real    0m7.342s
    user    0m2.188s
    sys     0m0.164s
    
    time ./bin/hkstock-holdings 700 -t 1m -e 2014-01-31 -j
    
    real    0m5.460s
    user    0m2.124s
    sys    0m0.184s
    

    install

    npm i hkstock-holdings

    Downloadsweekly downloads

    3

    version

    0.2.1

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar