bitrus
v1.0.1
Published
Bitrus provide a simple and powerfull REST API to perform nearly all actions which one you can opreate from web or app. All request used application/json content type, always send ACCESS TOKEN, AUTHORIZATION KEY and API KEY for do any action.
Downloads
5
Readme
#BITRUS
Bitrus provide a simple and powerfull REST API to perform nearly all actions which one you can opreate from web or app. All request used application/json content type, always send ACCESS TOKEN, AUTHORIZATION KEY and API KEY for do any action.
For PRs or issues, head over to the source repository
#Usage/Examples
npm i bitrusapi //install the package
const bitrus = require('bitrusapi'); //require the package in your file
#Market API's Reference
The baseurl is https://www.bitrusapi.com/public/ We reserve the right to change these settings as we tune the system.
##API for current market price
const bsymArr; // array of coincode
const qsym=; // currency/coincode you are looking price in
bitrus.currentMarketPrice(bsymArr,qsym).then(data => return data );
###Result
{
"status": true,
"msg": "pair ohclv data",
"data": [
{
"pair": "DASH_btrs",
"open": 0,
"high": 0, //for pair dash_btrs
"close": 0,
"volume": 0,
"low": 0,
"price": 0
},
{
"pair": "BCH_btrs",
"open": 0,
"high": 0,
"close": 0,
"volume": 0, //for pair bch_btrs
"low": 0,
"price": 0
},
{
"pair": "EOS_btrs",
"open": 0,
"high": 0,
"close": 0, //for pair eos_btrs
"volume": 0,
"low": 0,
"price": 0
}
]
}
###DESCRIPTION
| Keys | Description| |--------|-----------| | pair | Coin-pair | | open | first price level during a timeframe in quote currency| | high | highest price for a timeframe in quote currency| |low | lowest price for a timeframe in quote currency| | close | closing price in quote currency| | volume | total volume traded in a timeframe|
API for Depthchart
const coinPair; // coinPair codes you want the depthchart for (e.g:eth_btc)
bitrus.depthChart(coinPair).then(data => return (data))
###Result (for coinPair ltc_btc)
{
"meta": {
"msgt": "depth chart",
"status": true
},
"data": {
"bids": [
{
"price": 0.01423,
"bidsvolume": 0.94,
"bidstotalvolume": 1.93
},
{
"price": 0.01477,
"bidsvolume": 0.99,
"bidstotalvolume": 0.99
}
],
"asks": [
{
"price": 0.0149,
"asksvolume": 0.022397,
"askstotalvolume": 0.022397
}
]
}
}
###API Description |keys | Description| | bids | buyers conditions for buying the cryptocurrency| |price | how much a buyer is willing to pay or seller is willing to selll for the cryptocurrency | |bidsVolume | amount of cryptocurrency he wants to buy | |totalvolume | | |ask | seller's conditions for selling the cryptocurrency| |askVolume | total amount of cryptocurrency seller is willing to sell | |askTotalVolume | total volume of cryptocurrency the seller holds |
#USER's API REFERENCE
##baseUrl is https://www.bitrusapi.com/client/v1/
##API for selling trades limit
const body={
"userUid":userUid,
"coinCode":coinCode,
"amount":amount,
"priceUnit":priceUnit,
"limitPrice":limitPrice
}
bitrus.tradesLimitsell().then(data => console.log(data))
###RESULT
###API Description
|Keys | Description | |-----|-------------| |params | all the body elements| | coincode | cryptocurrency code | | amount | amount the buyer willing to buy | | priceUnit | price per unit of cyptocurrency | | limitPrice |price limit of the buyer he can not buy higher than limitPrice value of cyptocurrency in quoteCurrency|
##API for crypto withrawal
const body={
"userUid":userUid,
"quantity":quantity,
"coinCode":coinCode,
"toAddress":toAddress
}
bitrus.withdrawCrypto().then(data =>console.log(data))
#RESULT
{
"meta": {
"msg": "Withdrawal Request generate for eth. Your request will be full fill within 24-48 working hr.",
"status": true
}
}
#API Description | Keys |Description| |-------|-----------| |params | all the body elements| | quantity | quantity of the cryptocurrency you wish to withdraw| | coinCode| code for the cryptocurrency you wish to withdraw|
##API for crypto Deposit
const userUid ; //userId from the bitrus auth
const coinCode; // cryptocurrency code you wants to deposit
bitrus.depositCrypto(userUid,coinCode).then(data => console.log(data))
###RESULT
{
"meta": {
"msg": "new transaction addedd sucessfully",
"status": true
}
#API Description
| keys |Description| |-------|-----------| | coinCode | cryptocurrency code you wants to deposit|
##API for Fiat deposit
const body={
"bankName":bankName,
"acNumber":acNumber,
"refNumber":refNumber,
"beneficiary":beneficiary,
"userUid":userUid
}
bitrus.depositFiat().then(data => console.log(data))
###Result
{
"meta": {
"msg": "Thank you. We'll deposit money in your account in 72 working hours",
"status": true
}
}
#API Description
| keys |Description| |-------|-----------| | params | all the body elements| |bankName| bank name of the beneficiary| |acnumber| Account number of the beneficiary| | refNumber | reference number for the transaction| |beneficiary | beneficiary name|
##API for fiat withdrawal
const body={
"userUid":userUid,
"bankName":bankName,
"acNumber":acNumber,
"beneficiary":beneficiary,
"amount":amount,
"swiftCode":swiftCode
}
bitrus.withdrawFiat().then(data => console.log(data))
###Result
#API Description |Keys | description| | params | all the body elements| |bankName | name of the of beneficiary | | acNumber | Account number of the beneficiary | | beneficiary | beneficiary name | |amount | amount of the fiat you wish to withdraw | |swiftCode | swiftcode of the user|
##API for Order history of a user
const params ={
userUid : userUid
}
bitrus.userOrderHistory(params.userUid).then(response => console.log(response))
###Result
{
"info": {
"totalSize": 1
},
"meta": {
"msg": "orders history",
"status": true
},
"data": [
{
"time": 5150580562307,
"date": "2009-02-19T13:44:42.320Z",
"filled": 0,
"transactionFees": null,
"transactionFeesAsset": null,
"isCancel": true,
"avgTradePrice": null,
"_id": "5c6c054ce082b8351ca490c5",
"orderId": "7h9c054ce082b8315ca490c5",
"userUid": "8j06d832ed84cd1128542t76",
"txnId": "56t9eb0f-45a4-6ytb-7f43-9a56832bett7",
"type": "buy",
"baseCoinCode": "qash",
"quoteCoinCode": "usd",
"originalQty": 5,
"left": 5,
"marketPrice": 0,
"orderStatus": "cancelled",
"isFullfilled": false,
"orderType": "limit",
"pair": "qash_usd",
"limitPrice": 3,
"__v": 0
}]
}
#API Description |keys | description| |-------|-----------| |params | you can get the useruid from bitrus auth api|
##API for open order history
const params ={
useruid:userUid
}
bitrus.allOpenOrders(params.userUid).then(responce => console.log(response))
#Result
{
"info": {
"totalSize": 1
},
"meta": {
"msg": "open orders",
"status": true
},
"data": [
{
"time": 155045555507,
"date": "2011-02-19T12:44:42.307Z",
"filled": 0,
"transactionFees": null,
"transactionFeesAsset": null,
"isCancel": false,
"avgTradePrice": null,
"_id": "5c6c0502e082b8351a34dfvc2",
"orderId": "5c6c0502e082b8z434fdgc90c2",
"userUid": "we4346ed6eytr6eryy2",
"txnId": "qq43w53wtew554af-w3w78d-123w2-3w36-a54tyrt640a6",
"type": "buy",
"baseCoinCode": "powr",
"quoteCoinCode": "usd",
"originalQty": 8,
"left": 8,
"marketPrice": 0,
"orderStatus": "open",
"isFullfilled": false,
"orderType": "limit",
"pair": "powr_usd",
"limitPrice": 3,
"__v": 0
}
]
}
#Api Description |Keys | description| |------|------------| |API reference | for getting information about the all open orders| |param|params element i.e userUid you can get it from bitrus auth api|
##API for single order details
const param={
orderid:orderId
}
bitrus.singleOrder(param.orderId).then(data => console.log(data))
#Result
{
"meta": {
"msg": "order",
"status": true
},
"data": {
"_id": "5c6c054ce082b855667ghc5",
"time": 155567670000,
"date": "2029-02-19T12:44:42.227Z",
"filled": 0,
"transactionFees": null,
"transactionFeesAsset": null,
"isCancel": true,
"avgTradePrice": null,
"orderId": "5c6c044ce099b8351ca49u05",
"userUid": "7u56d832ud84td3326742e42",
"txnId": "36n8en9f-54y4-9iob-7u89-9a40889oidd0",
"type": "buy",
"baseCoinCode": "qash",
"quoteCoinCode": "usd",
"originalQty": 5,
"left": 5,
"marketPrice": 0,
"orderStatus": "cancelled",
"isFullfilled": false,
"orderType": "limit",
"pair": "qash_usd",
"limitPrice": 3,
"__v": 0
}
}
#API Description | Keys | Description |------|------------| |orderId | your orderId for the transaction | |pair | pair of cryptocurrencies |
##API for particular coinpairs open order
const params:{
userUid:userUid,
pai:pair
}
bitrus.openOrderPair().then(response => console.log(response))
###Result
{
"info": {
"totalSize": 0
},
"meta": {
"msg": "open orders",
"status": true
},
"data": [
]
}
#API Description
|Keys | description| |------|------------| |param| all the elements of params(e.g: params.pair ) |
##API for crypto history
const userUid='';
const coincode='';
bitrus.cryptoHistory(userUid,coinCode).then(response => console.log(response))
###Result
{
"info": {
"totalSize": 1
},
"meta": {
"msg": "crypto request history",
"status": true
},
"data": [
{
"isCancel": false,
"_id": "5yyy0482d4y88b6ab7a0po0a",
"userUid": "8iuytc0bb53ebi9foi2f1bhy",
"coinCode": "eth",
"totalPrice": 0.065664,
"fiatUnit": "usd",
"txnStatus": "pending",
"txnStatusBool": false,
"commission": 0,
"type": "withdrawal",
"requestedQuantity": 0.0004,
"finalQuantity": 0.0004,
"createdAt": 1556867870851,
"updatedAt": 1229874370851,
"requestId": "a42by0b1-7347-bi51-27y9-c6y67524a8d",
"__v": 0
}
]
}
#API Description
|keys |Description| |-----|------------| | param | userUid and coinCode | |coinCode | cryptocurrency code of the coin you wants to know the history of|
##Api for fiat history
const userId;
bitrus.fiatHistory(userId).then(response => console.log(response))
###Result
{
"info": {
"totalSize": 1
},
"meta": {
"msg": "fiat request history",
"status": true
},
"data": [
{
"txnStatus": "verified",
"txnStatusBool": true,
"returnMoney": 0,
"isCancel": false,
"_id": "ty7800e8b67y0b5faf2c2w3b",
"userUid": "v6iifc0bb53eby8kof2f5ucv",
"bankName": "Banco Autofin",
"accountNumber": "165478",
"referenceNumber": "agyu",
"type": "deposit",
"createdAt": 5601368678852,
"updatedAt": 7891098539783,
"requestId": "eb8ut6ec-d9g4-7n03-748c-52c3909hj5304",
"__v": 0,
"finalAmount": 10000,
"requestedAmount": 10000
}
]
}
#API description |Keys | Description | |userId | you can get it from birus auth api|
##API for cancel Order
const orderId;
bitrus.cancelOrder(orderId).then(response => console.log(response))
###Result
{
"meta": {
"msg": "Order already cancelled",
"status": false
}
}
#API Description |Keys | Description | |---|-----------------| |orderId | Id for the order you wish to cancel|