The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::idxdb - Import data for stocks on the IDX (Indonesian Stock Exchange) and perform queries on them

VERSION

This document describes version 0.008 of App::idxdb (from Perl distribution App-idxdb), released on 2021-06-21.

SYNOPSIS

See the included CLI script idxdb.

DESCRIPTION

CONTRIBUTOR

perlancar (on netbook-dell-xps13) <perlancar@gmail.com>

FUNCTIONS

daily

Usage:

 daily(%args) -> [$status_code, $reason, $payload, \%result_meta]

Show data from daily stock/trading summary.

This function is not exported.

Arguments ('*' denotes required arguments):

  • date_end => date (default: 1624208400)

  • date_start => date (default: 1621616400)

  • fields => array[str] (default: ["Volume","Value","ForeignNetBuy"])

  • graph => bool

    Show graph instead of table.

  • stocks* => array[idx::listed_stock_code]

  • total => bool

Returns an enveloped result (an array).

First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.

Return value: (any)

ownership

Usage:

 ownership(%args) -> [$status_code, $reason, $payload, \%result_meta]

Show ownership of some stock through time.

Examples:

  • Show legends instead (e.g. ForeignIB = foreign bank, etc):

     ownership(legend => 1); # -> [400, "Missing required argument: stock", undef, {}]

This function is not exported.

Arguments ('*' denotes required arguments):

  • date_end => date (default: 1624208400)

  • date_start => date (default: 1621616400)

  • fields => array[str] (default: ["LocalTotal","ForeignTotal"])

  • graph => bool

    Show graph instead of table.

  • legend => bool

    Show legend of ownership instead (e.g. ForeignIB = foreign bank, etc).

  • stock* => idx::listed_stock_code

Returns an enveloped result (an array).

First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.

Return value: (any)

stocks_by_foreign_ownership

Usage:

 stocks_by_foreign_ownership(%args) -> [$status_code, $reason, $payload, \%result_meta]

Rank stocks from highest foreign ownership.

This function is not exported.

Arguments ('*' denotes required arguments):

  • dbpath => str

    Path for SQLite database.

    If not specified, will default to ~/idxdb.db.

Returns an enveloped result (an array).

First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.

Return value: (any)

update

Usage:

 update(%args) -> [$status_code, $reason, $payload, \%result_meta]

Update data.

Currently this routine imports from text files in the gudangdata repository on the local filesystem. Functionality to import from server directly using Finance::SE::IDX and Finance::ID::KSEI will be added in the future.

This function is not exported.

Arguments ('*' denotes required arguments):

  • dbpath => str

    Path for SQLite database.

    If not specified, will default to ~/idxdb.db.

  • gudangdata_path* => dirname

Returns an enveloped result (an array).

First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.

Return value: (any)

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-idxdb.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-idxdb.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-idxdb

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by perlancar@cpan.org.

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