Finance::YahooQuote von Dirk Eddelbuettel vereinfacht die Ermittlung der Börsenkurse von Yahoo! Finance und dient als Grundlage für den graphischen Stockticker SMTM.
Beispiel: Aktueller Stand des DAX
#!/usr/bin/perl use strict; use warnings; use Finance::YahooQuote; my $symbol = '^GDAXI'; my @quote = getonequote $symbol; # Get a quote for a single symbol if (scalar @quote) { print " 0 Symbol: $quote[0]\n"; print " 1 Company Name: $quote[1]\n"; print " 2 Last Price: $quote[2]\n"; print " 3 Last Trade Date: $quote[3]\n"; print " 4 Last Trade Time: $quote[4]\n"; print " 5 Change: $quote[5]\n"; print " 6 Percent Change: $quote[6]\n"; print " 7 Volume: $quote[7]\n"; print " 8 Average Daily Vol: $quote[8]\n"; print " 9 Bid: $quote[9]\n"; print "10 Ask: $quote[10]\n"; print "11 Previous Close: $quote[11]\n"; print "12 Today's Open: $quote[12]\n"; print "13 Day's Range: $quote[13]\n"; print "14 52-Week Range: $quote[14]\n"; print "15 Earnings per Share: $quote[15]\n"; print "16 P/E Ratio: $quote[16]\n"; print "17 Dividend Pay Date: $quote[17]\n"; print "18 Dividend per Share: $quote[18]\n"; print "19 Dividend Yield: $quote[19]\n"; print "20 Market Capitalization: $quote[20]\n"; print "21 Stock Exchange: $quote[21]\n"; } else { print "Ooops\n"; }
Das Programm erzeugt folgende Ausgabe:
0 Symbol: ^GDAXI 1 Company Name: DAX 2 Last Price: 5107.26 3 Last Trade Date: 6/11/2009 4 Last Trade Time: 11:45am 5 Change: +56.08 6 Percent Change: +1.11% 7 Volume: 0 8 Average Daily Vol: 0 9 Bid: N/A 10 Ask: N/A 11 Previous Close: 5051.18 12 Today's Open: 5039.97 13 Day's Range: 5038.03 - 5120.87 14 52-Week Range: 3588.89 - 6855.84 15 Earnings per Share: N/A 16 P/E Ratio: N/A 17 Dividend Pay Date: N/A 18 Dividend per Share: N/A 19 Dividend Yield: N/A 20 Market Capitalization: N/A 21 Stock Exchange: XETRA
Beispiel: Aktueller Kurs der adidas Aktie
Durch useExtendedQueryFormat können weitere Felder, wie Earnings per Share, ermittelt werden:
#!/usr/bin/perl use strict; use warnings; use Finance::YahooQuote; my $symbol = 'ADS.DE'; useExtendedQueryFormat(); my @quote = getonequote $symbol; # Get a quote for a single symbol if (scalar @quote) { print " 0 Symbol: $quote[0]\n"; print " 1 Company Name: $quote[1]\n"; print " 2 Last Price: $quote[2]\n"; print " 3 Last Trade Date: $quote[3]\n"; print " 4 Last Trade Time: $quote[4]\n"; print " 5 Change: $quote[5]\n"; print " 6 Percent Change: $quote[6]\n"; print " 7 Volume: $quote[7]\n"; print " 8 Average Daily Vol: $quote[8]\n"; print " 9 Bid: $quote[9]\n"; print "10 Ask: $quote[10]\n"; print "11 Previous Close: $quote[11]\n"; print "12 Today's Open: $quote[12]\n"; print "13 Day's Range: $quote[13]\n"; print "14 52-Week Range: $quote[14]\n"; print "15 Earnings per Share: $quote[15]\n"; print "16 P/E Ratio: $quote[16]\n"; print "17 Dividend Pay Date: $quote[17]\n"; print "18 Dividend per Share: $quote[18]\n"; print "19 Dividend Yield: $quote[19]\n"; print "20 Market Capitalization: $quote[20]\n"; print "21 Stock Exchange: $quote[21]\n"; print "22 Short ratio: $quote[22]\n"; print "23 1yr Target Price: $quote[23]\n"; print "24 EPS Est. Current Yr: $quote[24]\n"; print "25 EPS Est. Next Year: $quote[25]\n" ; print "26 EPS Est. Next Quarter: $quote[26]\n"; print "27 Price/EPS Est. Current Yr: $quote[27]\n"; print "28 Price/EPS Est. Next Yr: $quote[28]\n"; print "29 PEG Ratio: $quote[29]\n"; print "30 Book Value: $quote[30]\n"; print "31 Price/Book: $quote[31]\n"; print "32 Price/Sales: $quote[32]\n"; print "33 EBITDA: $quote[33]\n"; print "34 50-day Moving Avg: $quote[34]\n"; print "35 200-day Moving Avg: $quote[35]\n"; } else { print "Ooops\n"; }
Das Programm erzeugt folgende Ausgabe:
0 Symbol: ADS.DE 1 Company Name: ADIDAS 2 Last Price: 27.88 3 Last Trade Date: 6/11/2009 4 Last Trade Time: 11:35am 5 Change: +0.17 6 Percent Change: +0.61% 7 Volume: 1324113 8 Average Daily Vol: 1747360 9 Bid: 27.80 10 Ask: 27.84 11 Previous Close: 27.71 12 Today's Open: 27.59 13 Day's Range: 27.48 - 28.30 14 52-Week Range: 21.22 - 45.12 15 Earnings per Share: 0.00 16 P/E Ratio: N/A 17 Dividend Pay Date: N/A 18 Dividend per Share: 0.50 19 Dividend Yield: 1.80 20 Market Capitalization: N/A 21 Stock Exchange: XETRA 22 Short ratio: N/A 23 1yr Target Price: N/A 24 EPS Est. Current Yr: 0.00 25 EPS Est. Next Year: 0.00 26 EPS Est. Next Quarter: 0.00 27 Price/EPS Est. Current Yr: N/A 28 Price/EPS Est. Next Yr: N/A 29 PEG Ratio: N/A 30 Book Value: 0.00 31 Price/Book: N/A 32 Price/Sales: N/A 33 EBITDA: 0 34 50-day Moving Avg: 26.7369 35 200-day Moving Avg: 26.1586
Siehe auch
- CPAN: Finance::YahooQuote
- Dirk Eddelbuettel: Finance::YahooQuote
- Yahoo! Finance
- Yahoo! - Important Disclaimers and Legal Information
- Dirk Eddelbuettel: BeanCounter portfolio performance toolkit
- Dirk Eddelbuettel: SMTM Perl/Tk global stock ticker
Jetzt kommentieren