Framework/Exchange.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 54 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BUILDARGS
2.0
BEGIN
2.0
CRAP 2.0
1 package Quant::Framework::Exchange;
2  
3 use Moose;
4 use Carp qw(croak);
5 use Date::Utility;
6 use List::Util qw(first);
7 use List::MoreUtils qw(uniq);
8 use Clone qw(clone);
9 use File::ShareDir;
10 use YAML::XS qw(LoadFile);
11  
12 =head1 NAME
13  
14 Quant::Framework::Exchange - A module to save/load exchange information
15  
16 =head1 DESCRIPTION
17  
18 This module saves/loads holidays to/from Chronicle.
19  
20 =cut
21  
22 has symbol => (
23 is => 'ro',
24 required => 1,
25 );
26  
27 has [qw(
28 pretty_name
29 offered
30 )
31 ] => (
32 is => 'ro',
33 isa => 'Str',
34 );
35  
36 has delay_amount => (
37 is => 'ro',
38 isa => 'Num',
39 default => 60,
40 );
41  
42 =head2 currency
43  
44 Exchange's main currency.
45  
46 =cut
47  
48 has currency => (
49 is => 'ro',
50 );
51  
52 =head2 display_name
53  
54 A name we can show to someone someday
55  
56 =cut
57  
58 has display_name => (
59 is => 'ro',
60 lazy => 1,
61 default => sub { return shift->symbol },
62 );
63  
64 my $exchanges;
65  
66 BEGIN {
67 $exchanges = YAML::XS::LoadFile(File::ShareDir::dist_file('Quant-Framework', 'exchange.yml'));
68 }
69  
70 =head2 BUILDARGS
71  
72 internal function to pre-process construction arguments
73  
74 =cut
75  
76 sub BUILDARGS {
77 my ($class, $symbol) = @_;
78  
79 my $params_ref = clone($exchanges->{$symbol});
80 $params_ref->{symbol} = $symbol;
81  
82 return $params_ref;
83 }
84  
85 no Moose;
86 __PACKAGE__->meta->make_immutable;
87  
88 1;