NAME

Business::WebMoney::Exchanger - Perl API to WebMoney Exchanger

SYNOPSIS

use Business::WebMoney::Exchanger;

my $wmex = Business::WebMoney::Exchanger->new;
my $best_rates = $wmex->best_rates;

print $best_rates->{WMZ}->{WMR}->{rate} . "\n";

DESCRIPTION

Business::WebMoney::Exchanges provides simple API to the WebMoney Exchanger system. Currently it provides an interface to the stock rates of WebMoney currencies.

METHODS

Constructor

my $wmex = Business::WebMoney::Exchanger->new(
  timeout => 30,			# Request timeout in seconds (optional, default 20)
);

best_rates - interface to query current exchange rates

my $rates = $wmex->best_rates;

On error returns undef ($wmex->errcode and $wmex->errstr are set to the error code and description accordingly). On success returns reference to the following structure:

  {
    WMZ => {
      WMR => {
        rate => 27.5199,	# exchange rate WMZ->WMR defined by Central Bank of Russia or National Bank of Ukraine
				# (or corresponding cross-rates)
	0.1 => 0,		# amount of WMZ you can buy for WMR with rate better than 27.5474 (= 27.5199 + 0.1%)
	0.2 => 79572.31,	# amount of WMZ you can buy for WMR with rate better than 27.5749 (= 27.5199 + 0.2%)
	...
	10 => 378769.89,	# amount of WMZ you can buy for WMR with rate better than 30.2718 (= 27.5199 + 10%)
	exchtype => 1,		# ID of the exchange direction (used in further interfaces)
      },
      ...
    },
    ...
  }

Available rate ranges: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 5, 10.

ENVIRONMENT

  • http_proxy - proxy support, http://host_or_ip:port

SEE ALSO

http://wm.exchanger.ru/asp/rules_xml.asp - WebMoney Exchanger API specification (in Russian only)

AUTHOR

Alexander Lourier, <aml@rulezz.ru>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Alexander Lourier

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.