line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Bitcoin::Feed::Site::BitStamp::Socket; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
394
|
use parent qw(Finance::Bitcoin::Feed::Pusher); |
|
1
|
|
|
|
|
199
|
|
|
1
|
|
|
|
|
4
|
|
6
|
1
|
|
|
1
|
|
82
|
use Scalar::Util qw(weaken); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
208
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
1
|
|
|
1
|
|
20
|
my $self = shift->SUPER::new(channels => [qw/live_trades/]); |
10
|
1
|
|
|
|
|
4
|
$self->{owner} = shift; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#weaken it to prevent from crossing reference |
13
|
1
|
|
|
|
|
6
|
weaken($self->{owner}); |
14
|
1
|
|
|
|
|
2
|
return $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub trade { |
18
|
1
|
|
|
1
|
0
|
2421
|
my $self = shift; |
19
|
1
|
|
|
|
|
3
|
my $data = shift; |
20
|
1
|
|
|
|
|
11
|
$self->{owner}->emit('data_out', 0, "BTCUSD", $data->{price}); |
21
|
1
|
|
|
|
|
6
|
return; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub go { |
25
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
26
|
0
|
|
|
|
|
|
$self->setup; |
27
|
0
|
|
|
|
|
|
$self->handle; |
28
|
0
|
|
|
|
|
|
return; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |