The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WebService::Bitcoin::BTCe - interact with the btc-e.com bitcoin exchange

VERSION

version 0.001

SYNOPSIS

DESCRIPTION

Please read the btc-e.com documentation first. Pay careful attention to security-related things such as 2FA. Read the code for this module before trusting your account details to it.

METHODS

new

Pass these for the trading API (not needed for "depth"):

  • key - your BTC-e.com API key

  • secret - your BTC-e.com API secret

The privileges for the key/secret combination will determine which methods succeed or fail.

If you're using this with IO::Async:

 my $btce = WebService::Bitcoin::BTCe->new(
  key => '...',
  secret => '...',
  timed => sub { $loop->delay_future(@_) },
  ua => WebService::Async::UserAgent->new(loop => $loop),
 );

If you're using it with something else, you'll need an alternative for the "timed" callback, and a user agent which conforms to the WebService::Async::UserAgent API.

depth

Returns the current trading pairs for the given currencies.

Resolves to a hashref containing:

  • lowest_ask

  • highest_ask

  • asks

  • bids

Values returned will be cached for 2 seconds. If you don't provide a way to run code after a timeout, they will be cached indefinitely.

account_balance

Resolves to a hashref containing balances for all currencies.

info

Returns all information about this account and key/secret access.

  • funds - hashref of currency => amount for account balances

  • rights - hashref listing all access rights this API key has

  • transaction_count - number of transactions executed

  • open_orders - total number of open (unexecuted/partially filled) orders

  • server_time - current server time, used for latency calculation

Rights are currently:

  • info

  • trade

  • withdraw

active_orders

Returns all active orders for the current account.

order_info

Returns info for a given order.

cancel_order

Cancels the given order.

trade

Attempts to make a trade.

build_request

Builds a request.

error_check

Wraps requests in basic error checking. Will retry for known cases such as invalid nonce.

SEE ALSO

AUTHOR

Tom Molesworth <cpan@perlsite.co.uk>

LICENSE

Copyright Tom Molesworth 2013-2015. Licensed under the same terms as Perl itself.