Finance-Bitcoin-Feed
view release on metacpan or search on metacpan
NAME
Finance::Bitcoin::Feed - Collect bitcoin real-time price from many
sites' streaming data source
SYNOPSIS
use Finance::Bitcoin::Feed;
#default output is to print to the stdout
Finance::Bitcoin::Feed->new->run();
# will print output to the stdout:
# BITSTAMP BTCUSD 123.00
#or custom your stdout
open my $fh, ">out.txt";
$fh->autoflush();
my $feed = Finance::Bitcoin::Feed->new(output => sub{
my ($self, $site, $currency, $price) = @_;
print $fh "the price currency $currency on site $site is $price\n";
});
# let's go!
$feed->run();
#you can also custom which site you want to connect
Finance::Bitcoin::Feed->new(sites => [qw(LakeBtc)])->go;
DESCRIPTION
Finance::Bitcoin::Feed is a bitcoin realtime data source which collect
real time data source from these sites:
* HitBtc <https://hitbtc.com/api#socketio>
* BtcChina
<http://btcchina.org/websocket-api-market-data-documentation-en>
* CoinSetter <https://www.coinsetter.com/api/websockets/last>
* <lakebtc api <https://www.lakebtc.com/s/api>
The default output format to the stdout by this format:
site_name TIMESTAMP CURRENCY price
For example:
COINSETTER 1418173081724 BTCUSD 123.00
The unit of timestamp is ms.
You can custom your output by listen on the event output and modify the
data it received.
Note the followiing sites doesn't give the timestamp. So the timestamp
in the result will be 0:
LakeBtc
METHODS
This class inherits all methods from Mojo::EventEmitter
( run in 0.505 second using v1.01-cache-2.11-cpan-97f6503c9c8 )