bl3p v0.1.9
BL3P NodeJS module
Table of contents
- 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 an specific trade
- 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 bl3p1.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 labelcurrency 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:
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.
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_intintAmount BTC, amount LTC (*1e8)
price_intintLimit price in EUR (*1e5)
countintCount of orders at this price.
bids array
Array 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.
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_intintBTC amount or LTC amount (*1e8)
price_intintLimit price in EUR (*1e5)
countintCount of orders at this price.
bids array
Array 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.
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_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
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 currency3.3 - Get the last deposit address
Method
last_deposit_addressParameters
There are no specific parameters required for this call.Response
address string
Deposit address for the market leading currency3.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 addressNote: 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 EURResponse
id int
Id of the withdrawal3.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 userwallets array
Array of wallets.Each array item of 'wallets' will contain:
balanceamountObjBalance in this wallet
availableamountObjAvailable 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_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
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 tradeThe 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_idintId of the trade.
datetimestampThe time of the trade execution.
amount_intintAmount traded. (*1e8)
price_intintPrice 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 minimumINSUFFICIENT_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 existUNKNOWN_PATH
Requested path and/or call doesn't exist.8 years ago
8 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago