Nadex/Contract.pm

filter: Statementstmt 67.9% 36 / 53 Branchbran 31.2% 5 / 16 Conditioncond 50.0% 8 / 16 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 75.0% 9 / 12 Podpod 100% 8 / 8 totaltotal 58.4% 66 / 113 CC 17 SCAR 17.5
CC
17
Cov
58%
_new
11.1
bidsize
6.0
contract
6.0
CRAP 5.7
« Nadex.pm ↑ Summary
1 package Finance::Nadex::Contract;
2  
3 14 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 14 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶sub bid {
Subroutine bid: called CC=2 SCAR=7.6
Pod documented
8  
9 1 my $self = shift;
10  
11 1 ▶ if ( exists $self->{bid} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"bid"}) 1 0 1
12 1 return $self->{bid};
13 }
14  
15 0 return;
16 }
17  
18 0 ▶sub bidsize {
Subroutine bidsize: not called CC=2 SCAR=17.9
Pod documented
19  
20 0 my $self = shift;
21  
22 0 ▶ if ( exists $self->{bidsize} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"bidsize"}) 0 0 0
23 0 return $self->{bidsize};
24 }
25  
26 0 return;
27 }
28  
29 0 ▶sub contract {
Subroutine contract: not called CC=2 SCAR=17.9
Pod documented
30  
31 0 my $self = shift;
32  
33 0 ▶ if ( exists $self->{contract} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"contract"}) 0 0 0
34 0 return $self->{contract};
35 }
36  
37 0 return;
38 }
39  
40 1 ▶sub epic {
Subroutine epic: called CC=2 SCAR=7.6
Pod documented
41  
42 1 my $self = shift;
43  
44 1 ▶ if ( exists $self->{epic} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"epic"}) 1 0 1
45 1 return $self->{epic};
46 }
47  
48 0 return;
49 }
50  
51 1 ▶sub expirydate {
Subroutine expirydate: called CC=2 SCAR=7.6
Pod documented
52  
53 1 my $self = shift;
54  
55 1 ▶ if ( exists $self->{expirydate} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"expirydate"}) 1 0 1
56 1 return $self->{expirydate};
57 }
58  
59 0 return;
60 }
61  
62 1 ▶sub offer {
Subroutine offer: called CC=2 SCAR=7.6
Pod documented
63  
64 1 my $self = shift;
65  
66 1 ▶ if ( exists $self->{offer} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"offer"}) 1 0 1
67 1 return $self->{offer};
68 }
69  
70 0 return;
71 }
72  
73 0 ▶sub offersize {
Subroutine offersize: not called CC=2 SCAR=17.9
Pod documented
74  
75 0 my $self = shift;
76  
77 0 ▶ if ( exists $self->{offersize} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"offersize"}) 0 0 0
78 0 return $self->{offersize};
79 }
80  
81 0 return;
82 }
83  
84 12 ▶sub type {
Subroutine type: called CC=2 SCAR=7.6
Pod documented
85  
86 12 my $self = shift;
87  
88 12 ▶ if ( exists $self->{type} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"type"}) 12 0 12
89 12 return $self->{type};
90 }
91  
92 0 return;
93 }
94  
95 8 ▶sub _new {
Subroutine _new: called CC=9 SCAR=24.1
96  
97 8 my $hashref = shift;
98  
99 8 my $self = {};
100  
101 8 ▶ $self->{offer} = $hashref->{displayOffer} || 'NoOffer';
Condition50%1/2
$hashref->{'displayOffer'} || 'NoOffer'
l!l
80
MC/DC0%0/1
$hashref->{'displayOffer'} || 'NoOffer'
$hashref->{'displayOffer'}
Truth table50%1/2
A
A= $hashref->{'displayOffer'}
Aresult
11
00
102 8 ▶ $self->{bid} = $hashref->{displayBid} || 'NoBid';
Condition50%1/2
$hashref->{'displayBid'} || 'NoBid'
l!l
80
MC/DC0%0/1
$hashref->{'displayBid'} || 'NoBid'
$hashref->{'displayBid'}
Truth table50%1/2
A
A= $hashref->{'displayBid'}
Aresult
11
00
103 8 ▶ $self->{contract} = $hashref->{instrumentName} || undef;
Condition50%1/2
$hashref->{'instrumentName'} || undef
l!l
80
MC/DC0%0/1
$hashref->{'instrumentName'} || undef
$hashref->{'instrumentName'}
Truth table50%1/2
A
A= $hashref->{'instrumentName'}
Aresult
11
00
104 8 ▶ $self->{epic} = $hashref->{epic} || undef;
Condition50%1/2
$hashref->{'epic'} || undef
l!l
80
MC/DC0%0/1
$hashref->{'epic'} || undef
$hashref->{'epic'}
Truth table50%1/2
A
A= $hashref->{'epic'}
Aresult
11
00
105 8 ▶ $self->{type} = lc( $hashref->{instrumentType} ) || undef;
Condition50%1/2
lc $hashref->{'instrumentType'} || undef
l!l
80
MC/DC0%0/1
lc $hashref->{'instrumentType'} || undef
lc $hashref->{'instrumentType'}
Truth table50%1/2
A
A= lc $hashref->{'instrumentType'}
Aresult
11
00
106 8 ▶ $self->{expirydate} = $hashref->{displayPeriod} || undef;
Condition50%1/2
$hashref->{'displayPeriod'} || undef
l!l
80
MC/DC0%0/1
$hashref->{'displayPeriod'} || undef
$hashref->{'displayPeriod'}
Truth table50%1/2
A
A= $hashref->{'displayPeriod'}
Aresult
11
00
107 8 ▶ $self->{bidsize} = $hashref->{displayBidSize} || undef;
Condition50%1/2
$hashref->{'displayBidSize'} || undef
l!l
08
MC/DC0%0/1
$hashref->{'displayBidSize'} || undef
$hashref->{'displayBidSize'}
Truth table50%1/2
A
A= $hashref->{'displayBidSize'}
Aresult
11
00
108 8 ▶ $self->{offersize} = $hashref->{displayOfferSize} || undef;
Condition50%1/2
$hashref->{'displayOfferSize'} || undef
l!l
08
MC/DC0%0/1
$hashref->{'displayOfferSize'} || undef
$hashref->{'displayOfferSize'}
Truth table50%1/2
A
A= $hashref->{'displayOfferSize'}
Aresult
11
00
109  
110 8 return bless $self, __PACKAGE__;
111 }
112  
113 =head1 NAME
114  
115 Finance::Nadex::Contract - Provides information about a contract available for trading on the North American Derivatives Exchange
116  
117 =head1 VERSION
118  
119 Version 0.01
120  
121 =cut
122  
123 14 our $VERSION = '0.01';
124  
125 =head1 SYNOPSIS
126  
127 Container for information about contracts; used by L<Finance::Nadex>; not meant to be instantiated
128 directly in client code; certain methods in L<Finance::Nadex> return an instance or list of
129 Finance::Nadex::Contract objects; the accessor methods below can be used to retrieve information
130 from the object instances; see L<Finance::Nadex> for information about methods which retrieve positions
131  
132 =head1 ACCESSORS
133  
134 =head2 bid
135  
136 Retrieves the current highest bid for the contract (example: "30.00")
137  
138 =head2 bidsize
139  
140 Retrieves the number of contracts bid at the current highest bid
141  
142 =head2 contract
143  
144 Retrieves the name of the contract (example: "GBP/USD >1.5120 (3PM)")
145  
146 =head2 epic
147  
148 Retrieves the unique identifier for the contract as created by the exchange (example: "NB.D.OPT-GBP-USD.1-1-15Jan15")
149  
150 =head2 expirydate
151  
152 Retrieves the date on which the contract will expire (example: "20-JAN-15")
153  
154 =head2 offer
155  
156 Retrieves the current lowest offer for the contract (example: "20.50")
157  
158 =head2 offersize
159  
160 Retrieves the number of contracts offered at the current lowest offer
161  
162 =head2 type
163  
164 Retrieves the type of contract: one of 'binary', 'spread', or 'event'
165  
166  
167 =head1 AUTHOR
168  
169 mhandisi, C<< <mhandisi at cpan.org> >>
170  
171 =head1 BUGS
172  
173 Please report any bugs or feature requests to C<bug-finance-nadex at rt.cpan.org>, or through
174 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Finance-Nadex>. I will be notified, and then you'll
175 automatically be notified of progress on your bug as I make changes.
176  
177  
178  
179  
180 =head1 SUPPORT
181  
182 You can find documentation for this module with the perldoc command.
183  
184 perldoc Finance::Nadex::Contract
185  
186  
187 You can also look for information at:
188  
189 =over 4
190  
191 =item * RT: CPAN's request tracker (report bugs here)
192  
193 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Finance-Nadex>
194  
195 =item * AnnoCPAN: Annotated CPAN documentation
196  
197 L<http://annocpan.org/dist/Finance-Nadex>
198  
199 =item * CPAN Ratings
200  
201 L<http://cpanratings.perl.org/d/Finance-Nadex>
202  
203 =item * Search CPAN
204  
205 L<http://search.cpan.org/dist/Finance-Nadex/>
206  
207 =back
208  
209  
210 =head1 ACKNOWLEDGEMENTS
211  
212  
213 =head1 LICENSE AND COPYRIGHT
214  
215 Copyright 2015 mhandisi.
216  
217 This program is free software; you can redistribute it and/or modify it
218 under the terms of the the Artistic License (2.0). You may obtain a
219 copy of the full license at:
220  
221 L<http://www.perlfoundation.org/artistic_license_2_0>
222  
223 Any use, modification, and distribution of the Standard or Modified
224 Versions is governed by this Artistic License. By using, modifying or
225 distributing the Package, you accept this license. Do not use, modify,
226 or distribute the Package, if you do not accept this license.
227  
228 If your Modified Version has been derived from a Modified Version made
229 by someone other than you, you are nevertheless required to ensure that
230 your Modified Version complies with the requirements of this license.
231  
232 This license does not grant you the right to use any trademark, service
233 mark, tradename, or logo of the Copyright Holder.
234  
235 This license includes the non-exclusive, worldwide, free-of-charge
236 patent license to make, have made, use, offer to sell, sell, import and
237 otherwise transfer the Package with respect to any patent claims
238 licensable by the Copyright Holder that are necessarily infringed by the
239 Package. If you institute patent litigation (including a cross-claim or
240 counterclaim) against any party alleging that the Package constitutes
241 direct or contributory patent infringement, then this Artistic License
242 to you shall terminate on the date that such litigation is filed.
243  
244 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
245 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
246 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
247 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
248 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
249 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
250 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
251 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
252  
253  
254 =cut
255  
256 14 42; # End of Finance::Nadex::Contract
« Nadex.pm ↑ Summary