File Coverage

blib/lib/Finance/Bitcoin/Feed/Site/BitStamp.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Finance::Bitcoin::Feed::Site::BitStamp;
2 1     1   24605 use strict;
  1         1  
  1         26  
3 1     1   321 use Finance::Bitcoin::Feed::Site::BitStamp::Socket;
  1         3  
  1         27  
4 1     1   628 use Mojo::Base 'Finance::Bitcoin::Feed::Site';
  1         8518  
  1         5  
5              
6             our $VERSION = '0.01';
7              
8             has 'socket';
9             has 'site' => 'BITSTAMP';
10              
11             sub go {
12 1     1 1 368 my $self = shift;
13 1         6 $self->SUPER::go;
14 1         2 $self->debug('connecting...');
15 1         4 $self->socket(Finance::Bitcoin::Feed::Site::BitStamp::Socket->new($self));
16 1         6 return $self->socket->go;
17             }
18              
19             1;
20             __END__
21              
22             =head1 NAME
23              
24             Finance::Bitcoin::Feed::Site::BitStamp -- the class that connect and fetch the bitcoin price data from site bitstamp
25              
26              
27             =head1 SYNOPSIS
28              
29             use Finance::Bitcoin::Feed::Site::BitStamp;
30             use AnyEvent;
31              
32             my $obj = Finance::Bitcoin::Feed::Site::BitStamp->new();
33             # listen on the event 'output' to get the adata
34             $obj->on('output', sub { shift; say @_ });
35             $obj->go();
36              
37             # dont forget this
38             AnyEvent->condvar->recv;
39              
40             =head1 DESCRIPTION
41              
42             Connect to site BitStamp by protocol Pusher and fetch the bitcoin price data.
43              
44             =head1 EVENTS
45              
46             This class inherits all events from L<Finance::Bitcoin::Feed::Site>.
47             The most important event is 'output'.
48              
49             =head2 output
50              
51             It will be emit by its parent class when print out the data. You can listen on this event to get the output.
52              
53              
54             =head1 SEE ALSO
55              
56             L<Finance::Bitcoin::Feed::Site>
57              
58             L<Finance::BitStamp::Socket>
59              
60             L<bitstamp|https://www.bitstamp.net/websocket/>
61              
62             =head1 AUTHOR
63              
64             Chylli C<< <chylli@binary.com> >>
65