SYNOPSIS

(2020) Yahoo::Finance get the symbols historic data from yahoo

Perhaps a little code snippet.

#oject oriented interface

use Yahoo::Finance;

my $fin = Yahoo::Finance->new();

    my $param = {
        symbol   => 'GAIL.BO',     
        period1  => '25-12-2015',  #optional default '01-01-1800'
        period2  => '25-12-2019',  #optional default 'todays date'
        interval => '1mo',         #optional default '1d'
        events   => 'split',       #optional default 'history'
        timeout  => '30',          #optional default '60'
    };

    print $fin->get_historic_data( $param );

                            or

    #only div for week interval
    my $param = {
        symbol   => 'GAIL.BO',
        interval => '1wk',
        events   => 'div',
    };

    print $fin->get_historic_data( $param );

                            or

    print $fin->get_historic_data({ 'symbol' => 'GAIL.BO' });



    #non-oject oriented interface

      use Yahoo::Finance;
      print get_historic_data( { 'symbol' => 'GOLD' } );

SUBROUTINES/METHODS

new

used to create a constructor of Yahoo::Finance

get_historic_data

params hash ref of following valid keys
  • invocant { optional but required when using object oriented interface }

  • symbol { scalar string }

    symbol name used by the yahoo fianance.

    Please note yahoo uses suffix on every symbol.

    Pass the symobl with suffix.

    eg symbol GAIL listed on BSE represented by yahoo-finance as "GAIL.BO"
  • period1

    period1 scalar string optional default is "01-01-1800" format MM-DD-YYYY

    period1 is the start date from where the data is needed

    format is strictly MM-DD-YYYY
  • period2

    period2 scalar string optional default is todays date format MM-DD-YYYY

    period2 is the to date till when the data is needed.

    format is strictly MM-DD-YYYY
  • interval

    interval scalar string (optional default 1d)

    This is the interval at which data is needed.

    allowed options "1d" or "1w" or "1mo"
    
    1d is 1 day
    1w is 1 week
    1mo is 1 month
  • events

    events scalar string (optional default history) This the event data needed.

    allowed options  "history" or "split" or "div"
  • timeout

    timeout scalar string in sec (optional default 60)

    request timeout.

    in seconds default is 60

AUTHOR

Sushrut Pajai, <spajai at cpan.org>

BUGS

Please report any bugs or feature requests to bug-yahoo-finance at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Yahoo-Finance. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Yahoo::Finance

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2020 by Sushrut Pajai.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)