-
Introduction
-
Installation
-
Example code
-
Basic functions
-
Create an order
-
Cancel an order
-
Get a specific order
-
Get the whole orderbook
-
Live trade stream
-
Live orderbook stream
-
Account info & functions
-
Get the transaction history
-
Create a new deposit address
-
Get the last deposit address
-
Create a withdrawal
-
Get account info & balance
-
Get active orders
-
Get the last 1000 trades after a specific trade
-
Appendix - Error code
This document describes the usage of BL3P NodeJS module. If you don't have an API-key you can sign up and create one at https://bl3p.eu.
The BL3P nodejs library is available within Node Package Manager.
https://www.npmjs.com/package/bl3p
To install, navigate into your nodejs project directory and run the defined command below in your command-line:
npm install bl3p
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);
}
});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.
add_order(amount, type, price, fee_currency, amount_funds, callback)
typestring'bid', 'ask'
amountintAmount BTC, amount LTC (*1e8)The field described above is optional
priceintLimit price in EUR (*1e5)The field described above is optional
amount_fundsintMaximal EUR amount to spend (*1e5)The field described above is optional
fee_currencystringCurrency the fee is accounted in. Can be: 'EUR' or 'BTC'
order_idintThe id of the order.
cancel_order(order_id, callback)
order_idintThe id of the order that you wish to cancel.
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.
order_info(order_id, callback)
order_idintThe id of the order that you wish to retrieve.
order_idintId of the order.
labelstringAPI-key label
currencystringCurrency of the order. (Is now by default 'EUR')
itemstringThe item that will be traded for `currency`. (Can be: 'BTC' or 'LTC')
typestringType of order. (Can be: 'bid', 'ask')
amountamountObjTotal order amount of BTC or LTC.The field described above is optional
priceamountObjOrder limit price.The field described above is optional
statusstringStatus of the order. (Can be: 'pending’, ‘open’, ‘closed’, ‘cancelled’)
datetimestampThe time the order got added.
total_amountamountObjTotal amount of the trades that got executed. (Can be: BTC or LTC).
total_spentamountObjTotal amount in EUR of the trades that got executed.
total_feeamountObjTotal fee incurred in BTC or LTC.
avg_costamountObjAverage cost of executed trades.The field described above is optional
tradesarrayArray of trades executed for the regarding order.Each array item of 'trade' will contain:
amountamountObjBTC or LTC amount.
currencystringCurrency of the regarding trade.
datetimestampThe time of the trade execution.
itemstring'BTC' or 'LTC'
priceamountObjPrice of the executed trade in EUR.
trade_idintId of trade.
full_depth(callback)
There are no specific parameters required for this call.
asksarrayArray of asks that are in the orderbook.Each array item of 'asks' will contain:
amount_intintAmount BTC, amount LTC (*1e8)
price_intintLimit price in EUR (*1e5)
countintCount of orders at this price.
bidsarrayArray of bids that are in the orderbook.Each array item of 'bids' will contain:
amount_intintAmount BTC, amount LTC (*1e8)
price_intintLimit price in EUR (*1e5)
countintCount of orders at this price.
trades(callback)
amount_intintTraded BTC Amount or traded LTC amount (*1e8)
price_intintTrade price in EUR (*1e5)
datetimestampThe time of the trade execution.
orderbook(callback)
asksarrayArray of asks that are in the orderbook.Each array item of 'asks' will contain:
amount_intintAmount BTC, amount LTC (*1e8)
price_intintLimit price in EUR (*1e5)
countintCount of orders at this price.
bidsarrayArray of bids that are in the orderbook.Each array item of 'bids' will contain:
amount_intintAmount BTC, amount LTC (*1e8)
price_intintLimit price in EUR (*1e5)
countintCount of orders at this price.
wallet_history(currency, page, date_from, date_to, type, recs_per_page, callback)
currencystringCurrency of the wallet. (Can be: 'BTC', 'EUR' or 'LTC')
pageintPage number. (1 = most recent transactions)The field described above is optional
date_fromtimestampFilter the result by an Unix-timestamp. Transactions before this date will not be returned.The field described above is optional
date_totimestampFilter the result by an Unix-timestamp. Transactions after this date will not be returned.The field described above is optional
typestringFilter the result by type. (Can be: ‘trade’, ‘fee’, ‘deposit’, ‘withdraw’)The field described above is optional
recs_per_pageintNumber of records per page.The field described above is optional
pageintCurrent page number.
recordsintCount of records in the result set.
max_pageintNumber of last page.
transactionsarrayArray of transactions.Each array item of 'transactions' will contain:
transaction_idintId of the transaction.
amountamountObjBTC or LTC amount.
datetimestampTime when the regarding transaction took place.
debit_creditstringType of booking. (Can be: 'debit' or 'credit')
priceamountObjPrice of the executed trade.The field described above is optional
order_idintId of the order.The field described above is optional
typestringType of transaction (Can be: 'trade’, ‘fee’, ‘deposit’, ‘withdraw’)
balanceamountObjBalance of the user his account (for the regarding currency) after the transaction.
trade_idintId of the trade.The field described above is optional
contra_amountamountObjContra amount of the trade.The field described above is optional
feeamountObjFee incurred by the regarding trade
new_deposit_address(callback)
There are no specific parameters required for this call.
addressstringDeposit address for the market leading currency
last_deposit_address
There are no specific parameters required for this call.
addressstringDeposit address for the market leading currency
withdraw(type, amount, account, callback)
accountstringIBAN account-id (that is available within the regarding BL3P account) or a Bitcoin addressNote: The kind of account value you need to specify depends on the 'type' parameter described below.
typestringCan be 'EUR' or 'BTC'
amountintSatoshis or 0,00001 EUR
idintId of the withdrawal
account_info(callback)
There are no specific parameters required for this call.
user_idintId of the user.
trade_feefloatPercentage fee for the user
walletsarrayArray of wallets.Each array item of 'wallets' will contain:
balanceamountObjBalance in this wallet
availableamountObjAvailable in this wallet.
active_orders(callback)
There are no specific parameters required for this call.
ordersarrayArray of active orders.Each array item of 'orders' will contain:
order_idintId of the order.
labelstringAPI-key label
currencystringCurrency of the order. (Is now by default 'EUR')
itemstringThe item that will be traded for `currency`. (Can be: 'BTC' or 'LTC')
typestringType of order. (Can be: 'bid', 'ask')
statusstringStatus of the order. (Can be: 'pending’, ‘open’, ‘closed’, ‘cancelled’)
datetimestampThe time the order got added.
amountamountObjTotal order amount of BTC or LTC.The field described above is optional
amount_funds_executedamountObjAmount in funds that is executed.
amount_executedamountObjAmount that is executed.
priceamountObjOrder limit price.The field described above is optional
amount_fundsamountObjMaximal EUR amount to spend (*1e5)The field described above is optional
last_1000_trades(trade_id, callback)
trade_idintId of the tradeThe field described above is optional, if this field isn't specified, this call will return the last 1000 trades.
tradesarrayArray of trades.Each array item of 'trades' will contain:
trade_idintId of the trade.
datetimestampThe time of the trade execution.
amount_intintAmount traded. (*1e8)
price_intintPrice of the traded item in EUR. (*1e5)
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.