dagurval / p6-webservice-justcoin Goto Github PK
View Code? Open in Web Editor NEWPerl6 access to Justcoin trading API (Norwegian Bitcoin marketplace)
License: Artistic License 2.0
Perl6 access to Justcoin trading API (Norwegian Bitcoin marketplace)
License: Artistic License 2.0
=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>.
This line:
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.