NAME

Rmg::OddsConverter

SYNOPSIS

my $oc = Rmg::OddsConverter->new(probability => 0.5);
print $oc->decimal;    # '2.00' (always to 2 decimal places)
print $oc->roi;             # '100%' (always whole numbers or 'Inf.')


Or use the bash

Example:

highroller AAPL GOOG

METHODS

new()

Instanciate a new Rmg::OddsConverter object a parameter is needed to start the conversion.

List of possible parameters:
monte
decimal
roi
probability
fractional
win_break

Example:

my $oc = Rmg::OddsConverter->new( probability => 0.5 );
monte

Without parameter, return the monte ( return on investment ) for the object instantiate with the parameter from the method new()

Example:

print $oc->monte . "\n";

With a parameter, re-initialise the object instance with that monte value and return the new monte value.

Example:

print $oc->monte( 50 ) . "\n";
decimal

Without parameter, return the decimal odds for the object instantiate with the parameter from the method new()

Example:

print $oc->decimal . "\n";

With a parameter, re-initialise the object instance with that decimal value and return the new decimal odds value.

Example:

print $oc->decimal( 3 ) . "\n";
roi

Without parameter, return the roi ( return on investment ) for the object instantiate with the parameter from the method new()

Example:

print $oc->roi . "\n";

With a parameter, re-initialise the object instance with that roi value and return the new roi value.

Example:

print $oc->roi( 50 ) . "\n";
fractional

Without parameter, return the fractional odds for the object instantiate with the parameter from the method new()

Example:

print $oc->fractional . "\n";

With a parameter, re-initialise the object instance with that fractional odds value and return the new fractional odds value

Example:

print $oc->fractional( 50 ) . "\n";
win_break

Without parameter, return the win to break even odds for the object instantiate with the parameter from the method new()

Example:

print $oc->win_break . "\n";

With a parameter, re-initialise the object instance with that win_break odds value and return the new win to break odds value

Example:

print $oc->win_break( 90 ) . "\n";
probability

Without parameter, return the probability odds for the object instantiate with the parameter from the method new()

Example:

print $oc->probability . "\n";

With a parameter, re-initialise the object instance with that probability odds value and return the new win to probability odds value

Example:

print $oc->probability( 90 ) . "\n";
moneyline

Without parameter, return the moneyline odds for the object instantiate with the parameter from the method new()

Example:

print $oc->moneyline . "\n";

With a parameter, re-initialise the object instance with that moneyline odds value and return the new win to moneyline odds value

Example:

print $oc->moneyline( 90 ) . "\n";

EXAMPLE

#!/usr/bin/perl

use strict;
use feature qw( say );
use Data::Dumper;
use Finance::YahooQuote;
use Rmg::OddsConverter;

push @ARGV,"AAPL" unless($ARGV[0]);


my $p = rand(1);
my $m = 0;
my $oc = undef;
say "@"x30;

foreach(@ARGV){

  my $cmd = 'yahooquote --verbose '.$_.' | egrep -i "(^LAST:|^52)" | '.
            'tr -d " " | sed "s/52-WeekRange://" | sed "s/Last://"| tr "-" " "';
  my @highroller = split("\n| ",`$cmd`);

  $oc = Rmg::OddsConverter->new( probability => $p );

  say sprintf("%s %s %s","@"x10,"rand prop 0..1","@"x10);
  say "Contract:".$_;
  say "Last:$highroller[0]";
  say "rand(1) = $p";
  say "decimal=" . $oc->decimal;
  say "fractional=" . $oc->fractional;
  say "probability=" . $oc->probability;
  say "roi=" . $oc->roi;
  say "monte=".$oc->monte($p,$_);
  say "\n"x3;

  say sprintf("%s %s %s","@"x10,"LAST - 52WeekLow","@"x10);
  $m = $highroller[0]-$highroller[1];
  say "new from (LAST - 52WeekLow) ($m)\$";
  say "decimal=" . $oc->decimal;
  say "fractional=" . $oc->fractional;
  say "probability=" . $oc->probability;
  say "roi=" . $oc->roi;
  say  "monte=".$oc->monte($m,$_);

}



BEGIN{
    printf "%s", "\n"x3;


}
1;

AUTHOR

Hagen Geissler <santex@cpan.org>

May 2013

LICENSE

Under the GNU GPL2

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program;
if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Rmg::OddsConverter   Copyright (C) 2013 Hagen Geissler.  Rmg::OddsConverter comes with ABSOLUTELY NO WARRANTY;
for details See: L<http://www.gnu.org/licenses/gpl.html>
This is free software, and you are welcome to redistribute it under certain conditions;