Chia-liang Kao (高嘉良) > Finance-FITF-0.31 > Finance::FITF::Writer

Download:
Finance-FITF-0.31.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

Finance::FITF::Writer - Fast Intraday Transaction Format Writer

SYNOPSIS ^

  use Finance::FITF;
  my $fh;
  my $writer = Finance::FITF::Writer->new(
    fh => $fh,
    header => {
        name => 'XTAF.TX',
        date => '20101119',
        time_zone => 'Asia/Taipei',
        bar_seconds => 10,
    },
  );

  # add session: from 08:45 to 13:45
  $writer->add_session( 525 * 60, 825 * 60 );

  # $writer->push_price( $timestamp, $price, $volume);
  # ...
  $writer->end;

DESCRIPTION ^

Finance::FITF::Writer is a helper class to create FITF-formatted files.

METHODS

Finance::FITF::Writer->new( fh => $fh, header => { .... } )
$self->add_session($start, $end)

Add a session to the file. $start and $end are seconds relative to midnight of the trading day defined by the header.

$self->push_price( $timestamp, $price, $volume );

Add a trade transaction record.

$self->push_bar( $timestamp, $price, $volume );

You should not call this unless you are writing a bar-only file.

$self->end

Call end when you are done.

AUTHOR ^

Chia-liang Kao <clkao@clkao.org>

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

syntax highlighting: