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 17     17   110 use strictures 2;
  17         124  
  17         659  
3 17     17   3316 use feature 'signatures';
  17         31  
  17         1201  
4 17     17   85 no warnings 'experimental::signatures';
  17         24  
  17         694  
5             #
6 17     17   79 use Type::Library 0.008 -base, -declare => qw[Order];
  17         301  
  17         93  
7 17     17   6362 use Type::Utils;
  17         29  
  17         95  
8 17     17   21731 use Types::Standard qw[ArrayRef Bool Enum InstanceOf Int Maybe Num Ref Str];
  17         33  
  17         128  
9 17     17   25802 use Types::TypeTiny 0.004 StringLike => { -as => "Stringable" };
  17         362  
  17         106  
10             class_type Order, { class => __PACKAGE__ };
11             coerce( Order, from Ref() => __PACKAGE__ . q[->new($_)] );
12             #
13 17     17   5376 use Moo;
  17         34  
  17         129  
14 17     17   5612 use Types::UUID;
  17         30  
  17         122  
15 17     17   5325 use lib './lib';
  17         34  
  17         112  
16 17     17   2833 use Finance::Alpaca::Types;
  17         34  
  17         117  
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__