line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Bitcoin::Feed::Site::BitStamp; |
2
|
1
|
|
|
1
|
|
25461
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
3
|
1
|
|
|
1
|
|
285
|
use Finance::Bitcoin::Feed::Site::BitStamp::Socket; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
614
|
use Mojo::Base 'Finance::Bitcoin::Feed::Site'; |
|
1
|
|
|
|
|
8309
|
|
|
1
|
|
|
|
|
8
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'socket'; |
9
|
|
|
|
|
|
|
has 'site' => 'BITSTAMP'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub go { |
12
|
1
|
|
|
1
|
1
|
418
|
my $self = shift; |
13
|
1
|
|
|
|
|
8
|
$self->SUPER::go; |
14
|
1
|
|
|
|
|
4
|
$self->debug('connecting...'); |
15
|
1
|
|
|
|
|
5
|
$self->socket(Finance::Bitcoin::Feed::Site::BitStamp::Socket->new($self)); |
16
|
1
|
|
|
|
|
8
|
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
|
|
|
|
|
|
|
|