App-idxdb

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.004   2021-01-22  Released-By: PERLANCAR; Urgency: medium

	[Incompatible changes]

        - [reorganize] Reorganize the various *ownership* and *daily*
	  subcommands to ownership & daily. This means merging the graph-* and
	  table-* subcommands. User can now produce graphs by specifying
	  --graph.

        - [reorganize] Merge ownership-legends subcommand to ownership.

        [Enhancements]

        - [subcommand daily] Accept multiple stocks.

        [UX]

	- Add alias --1week for --week, --1month for --month, --1year for
	  --year; add period shortcut --ytd.

Changes  view on Meta::CPAN

          updated data.

        - Tweak graphs (tic label rotation, better colors using
          ColorTheme::Distinct::WhiteBG)

        - Accept natural dates for --date-* options.

        - Add --week, --month, --3month, --6month, --year, --3year, --5year,
          --10year shortcuts for --date-start + --date-end.

	- Add example for legend_ownership().


0.002   2021-01-19  Released-By: PERLANCAR; Urgency: low

	- No functional changes.

	- Tweak Abstract.


0.001   2021-01-18  Released-By: PERLANCAR

README  view on Meta::CPAN


  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

lib/App/idxdb.pm  view on Meta::CPAN

    [200];
}

$SPEC{ownership} = {
    v => 1.1,
    summary => 'Show ownership of some stock through time',
    args => {
        %arg0_stock,
        %argsopt_filter_date,
        %argopt_fields_ownership,
        legend => {
            summary => 'Show legend of ownership instead (e.g. ForeignIB = foreign bank, etc)',
            schema => 'bool*',
            tags => ['category:action'],
        },
        %argopt_graph,
    },
    examples => [
        {
            summary => 'Show legends instead (e.g. ForeignIB = foreign bank, etc)',
            args => {legend=>1},
            test => 0,
        },
    ],
};
sub ownership {
    my %args = @_;
    my $stock = $args{stock};
    my $fields = $args{fields};

    my $state = _init(\%args, 'ro');
    my $dbh = $state->{dbh};

    if ($args{legend}) {
        return [200, "OK", \%ownership_fields];
    }

    my @wheres;
    my @binds;
    push @wheres, "Code=?";
    push @binds, $stock;
    if ($args{date_start}) {
        push @wheres, "date >= '".$args{date_start}->ymd."'";
    }

lib/App/idxdb.pm  view on Meta::CPAN

Usage:

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

Show ownership of some stock through time.

Examples:

=over

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

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

=back

This function is not exported.

Arguments ('*' denotes required arguments):

=over 4

=item * B<date_end> => I<date> (default: 1624208400)

=item * B<date_start> => I<date> (default: 1621616400)

=item * B<fields> => I<array[str]> (default: ["LocalTotal","ForeignTotal"])

=item * B<graph> => I<bool>

Show graph instead of table.

=item * B<legend> => I<bool>

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

=item * B<stock>* => I<idx::listed_stock_code>


=back

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

script/idxdb  view on Meta::CPAN

=head1 VERSION

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

=head1 SYNOPSIS

To update data:

 % idxdb update

To see the legends for ownership field names (e.g. ForeignIB = foreign bank):

 % idxdb ownership --legend

To see ownership (e.g. % foreign/local) of some stock through time:

 % idxdb ownership BBRI
 % idxdb ownership --fields-all BBRI --date-start 2020-01-01 --date-end 2020-09-30
 % idxdb ownership --fields-foreign-total --6month --graph BBNI

To graph ownership composition (% foreign bank, foreign total, local bank, etc)
of some stock:

script/idxdb  view on Meta::CPAN

=item B<--fields-local>

Alias for --field.

See C<--field>.

=item B<--graph>, B<-g>

Show graph instead of table.

=item B<--legend>

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

=item B<--month>

Alias for --date-start.

See C<--date-start>.

=item B<--stock>=I<s>*

Can also be specified as the 1st command-line argument.

script/idxdb  view on Meta::CPAN

 graph (see --graph)
 stocks (see --stock)
 total (see --total)

=head2 Configuration for subcommand ownership

 date_end (see --date-end)
 date_start (see --date-start)
 fields (see --field)
 graph (see --graph)
 legend (see --legend)
 stock (see --stock)

=head2 Configuration for subcommand stocks-by-foreign-ownership


=head2 Configuration for subcommand update

 gudangdata_path (see --gudangdata-path)

=head1 ENVIRONMENT



( run in 1.178 second using v1.01-cache-2.11-cpan-49f99fa48dc )