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   129 use strictures 2;
  17         123  
  17         685  
3 17     17   3426 use feature 'signatures';
  17         35  
  17         1225  
4 17     17   101 no warnings 'experimental::signatures';
  17         31  
  17         770  
5             #
6 17     17   97 use Type::Library 0.008 -base, -declare => qw[Order];
  17         301  
  17         109  
7 17     17   7333 use Type::Utils;
  17         34  
  17         106  
8 17     17   25645 use Types::Standard qw[ArrayRef Bool Enum InstanceOf Int Maybe Num Ref Str];
  17         39  
  17         123  
9 17     17   31116 use Types::TypeTiny 0.004 StringLike => { -as => "Stringable" };
  17         329  
  17         123  
10             class_type Order, { class => __PACKAGE__ };
11             coerce( Order, from Ref() => __PACKAGE__ . q[->new($_)] );
12             #
13 17     17   6126 use Moo;
  17         41  
  17         116  
14 17     17   6128 use Types::UUID;
  17         37  
  17         126  
15 17     17   6402 use lib './lib';
  17         43  
  17         106  
16 17     17   2861 use Finance::Alpaca::Types;
  17         34  
  17         127  
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__