PrePAN

Sign in to PrePAN

Finance::IG This module comes with a script that lists out your spreadbets.

Author
TheDoktar@github
Date
URL
Status
In Review
Good

Synopsis

    #!/usr/bin/perl 
    use Finance::IG;
    use strict;
    use warnings;

    my $ig=Finance::IG->new( username=>..., password=>...,apikey=>i... ,  isdemo=>0 );

    my $p=$ig->positions();    #  Get a list of positions
    $p=$ig->agg($p); #  Aggregate them, so one item per instrument. 

    my $format="%-41sinstrumentName %+6.2fsize %-9.2flevel ".
            "%-9.2fbid £%-8.2fprofit %5.1fprofitpc%% £%10.2fatrisk\n";

    $ig->printpos("stdout" , "",$format); 

    for my $position (@$p)
    { 
        $ig-> printpos("stdout",$position,$format); 
    }
<p>
Typical output could look something like this: 

    Instrumentname                             Size  Level     Bid       Profit£  Profitpc %   Atrisk£
    AstraZeneca PLC                            +1.09 7665.84   8386.00   £784.97     9.4% £   9140.74
    ...

Description

The code above is the simplest code for printing out your spreadbet positions using an IG api key and login.

There is much more you can do, although the code is still in the early stages of development.

Other projects that could be done with the existing module include print out the diff to yesterdays prices that you squirrelled away, or even that IG supply. List your transactions, and a bunch of more advanced stuff.

The module comes with a fully developed version of the listing scipt that has a full command line interface.

I would really like to hear from anyone who is interested in this, who has suggestions as to what further api calls should be supported, and especially anyone who has successfully or unsuccessfully tried to use it.

I have not had the opportunity to test on a Windows machine, so feedback here would also be useful.

regards,

Mark

Comments

Please sign up to post a review.