Amibroker-OLE-Interface

 view release on metacpan or  search on metacpan

lib/Amibroker/OLE/Interface.pm  view on Meta::CPAN

package Amibroker::OLE::Interface;

use 5.006;
use strict;
use warnings;
use Win32::OLE;
use Win32;
use Carp;

=head1 NAME

Amibroker::OLE::Interface - A Simple Perl interface to OLE Automation framework of Amibroker Software.

=head1 VERSION

Version 0.02

=cut

our $VERSION = '0.03';

=head1 SYNOPSIS

    use Amibroker::OLE::Interface;
    my $obj = Amibroker::OLE::Interface->new( { verbose => 1, 
                                                dbpath => "C:/amibroker/dbpath"
                                            } );
    $obj->start_amibroker_engine();
    $obj->run_analysis( { action => 2,
                          symbol => 'NIFTY-I', 
                          apx_file => 'C:/amibroker/apx/path/nifty.apx', 
                          result_file => 'C:/amibroker/result/path/report.csv'} );
    $obj->shutdown_amibroker_engine();

=head1 DESCRIPTION

Amibroker is one of the most used Automated trading and charting software in the world. 
Visit Amibroker website for information : L<https://www.amibroker.com/> 
Amibroker has provided OLE Automation framework, to interact with Amibroker engine from external scripts/programs.
You can refer to the AmiBroker's OLE Automation Object Model guide: L<https://www.amibroker.com/guide/objects.html>

This module will help programmers who use Amibroker to access the objects easily in perl. 

=head1 PREREQUISITE

Prerequisite to use this module : You need to have Amibroker v.5 and above (32-bit or 64-bit) installed in your system.

=head2 new()

Constructor to create the object for interacting with Amibroker engine.
The new() class method starts a new instance of an Amibroker OLE Interface object. It returns a reference to this object or undef if the creation failed.

    Eg: Amibroker::OLE::Interface->new()

=over 1

=item B<Parameters to the constructor>

=back

=over 2

=item * Verbose is optional

=item * dbpath  is compulsory - dbpath should be valid Amibroker database path.
For how to create database, please check here : L<https://www.amibroker.com/guide/w_dbsettings.html>

    Code Example
	$obj = Amibroker::OLE::Interface->new( verbose => 1, dbpath => "C:/amibroker/dbpath");

=back

=cut

sub new {
    my @list  = @_;
    my $class = shift @list;
    push @list, {} unless @list and _is_arg( $list[-1] );
    my $self = _check_valid_args(@list);
    croak("No Database path supplied to Amibroker : $!\n")
      unless $self->{dbpath};
    croak("Invalid Database path to Amibroker : $!\n")
      unless -d $self->{dbpath};

    bless $self, $class if defined $self;
    return $self;
}

=head2 start_amibroker_engine()

Starts the Amibroker Engine and Loads the database

Code Example

    $obj->start_amibroker_engine();

=cut

sub start_amibroker_engine {



( run in 0.781 second using v1.01-cache-2.11-cpan-e1769b4cff6 )