| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CryptoExchange::Catalog; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2018-11-29'; # DATE |
|
4
|
|
|
|
|
|
|
our $VERSION = '20181129.0.0'; # VERSION |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
71053
|
use 5.010001; |
|
|
1
|
|
|
|
|
15
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
35
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
611
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %by_name_lc; |
|
11
|
|
|
|
|
|
|
my %by_safename; |
|
12
|
|
|
|
|
|
|
my %by_code_lc; |
|
13
|
|
|
|
|
|
|
my @all_data; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
|
16
|
1
|
|
|
1
|
1
|
97
|
my $class = shift; |
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
6
|
unless (keys %by_name_lc) { |
|
19
|
1
|
|
|
|
|
6
|
while (defined(my $line = )) { |
|
20
|
225
|
|
|
|
|
324
|
chomp $line; |
|
21
|
225
|
|
|
|
|
539
|
my @ff = split /\t/, $line; |
|
22
|
225
|
|
|
|
|
425
|
my ($name, $safename, $code) = @ff; |
|
23
|
225
|
|
|
|
|
539
|
$by_name_lc{lc $name} = \@ff; |
|
24
|
225
|
|
|
|
|
450
|
$by_safename{$safename} = \@ff; |
|
25
|
225
|
100
|
|
|
|
486
|
$by_code_lc{lc $code} = \@ff if defined $code; |
|
26
|
225
|
|
|
|
|
632
|
push @all_data, \@ff; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
7
|
bless {}, $class; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub by_name { |
|
34
|
3
|
|
|
3
|
1
|
1248
|
my ($self, $name) = @_; |
|
35
|
|
|
|
|
|
|
die "Can't find cryptoexchange with name '$name'" |
|
36
|
3
|
100
|
|
|
|
24
|
unless my $rec = $by_name_lc{lc $name}; |
|
37
|
|
|
|
|
|
|
return { |
|
38
|
2
|
|
|
|
|
18
|
name=>$rec->[0], |
|
39
|
|
|
|
|
|
|
safename=>$rec->[1], |
|
40
|
|
|
|
|
|
|
code=>$rec->[2], |
|
41
|
|
|
|
|
|
|
}; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub by_safename { |
|
45
|
3
|
|
|
3
|
1
|
4715
|
my ($self, $safename) = @_; |
|
46
|
3
|
|
|
|
|
9
|
$safename = lc($safename); |
|
47
|
|
|
|
|
|
|
die "Can't find cryptoexchange with safename '$safename'" |
|
48
|
3
|
100
|
|
|
|
20
|
unless my $rec = $by_safename{$safename}; |
|
49
|
|
|
|
|
|
|
return { |
|
50
|
2
|
|
|
|
|
16
|
name=>$rec->[0], |
|
51
|
|
|
|
|
|
|
safename=>$rec->[1], |
|
52
|
|
|
|
|
|
|
code=>$rec->[2], |
|
53
|
|
|
|
|
|
|
}; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub by_code { |
|
57
|
3
|
|
|
3
|
1
|
2448
|
my ($self, $code) = @_; |
|
58
|
|
|
|
|
|
|
die "Can't find cryptoexchange with code '$code'" |
|
59
|
3
|
100
|
|
|
|
36
|
unless my $rec = $by_code_lc{lc $code}; |
|
60
|
|
|
|
|
|
|
return { |
|
61
|
2
|
|
|
|
|
19
|
name=>$rec->[0], |
|
62
|
|
|
|
|
|
|
safename=>$rec->[1], |
|
63
|
|
|
|
|
|
|
code=>$rec->[2], |
|
64
|
|
|
|
|
|
|
}; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
0
|
1
|
0
|
sub by_slug { by_safename(@_) } |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub all_names { |
|
70
|
1
|
|
|
1
|
1
|
2180
|
my $self = shift; |
|
71
|
1
|
|
|
|
|
2
|
my @res; |
|
72
|
1
|
|
|
|
|
4
|
for (@all_data) { |
|
73
|
225
|
|
|
|
|
388
|
push @res, $_->[0]; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
1
|
|
|
|
|
44
|
@res; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub all_codes { |
|
79
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
80
|
0
|
|
|
|
|
0
|
my @res; |
|
81
|
0
|
|
|
|
|
0
|
for (@all_data) { |
|
82
|
0
|
0
|
|
|
|
0
|
push @res, $_->[2] if defined $_->[2]; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
0
|
|
|
|
|
0
|
@res; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub all_data { |
|
88
|
1
|
|
|
1
|
1
|
2232
|
my $self = shift; |
|
89
|
1
|
|
|
|
|
2
|
my @res; |
|
90
|
1
|
|
|
|
|
4
|
for (@all_data) { |
|
91
|
225
|
|
|
|
|
667
|
push @res, {name=>$_->[0], safename=>$_->[1], code=>$_->[2]}; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
1
|
|
|
|
|
39
|
@res; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
|
97
|
|
|
|
|
|
|
# ABSTRACT: Catalog of cryptoexchanges |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=pod |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=encoding UTF-8 |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 NAME |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
CryptoExchange::Catalog - Catalog of cryptoexchanges |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 VERSION |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This document describes version 20181129.0.0 of CryptoExchange::Catalog (from Perl distribution CryptoExchange-Catalog), released on 2018-11-29. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
use CryptoExchange::Catalog; |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
my $cat = CryptoExchange::Catalog->new; |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
my $record; |
|
118
|
|
|
|
|
|
|
$record = $cat->by_name("BX Thailand"); # note: case-insensitive. => {name=>"BX Thailand", safename=>"bx-thailand", code=>"BX"} |
|
119
|
|
|
|
|
|
|
$record = $cat->by_safename("bx-thailand"); |
|
120
|
|
|
|
|
|
|
$record = $cat->by_slug("bx-thailand"); # alias for by_safename(), mixed case also works |
|
121
|
|
|
|
|
|
|
$record = $cat->by_code("BX"); # note: currently not all exchanges are assign (short) code |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
my @names = $cat->all_names(); # => ("BX Thailand", "Binance", ...) |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
my @codes = $cat->all_codes(); # => ("BX", "BINANCE", ...) |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
my @data = $cat->all_data; # => ({name=>"BX Thailand", safename=>"bx-thailand", code=>"BX"}, {name=>"Binance", safename=>"binance", code=>"BINANCE"}, {...}, ...) |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This class attempts to provide a list/catalog of cryptocurrency exchanges. The |
|
132
|
|
|
|
|
|
|
main source for this catalog is the Cryptocurrency Market Capitalizations |
|
133
|
|
|
|
|
|
|
website (L, or CMC for short). |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 METHODS |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 new |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 by_name |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 by_safename |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 by_code |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 by_slug |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Alias for L"by_safename">. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 all_names |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 all_codes |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 all_data |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 HOMEPAGE |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Please visit the project's homepage at L. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 SOURCE |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Source repository is at L. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 BUGS |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
168
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
169
|
|
|
|
|
|
|
feature. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
L |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 AUTHOR |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
perlancar |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
This software is copyright (c) 2018 by perlancar@cpan.org. |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
184
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
__DATA__ |