Amibroker-OLE-Interface
view release on metacpan or search on metacpan
MYMETA.json view on Meta::CPAN
{
"abstract" : "A Simple Perl interface to OLE Automation framework of Amibroker Software.",
"author" : [
"Babu Prasad HP <bprasad@cpan.org>"
],
"dynamic_config" : 0,
"generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.143240",
"license" : [
"artistic_2"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
---
abstract: 'A Simple Perl interface to OLE Automation framework of Amibroker Software.'
author:
- 'Babu Prasad HP <bprasad@cpan.org>'
build_requires:
FindBin: '0'
Test::More: '1.001014'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.143240'
license: artistic_2
- $(RM_F) \
$(MAKEFILE_OLD) $(FIRST_MAKEFILE)
- $(RM_RF) \
$(DISTVNAME)
# --- MakeMaker metafile section:
metafile : create_distdir
$(NOECHO) $(ECHO) Generating META.yml
$(NOECHO) $(ECHO) --- > META_new.yml
$(NOECHO) $(ECHO) "abstract: 'A Simple Perl interface to OLE Automation framework of Amibroker Software.'" >> META_new.yml
$(NOECHO) $(ECHO) author: >> META_new.yml
$(NOECHO) $(ECHO) " - 'Babu Prasad HP <bprasad@cpan.org>'" >> META_new.yml
$(NOECHO) $(ECHO) build_requires: >> META_new.yml
$(NOECHO) $(ECHO) " FindBin: '0'" >> META_new.yml
$(NOECHO) $(ECHO) " Test::More: '1.001014'" >> META_new.yml
$(NOECHO) $(ECHO) configure_requires: >> META_new.yml
$(NOECHO) $(ECHO) " ExtUtils::MakeMaker: '0'" >> META_new.yml
$(NOECHO) $(ECHO) "dynamic_config: 1" >> META_new.yml
$(NOECHO) $(ECHO) "generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.143240'" >> META_new.yml
$(NOECHO) $(ECHO) "license: artistic_2" >> META_new.yml
$(NOECHO) $(ECHO) " File::Slurp: '9999.19'" >> META_new.yml
$(NOECHO) $(ECHO) " IO::File: '1.14'" >> META_new.yml
$(NOECHO) $(ECHO) " Path::Tiny: '0.061'" >> META_new.yml
$(NOECHO) $(ECHO) " Win32: '0.51'" >> META_new.yml
$(NOECHO) $(ECHO) " Win32::OLE: '0.1712'" >> META_new.yml
$(NOECHO) $(ECHO) " perl: '5.006'" >> META_new.yml
$(NOECHO) $(ECHO) "version: '0.03'" >> META_new.yml
-$(NOECHO) $(MV) META_new.yml $(DISTVNAME)/META.yml
$(NOECHO) $(ECHO) Generating META.json
$(NOECHO) $(ECHO) {{ > META_new.json
$(NOECHO) $(ECHO) " \"abstract\" : \"A Simple Perl interface to OLE Automation framework of Amibroker Software.\"," >> META_new.json
$(NOECHO) $(ECHO) " \"author\" : [" >> META_new.json
$(NOECHO) $(ECHO) " \"Babu Prasad HP ^<bprasad^@cpan.org^>\"" >> META_new.json
$(NOECHO) $(ECHO) " ]," >> META_new.json
$(NOECHO) $(ECHO) " \"dynamic_config\" : 1," >> META_new.json
$(NOECHO) $(ECHO) " \"generated_by\" : \"ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.143240\"," >> META_new.json
$(NOECHO) $(ECHO) " \"license\" : [" >> META_new.json
$(NOECHO) $(ECHO) " \"artistic_2\"" >> META_new.json
$(NOECHO) $(ECHO) " ]," >> META_new.json
$(NOECHO) $(ECHO) " \"meta-spec\" : {{" >> META_new.json
$(NOECHO) $(ECHO) " \"url\" : \"http://search.cpan.org/perldoc?CPAN::Meta::Spec\"," >> META_new.json
test_ : test_dynamic
test_static :: test_dynamic
testdb_static :: testdb_dynamic
# --- MakeMaker ppd section:
# Creates a PPD (Perl Package Description) for a binary distribution.
ppd :
$(NOECHO) $(ECHO) "<SOFTPKG NAME=\"$(DISTNAME)\" VERSION=\"$(VERSION)\">" > $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <ABSTRACT>A Simple Perl interface to OLE Automation framework of Amibroker Software.</ABSTRACT>" >> $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <AUTHOR>Babu Prasad HP <bprasad@cpan.org></AUTHOR>" >> $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <IMPLEMENTATION>" >> $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <PERLCORE VERSION=\"5,006,0,0\" />" >> $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <REQUIRE NAME=\"Carp::\" />" >> $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <REQUIRE NAME=\"File::Slurp\" VERSION=\"9999.19\" />" >> $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <REQUIRE NAME=\"IO::File\" VERSION=\"1.14\" />" >> $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <REQUIRE NAME=\"Path::Tiny\" VERSION=\"0.061\" />" >> $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <REQUIRE NAME=\"Win32::\" VERSION=\"0.51\" />" >> $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <REQUIRE NAME=\"Win32::OLE\" VERSION=\"0.1712\" />" >> $(DISTNAME).ppd
$(NOECHO) $(ECHO) " <ARCHITECTURE NAME=\"MSWin32-x64-multi-thread-5.20\" />" >> $(DISTNAME).ppd
NAME
Amibroker::OLE::Interface - A Simple Perl interface to OLE Automation framework of Amibroker Software.
REREQUISITE
Prerequisite to use this module : You need to have Amibroker v.5 and above (32-bit or 64-bit) installed in your system.
DESCRIPTION
If you are new to amibroker, then visit this site : https://www.amibroker.com/
Amibroker has provided OLE, to interact with Amibroker engine from external scripts/programs.
You can refer to the AmiBroker's OLE Automation Object Model guide: https://www.amibroker.com/guide/objects.html
This module will help programmers who use Amibroker to access the objects easily in perl.
apx_file => 'C:/amibroker/apx/path/nifty.apx',
result_file => 'C:/amibroker/result/path/report.csv'} );
$obj->shutdown_amibroker_engine();
For Creating apx file then use below module
use Amibroker::OLE::APXCreator;
my $new_apx_file = create_apx_file( {
afl_file => 'test_afl.afl',
symbol => 'ADANIPORTS-I',
timeframe => '20-minute',
from => '01-09-2015',
to => '20-09-2015',
range_type => 0,
apply_to => 1
} );
SUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the perldoc command.
perldoc Amibroker::OLE::Interface
perldoc Amibroker::OLE::APXCreator
lib/Amibroker/OLE/APXCreator.pm view on Meta::CPAN
=cut
our $VERSION = '0.03';
=head1 SYNOPSIS
use Amibroker::OLE::APXCreator;
my $new_apx_file = create_apx_file( {
afl_file => 'test_afl.afl',
symbol => 'ADANIPORTS-I',
timeframe => '20-minute',
from => '01-09-2015',
to => '20-09-2015',
range_type => 0,
apply_to => 1
} );
=head1 DESCRIPTION
This module helps in creating apx file (i.e. file with .apx extention), which is the basic input file for running Amibroker analysis externally through OLE automation.
Creating this file automatically is a challenge as Amibroker is very sensitive to any changes with respect to apx file.
If there is even a space missed in creating it, then it will not process it.
So, to make life easier, this module handles the creation of the file as required by the amibroker.
NOTE: Please ensure to provide all the required necessary fields.
use Amibroker::OLE::APXCreator;
my $new_apx_file = create_apx_file( {
afl_file => 'path_to_the_location_of_the_afl_file',
symbol => 'symbol_name',
timeframe => 'timeframe',
from => 'from_date',
to => 'to_date',
range_type => range_type_in_number,
apply_to => apply_to_in_number
} );
=head2 REQUIRED PARAMETERS
=over 8
lib/Amibroker/OLE/APXCreator.pm view on Meta::CPAN
Complete Path to the AFL file, that you need to backtest or optimize or scan etc.
Eg: afl_file => 'C:/Amibroker/Stratergy/Release/IBM.afl'
=item B<symbol>
The Symbol name should match with the symbol names in the Amibroker database
Eg: symbol => 'IBM-I' or
symbol => 'IBM'
(The name should exactly match with your database symbol)
=item B<timeframe>
Default available timeframe with Amibroker.
yearly
quarterly
monthly
weekly
daily
day/night
hourly
15-minute
5-minute
1-minute
3-minute
7-minute
10-minute
12-minute
20-minute
If you want to have your custom defined timeframe then you need to update here
Amibroker -> Tools -> Preferences -> Intraday Tab -> Custom Time Intervals
=item B<from>
from date, Eg: from => '01-12-2010' (for 1st December 2010 date)
from => '2010-12-01' (for 1st December 2010 date)
from => '2010-01-12' (for 1st December 2010 date)
from => '12-01-2010' (for 1st December 2010 date)
from => '12-2010-01' (for 1st December 2010 date)
Date format should match your Amibroker date format : Usually it is windows system time settings
lib/Amibroker/OLE/APXCreator.pm view on Meta::CPAN
'3-minute' => 10,
'7-minute' => 11,
'10-minute' => 12,
'12-minute' => 13,
'20-minute' => 14
);
sub create_apx_file {
my @list = @_;
my $args = _check_valid_args(@list);
if ( !$args->{timeframe} ) {
croak( '[ERROR}: No timeframe passed (Required parameter) : ' . "\n" );
}
if ( !$args->{periodicity} ) {
$args->{periodicity} = lc( $args->{timeframe} );
}
if ( !$args->{periodicity} ) {
croak( '[ERROR}: No periodicity found for given timeframe '
. $args->{timeframe}
. "\n" );
}
if ( !-e $args->{afl_file} ) {
croak( '[ERROR}: AFL file not present at:' . $args->{afl_file} . "\n" );
}
if ( !$args->{symbol} ) {
croak( '[ERROR}: Symbol name not passed (Required parameter):' . "\n" );
}
if ( !$args->{from} ) {
croak(
lib/Amibroker/OLE/APXCreator.pm view on Meta::CPAN
}
return $text;
}
sub _check_valid_args {
my @list = @_;
my %args_permitted = map { $_ => 1 } (
qw|
afl_file
symbol
timeframe
from
to
apx_file
periodicity
apply_to
range_type
|
);
my @bad_args = ();
my $arg = pop @list;
lib/Amibroker/OLE/Interface.pm view on Meta::CPAN
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
lib/Amibroker/OLE/Interface.pm view on Meta::CPAN
$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()
t/APXCreator.t view on Meta::CPAN
use Test::More;
use FindBin;
use lib "$FindBin::Bin/../lib";
BEGIN { use_ok('Amibroker::OLE::APXCreator'); }
my $new_apx_file = Amibroker::OLE::APXCreator::create_apx_file(
{
afl_file => "$FindBin::Bin/test_afl.afl",
symbol => 'ADANIPORTS-I',
timeframe => '20-minute',
from => '01-09-2015',
to => '20-09-2015',
range_type => 0,
apply_to => 1
}
);
is( $new_apx_file, 'C:/ADANIPORTS-I.apx', 'apx file created' );
eval {
my $new_apx_file1 = Amibroker::OLE::APXCreator::create_apx_file(
{
( run in 0.594 second using v1.01-cache-2.11-cpan-df04353d9ac )