File Coverage

lib/Finance/Alpaca/Struct/Order.pm
Criterion Covered Total %
statement 33 33 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod n/a
total 44 44 100.0


line stmt bran cond sub pod time code
1             package Finance::Alpaca::Struct::Order 0.9902 {
2 1     1   8 use strictures 2;
  1         6  
  1         39  
3 1     1   179 use feature 'signatures';
  1         2  
  1         62  
4 1     1   5 no warnings 'experimental::signatures';
  1         2  
  1         41  
5             #
6 1     1   5 use Type::Library 0.008 -base, -declare => qw[Order];
  1         15  
  1         7  
7 1     1   403 use Type::Utils;
  1         3  
  1         6  
8 1     1   1504 use Types::Standard qw[ArrayRef Bool Enum InstanceOf Int Maybe Num Ref Str];
  1         3  
  1         6  
9 1     1   1782 use Types::TypeTiny 0.004 StringLike => { -as => "Stringable" };
  1         16  
  1         7  
10             class_type Order, { class => __PACKAGE__ };
11             coerce( Order, from Ref() => __PACKAGE__ . q[->new($_)] );
12             #
13 1     1   349 use Moo;
  1         2  
  1         5  
14 1     1   333 use Types::UUID;
  1         2  
  1         6  
15 1     1   377 use lib './lib';
  1         2  
  1         6  
16 1     1   159 use Finance::Alpaca::Types;
  1         1  
  1         7  
17             has [qw[id asset_id]] => ( is => 'ro', isa => Uuid, required => 1 );
18             has client_order_id => ( is => 'ro', isa => Str, required => 1 );
19             has created_at => ( is => 'ro', isa => Timestamp, required => 1, coerce => 1 );
20             has [qw[updated_at submitted_at filled_at expired_at canceled_at failed_at replaced_at]] =>
21             ( is => 'ro', isa => Maybe [Timestamp], predicate => 1, coerce => 1 );
22             has [qw[replaced_by replaces]] => ( is => 'ro', isa => Maybe [Uuid], predicate => 1 );
23             has [qw[symbol asset_class]] => ( is => 'ro', isa => Str, required => 1 ); # If from stream
24             has [qw[notional qty filled_avg_price limit_price stop_price trail_percent trail_price hwm]] =>
25             ( is => 'ro', isa => Maybe [Num], predicate => 1 );
26             has filled_qty => ( is => 'ro', isa => Num, required => 1 );
27             has order_class =>
28             ( is => 'ro', isa => Enum [ '', qw[simple bracket oco oto] ], required => 1 );
29             has type =>
30             ( is => 'ro', isa => Enum [qw[market limit stop stop_limit trailing_stop]], required => 1 );
31             has side => ( is => 'ro', isa => Enum [qw[buy sell]], required => 1 );
32             has time_in_force => ( is => 'ro', isa => Enum [qw[day gtc opg cls ioc fok]], required => 1 );
33             has status => (
34             is => 'ro',
35             isa => Enum [
36             qw[new partially_filled filled done_for_day canceled expired replaced pending_cancel pending_replace accepted pending_new accepted_for_bidding stopped rejected suspended calculated held]
37             ],
38             required => 1
39             );
40             has extended_hours => ( is => 'ro', isa => Bool, required => 1, coerce => 1 );
41             has legs => ( is => 'ro', isa => Maybe [ ArrayRef [Order] ], coerce => 1 );
42             }
43             1;
44             __END__