Giter Club home page Giter Club logo

p6-webservice-justcoin's Introduction

=begin pod

=head1 NAME

WebService::Justcoin - Interface to Justcoin Bitcoin marketplace.

=head1 SYNOPSIS

        use WebService::Justcoin;

        my $j = WebService::Justcoin.new(:url-get(&ugly-curl-get)); 
        
        say $j.markets(id => "BTCNOK");
        # ("id" => "BTCNOK", "last" => "2800.000", "high" => "2950.123", "low" => "2751.020", "bid" => "2800.000", "ask" => "2867.446", "volume" => "21.00230", "scale" => 3).hash

        $j = WebService::Justcoin.new(
                :api-keys("my-api-key"),
                :url-get(&ugly-curl-get)); 
        say $j.orders();
        # ({"id" => 2524406, "market" => "BTCNOK", "type" => "bid", "price" => "2833.723", "amount" => "0.00352", "remaining" => "0.00352", "matched" => "0.00000", "cancelled" => "0.00000", "createdAt" => DateTime.new(year => 2014, month => 4, day => 8, hour => 9, minute => 51, second => 10)},).list}

=head1 DESCRIPTION

Justcoin is a Norwegian Bitcoin marketplace. C<WebService::Justcoin> implements the documented parts[1] of its API and some of its undocumented parts[2].

This module is alpha quality. Use this module at own risk!

[1] Justcoin API documentation: http://docs.justcoin.apiary.io/
[2] Justcoin API source code: https://github.com/justcoin/snow/tree/master/api/v1

Perl6 is awesome, and bitcoins are neat too. This module let's you combine the two worlds. I, the author, use this module to buy a small amount of BTC every day in a cron job.

=head1 METHODS

I recommend taking a look at the unittests to see how to use the API, and what return values to expect. There are also samples in /samples

=head2 new(:api-key, :url-get, :url-post, :url-delete)

The constructor. API key is required for most methods (C<markets()> is one exception). Your API key can be found on the justcoin.com website under your account settings.

Since Perl6 does not at the moment (AFAIK) have a module for accessing https urls, you will need to provide them yourself as url-get, url-post and url-delete parameters. This module does however provide you with an ugly implementation of those that use the C<curl> executable. Here is how to use them:

        my $j = WebService::Justcoin.new(
                        :url-get(&ugly-curl-get),
                        :url-post(&ugly-curl-post),
                        :url-delete(&ugly-curl-delete),
                        :api-key("your api key"));

=head2 markets(:$id?)

Get current market summary. If you provide market ID, you will only get summary for that market.

=head2 market-depth(Str $market-id)

Market depth for given market (all asks and bids).

=head2 currencies
Currencies supported by Justcoin.

=head3 orders()
List of your current (unmatched) orders.

=head3 create-orders(:market, :amount, :type, :price?)
Create a C<:type> order in C<:market> for C<:amount> of currency at C<:price>.

C<type> can be either "ask" or "bid". C<price> is optional and your order will be placed as market order if not provided.

=head3 cancel-order(Int $id)
Cancel order with given ID.

=head3 balances(Str :$currency?)
Lists your balances for all currencies.

If C<currency> is provided, only your balance for that currency will be returned.

=head3 withdraws()
Lists all your withdraws.

=head3 create-withdraw-btc(Str :$address, Rat :$amount)
Withdraw C<$amount> of BTC to address C<$address>.

p6-webservice-justcoin's People

Contributors

alexdaniel avatar dagurval avatar samcv avatar zoffixznet avatar

Watchers

 avatar  avatar  avatar

p6-webservice-justcoin's Issues

DateTime in sink context

This line:

$_{"completed"} ?? to-dt($_{"completed"}) !! DateTime;

Produces this warning:

WARNINGS for /home/alex/git/p6-webservice-justcoin/lib/WebService/Justcoin):
Useless use of constant value DateTime in sink context (line 95)

I can't guess what was intended there, so I don't know how to fix. But basically this DateTime there does nothing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.