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 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
amountObjBTC or LTC amount.
currency
stringCurrency of the regarding trade.
date
timestampThe time of the trade execution.
item
string'BTC' or 'LTC'
price
amountObjPrice of the executed trade in EUR.
trade_id
intId 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
intAmount BTC, amount LTC (*1e8)
price_int
intLimit price in EUR (*1e5)
count
intCount of orders at this price.
bids
array
Array of bids that are in the orderbook.
Each array item of 'bids' will contain:
amount_int
intAmount BTC, amount LTC (*1e8)
price_int
intLimit price in EUR (*1e5)
count
intCount 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
intBTC amount or LTC amount (*1e8)
price_int
intLimit price in EUR (*1e5)
count
intCount of orders at this price.
bids
array
Array of bids that are in the orderbook.
Each array item of 'bids' will contain:
amount_int
intAmount BTC, amount LTC (*1e8)
price_int
intLimit price in EUR (*1e5)
count
intCount 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
intId of the transaction.
amount
amountObjBTC or LTC amount.
date
timestampTime when the regarding transaction took place.
debit_credit
stringType of booking. (Can be: 'debit' or 'credit')
price
amountObjPrice of the executed trade.
The field described above is optional
order_id
intId of the order.
The field described above is optional
type
stringType of transaction (Can be: 'trade’, ‘fee’, ‘deposit’, ‘withdraw’)
balance
amountObjBalance of the user his account (for the regarding currency) after the transaction.
trade_id
intId of the trade.
The field described above is optional
contra_amount
amountObjContra amount of the trade.
The field described above is optional
fee
amountObjFee 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
amountObjBalance in this wallet
available
amountObjAvailable 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
intId of the order.
label
stringAPI-key label
currency
stringCurrency of the order. (Is now by default 'EUR')
item
stringThe item that will be traded for `currency`. (Can be: 'BTC' or 'LTC')
type
stringType of order. (Can be: 'bid', 'ask')
status
stringStatus of the order. (Can be: 'pending’, ‘open’, ‘closed’, ‘cancelled’)
date
timestampThe time the order got added.
amount
amountObjTotal order amount of BTC or LTC.
The field described above is optional
amount_funds_executed
amountObjAmount in funds that is executed.
amount_executed
amountObjAmount that is executed.
price
amountObjOrder limit price.
The field described above is optional
amount_funds
amountObjMaximal 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
intId of the trade.
date
timestampThe time of the trade execution.
amount_int
intAmount traded. (*1e8)
price_int
intPrice 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.
7 years ago
7 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago