Difference between revisions of "TF StksRes"
Jump to navigation
Jump to search
(→FoxPro) |
|||
| Line 6: | Line 6: | ||
Demo Service : FxPro.com-Demo3 | Demo Service : FxPro.com-Demo3 | ||
[[User:Foretony]] | [[User:Foretony]] | ||
| + | |||
| + | |||
| + | =Perl query= | ||
| + | |||
| + | Make sure perl has the Finance::Quote module by using the following commands | ||
| + | |||
| + | shell> perl -MCPAN -e shell | ||
| + | cpan> install Finance::Quote | ||
| + | |||
| + | Finance::Quote depends on three other packages: LWP::UserAgent, HTTP::Request::Common, and HTML::TableExtractor. If yours is a relatively recent Perl installation, you'll probably already have the first two; you can download the third | ||
| + | |||
| + | sample perl script | ||
| + | |||
| + | <pre> | ||
| + | #!/usr/bin/perl | ||
| + | |||
| + | # import module | ||
| + | use Finance::Quote; | ||
| + | |||
| + | # create object | ||
| + | my $q = Finance::Quote->new(); | ||
| + | |||
| + | # retrieve stock quote | ||
| + | my %data = $q->fetch('nyse', 'XYZ'); | ||
| + | |||
| + | # print price | ||
| + | print "The current price of XYZ on the NYSE is " . $data{'XYZ', 'price'}; | ||
| + | |||
| + | </pre> | ||
Latest revision as of 02:32, 17 November 2013
FoxPro
MT4 login: 5149150
Demo Service : FxPro.com-Demo3 User:Foretony
Perl query
Make sure perl has the Finance::Quote module by using the following commands
shell> perl -MCPAN -e shell cpan> install Finance::Quote
Finance::Quote depends on three other packages: LWP::UserAgent, HTTP::Request::Common, and HTML::TableExtractor. If yours is a relatively recent Perl installation, you'll probably already have the first two; you can download the third
sample perl script
#!/usr/bin/perl
# import module
use Finance::Quote;
# create object
my $q = Finance::Quote->new();
# retrieve stock quote
my %data = $q->fetch('nyse', 'XYZ');
# print price
print "The current price of XYZ on the NYSE is " . $data{'XYZ', 'price'};