0.1.9 • Published 7 years ago

bl3p v0.1.9

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

BL3P NodeJS module

Table of contents

    1. Introduction
      1. Installation
      1. Example code
    1. Basic functions
      1. Create an order
      1. Cancel an order
      1. Get a specific order
      1. Get the whole orderbook
      1. Live trade stream
      1. Live orderbook stream
    1. Account info & functions
      1. Get the transaction history
      1. Create a new deposit address
      1. Get the last deposit address
      1. Create a withdrawal
      1. Get account info & balance
      1. Get active orders
      1. Get the last 1000 trades after an specific trade
    1. Appendix - Error code

1 - Introduction

This document describes the usage of BL3P NodeJS module. If you don't have an API-key you can signup and create one at https://bl3p.eu.

1.1 - Installation

To install, navigate into your nodejs project directory and run the defined command below in your command-line:

npm install bl3p

1.2 - Example code

var bl3p = require('bl3p');
var public_key = 'YOUR_PUBLIC_KEY';
var private_key = 'YOUR_PRIVATE_KEY';

var bl3p_auth = new bl3p.Bl3pAuth(public_key, private_key);

bl3p_auth.account_info(function(error, data){
  if(data){
    console.log(data);
  }else{
    console.log(error);
  }
});

bl3p.trades(function(error, data){
  if(data){
    console.log(data);
  }else{
    console.log(error);
  }
});

bl3p.orderbook(function(error, data){
  if(data){
    console.log(data);
  }else{
    console.log(error);
  }
});

2 - Basic functions

All the methods return a data and an error array in JSON format. All methods also require a callback method. The callback method is always the last required parameter. In case of an error, an error code will be retuned. The possible error codes are listed in the appendix.

2.1 - Create an order

Method

add_order(amount, type, price, fee_currency, amount_funds, callback)

Parameters

type string

'bid', 'ask'

amount int

Amount BTC, amount LTC (*1e8)

The field described above is optional


price int

Limit price in EUR (*1e5)

The field described above is optional


amount_funds int

Maximal EUR amount to spend (*1e5)

The field described above is optional


fee_currency string

Currency the fee is accounted in. Can be: 'EUR' or 'BTC'

Response

order_id int

The id of the order.

2.2 - Cancel an order

Method

cancel_order(order_id, callback)

Parameters

order_id int

The id of the order that you wish to cancel.

Response

For this call there is no specific result returned other then
the result of the call which contains: 'success' or 'failed' and a optional error array.

2.3 - Get a specific order

Method

order_info(order_id, callback)

Parameters

order_id int

The id of the order that you wish to retrieve.

Response

order_id int

Id of the order.

label string

API-key label

currency string

Currency of the order. (Is now by default 'EUR')

item string

The item that will be traded for `currency`. (Can be: 'BTC' or 'LTC')

type string

Type of order. (Can be: 'bid', 'ask')

amount amountObj

Total order amount of BTC or LTC.

The field described above is optional


price amountObj

Order limit price.

The field described above is optional


status string

Status of the order. (Can be: 'pending’, ‘open’, ‘closed’, ‘cancelled’)

date timestamp

The time the order got added.

total_amount amountObj

Total amount of the trades that got executed. (Can be: BTC or LTC).

total_spent amountObj

Total amount in EUR of the trades that got executed.

total_fee amountObj

Total fee incurred in BTC or LTC.

avg_cost amountObj

Average cost of executed trades.

The field described above is optional


trades array

Array of trades executed for the regarding order.

Each array item of 'trade' will contain:

amount amountObj

BTC or LTC amount.

currency string

Currency of the regarding trade.

date timestamp

The time of the trade execution.

item string

'BTC' or 'LTC'

price amountObj

Price of the executed trade in EUR.

trade_id int

Id of trade.

2.4 - Get the whole orderbook

Method

full_depth(callback)

Parameters

There are no specific parameters required for this call.

Response

asks array

Array of asks that are in the orderbook.

Each array item of 'asks' will contain:

amount_int int

Amount BTC, amount LTC (*1e8)

price_int int

Limit price in EUR (*1e5)

count int

Count of orders at this price.

bids array

Array of bids that are in the orderbook.

Each array item of 'bids' will contain:

amount_int int

Amount BTC, amount LTC (*1e8)

price_int int

Limit price in EUR (*1e5)

count int

Count of orders at this price.

2.5 - Live trade stream

Method

trades(callback)

Response

amount_int int

Traded BTC Amount or  traded LTC amount (*1e8)

price_int int

Trade price in EUR (*1e5)

date timestamp

The time of the trade execution.

2.6 - Live orderbook stream

Method

orderbook(callback)

Response

asks array

Array of asks that are in the orderbook.

Each array item of 'asks' will contain:

amount_int int

BTC amount or LTC amount (*1e8)

price_int int

Limit price in EUR (*1e5)

count int

Count of orders at this price.

bids array

Array of bids that are in the orderbook.

Each array item of 'bids' will contain:

amount_int int

Amount BTC, amount LTC (*1e8)

price_int int

Limit price in EUR (*1e5)

count int

Count of orders at this price.

3 - Account info & functions

3.1 - Get your transaction history

Method

wallet_history(currency, page, date_from, date_to, type, recs_per_page, callback)

Parameters

currency string

Currency of the wallet. (Can be: 'BTC', 'EUR' or 'LTC')

page int

Page number. (1 = most recent transactions)

The field described above is optional


date_from timestamp

Filter the result by an Unix-timestamp. Transactions before this date will not be returned.

The field described above is optional


date_to timestamp

Filter the result by an Unix-timestamp. Transactions after this date will not be returned.

The field described above is optional


type string

Filter the result by type. (Can be: ‘trade’, ‘fee’, ‘deposit’, ‘withdraw’)

The field described above is optional


recs_per_page int

Number of records per page.

The field described above is optional


Response

page int

Current page number.

records int

Count of records in the result set.

max_page int

Number of last page.

transactions array

Array of transactions.

Each array item of 'transactions' will contain:

transaction_id int

Id of the transaction.

amount amountObj

BTC or LTC amount.

date timestamp

Time when the regarding transaction took place.

debit_credit string

Type of booking. (Can be: 'debit' or 'credit')

price amountObj

Price of the executed trade.

The field described above is optional


order_id int

Id of the order.

The field described above is optional


type string

Type of transaction (Can be: 'trade’, ‘fee’, ‘deposit’, ‘withdraw’)

balance amountObj

Balance of the user his account (for the regarding currency) after the transaction.

trade_id int

Id of the trade.

The field described above is optional


contra_amount amountObj

Contra amount of the trade.

The field described above is optional


fee amountObj

Fee incurred by the regarding trade

3.2 - Create a new deposit address

Method

new_deposit_address(callback)

Parameters

There are no specific parameters required for this call.

Response

address string

Deposit address for the market leading currency

3.3 - Get the last deposit address

Method

last_deposit_address

Parameters

There are no specific parameters required for this call.

Response

address string

Deposit address for the market leading currency

3.4 - Create a withdrawal

Method

withdraw(type, amount, account, callback)

Parameters

account string

IBAN account-id (that is available within the regarding BL3P account) or a Bitcoin address

Note: The kind of account value you need to specify depends on the 'type' parameter described below.


type string

Can be 'EUR' or 'BTC'

amount int

Satoshis or 0,00001 EUR

Response

id int

Id of the withdrawal

3.5 - Get account info & balance

Method

account_info(callback)

Parameters

There are no specific parameters required for this call.

Response

user_id int

Id of the user.

trade_fee float

Percentage fee for the user

wallets array

Array of wallets.

Each array item of 'wallets' will contain:

balance amountObj

Balance in this wallet

available amountObj

Available in this wallet.

3.6 Get active orders

Method

active_orders(callback)

Parameters

There are no specific parameters required for this call.

Response

orders array

Array of active orders.

Each array item of 'orders' will contain:

order_id int

Id of the order.

label string

API-key label

currency string

Currency of the order. (Is now by default 'EUR')

item string

The item that will be traded for `currency`. (Can be: 'BTC' or 'LTC')

type string

Type of order. (Can be: 'bid', 'ask')

status string

Status of the order. (Can be: 'pending’, ‘open’, ‘closed’, ‘cancelled’)

date timestamp

The time the order got added.

amount amountObj

Total order amount of BTC or LTC.

The field described above is optional


amount_funds_executed amountObj

Amount in funds that is executed.

amount_executed amountObj

Amount that is executed.

price amountObj

Order limit price.

The field described above is optional


amount_funds amountObj

Maximal EUR amount to spend (*1e5)

The field described above is optional


3.7 - Get the last 1000 trades after an specific trade

Method

last_1000_trades(trade_id, callback)

Parameters

trade_id int

Id of the trade

The field described above is optional, if this field isn't specified, this call will return the last 1000 trades.

Response

trades array

Array of trades.

Each array item of 'trades' will contain:

trade_id int

Id of the trade.

date timestamp

The time of the trade execution.

amount_int int

Amount traded. (*1e8)

price_int int

Price of the traded item in EUR. (*1e5)

4 - Appendix - Error codes

The API can respond to invalid calls with the following error messages:

AMOUNT_FUNDS_LESS_THAN_MINIMUM

Order amount (amount_funds) smaller than the minimum.

AMOUNT_LESS_THAN_MINIMUM

Order amount is smaller than the minimum

INSUFFICIENT_FUNDS

Not enough money on account for this order.

INVALID_AMOUNT

Invalid field 'amount_int'.

INVALID_AMOUNT_FUNDS

Invalid field 'amount_funds_int'.

INVALID_FEE_CURRENCY

Invalid field 'fee_currency'.

INVALID_LIMIT_ORDER

Limitorders can't have both an 'amount' and an 'amount_funds'.

INVALID_PRICE

Invalid field 'price_int'.

INVALID_TYPE

Invalid field type (‘bid’ or ‘ask’).

KEY_MISSING

The Rest-Key header misses.

LIMIT_REACHED

User has done to much calls.

MARKETPLACE_INACCESSIBLE

Market (temporarily) closed.

MARKETPLACE_NOT_ACCEPTING_ORDERS

Market does (temporarily) not accepts orders.

MISSING_AMOUNT

The field 'amount' or 'amout_funds' is missing with this order.

MISSING_FIELD

A required field at this call is missing.

NOT_AUTHENTICATED

Signature-key-combination is invalid.

SIGN_MISSING

The Rest-Sign header misses.

UNKNOWN_ACCOUNT

User has no account for given currency (SystemServer)

UNKNOWN_CURRENCY

The requested currency doesn't exist.

UNKNOWN_ERROR

An unknown server error occured.

UNKNOWN_MARKETPLACE

The requested market doesn't exist.

UNKNOWN_ORDER

The order to cancel or fetch doesn't exist

UNKNOWN_PATH

Requested path and/or call doesn't exist.

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.0.0

9 years ago