| 1 | package Finance::CoinbasePro::API::CLI::Trade; | ||
| 2 | # this knows about Finance::GDAX::Fill objects and can display them | ||
| 3 | 1 | ▶ | use Mouse; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use Finance::CoinbasePro::API::CLI::Util::DateUtil qw(my_str2time); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Data::Dump; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | ▶ | use Finance::CoinbasePro::API::CLI::Value; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use Finance::CoinbasePro::API::CLI::Util::DateUtil qw(convert_seconds_to_human_time); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | has 'price' => (is=>'rw', isa=>'Num', required=>1); #price => "6235.00000000", | |
| 11 | 1 | has 'side' => (is=>'rw', isa=>'Str', required=>1); #side => "sell", | |
| 12 | 1 | has 'size' => (is=>'rw', isa=>'Num', required=>1); #size => "0.001", | |
| 13 | 1 | has 'time' => (is=>'rw', isa=>'Str', required=>1); # time => "2018-10-15T14:15:29.597Z", | |
| 14 | 1 | has 'trade_id' => (is=>'rw', isa=>'Int', required=>1); # trade_id => 2164597, | |
| 15 | |||
| 16 | # returns a string | ||
| 17 | sub to_str { | ||
| 18 | 1 | ▶ | my $self = shift; |
|
Subroutine
to_str: called CC=1 SCAR=0.0
Pod
documented
| |||
| 19 | #return Data::Dump::dump($self); | ||
| 20 | 1 | return "Trade: $self->{time}: $self->{side} $self->{size} units at $self->{price}: trade_id $self->{trade_id}"; | |
| 21 | } | ||
| 22 | sub ago { | ||
| 23 | 0 | ▶ | my $date = shift; |
|
Subroutine
ago: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 24 | 0 | return convert_seconds_to_human_time( time() - my_str2time( $date ) ) . " ago"; | |
| 25 | } | ||
| 26 | |||
| 27 | 1 | 1; | |
| 28 | |||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | #################### pod generated by Pod::Autopod - keep this line to make pod updates possible #################### | ||
| 33 | |||
| 34 | =head1 NAME | ||
| 35 | |||
| 36 | Finance::CoinbasePro::API::CLI::Trade - CoinbasePro Trade Object | ||
| 37 | |||
| 38 | |||
| 39 | =head1 DESCRIPTION | ||
| 40 | |||
| 41 | this knows about Finance::GDAX::Fill objects and can display them | ||
| 42 | |||
| 43 | |||
| 44 | =head1 REQUIRES | ||
| 45 | |||
| 46 | L<Finance::CoinbasePro::API::CLI::Util::DateUtil> | ||
| 47 | |||
| 48 | L<Finance::CoinbasePro::API::CLI::Value> | ||
| 49 | |||
| 50 | L<Data::Dump> | ||
| 51 | |||
| 52 | L<Finance::CoinbasePro::API::CLI::Util::DateUtil> | ||
| 53 | |||
| 54 | L<Mouse> | ||
| 55 | |||
| 56 | |||
| 57 | =head1 METHODS | ||
| 58 | |||
| 59 | =head2 ago | ||
| 60 | |||
| 61 | ago(); | ||
| 62 | |||
| 63 | =head2 to_str | ||
| 64 | |||
| 65 | to_str(); | ||
| 66 | |||
| 67 | returns a string | ||
| 68 | |||
| 69 | =cut | ||
| 70 | |||