Simple LiveCoin API wrapper for Node.js
LiveCoin API documentation can be found at https://www.livecoin.net/api/common
npm install livecoin-api
Go to https://www.livecoin.net and make an account. On https://www.livecoin.net/api, you will be able to get an API key and secret.
const LiveCoin = require('livecoin-api');
const client = new LiveCoin('key here', 'secret here');
client.getTicker('btc', 'usd').then(console.log).catch(console.error);
client.getAllTickers().then(console.log).catch(console.error);
client.getCurrencies().then(console.log).catch(console.error);
See the examples directory for more examples.
npm test
- LiveCoin
- login
- getTicker
- getAllTickers
- getLastTrades
- getOrders
- getAllOrders
- getBidAndAsk
- getAllBidsAndAsks
- getRestrictions
- getCurrencies
- getUserTrades
- getClientOrders
- getUserOrder
- getBalances
- getBalance
- getTransactions
- getNumTransactions
- getTradingFee
- getTradingFeeAndVolume
- buyLimit
- sellLimit
- buyMarket
- sellMarket
- cancelLimit
- getAddress
- withdraw
- toPayeer
- toCapitalist
- toAdvcash
- toYandex
- toQiwi
- toBankCard
- toMastercard
- toOkpay
- toPerfectMoney
- makeVoucher
- getVoucherAmount
- redeemVoucher
Class representing LiveCoin client
Parameters
apiKey
(optional, default''
)apiSecret
(optional, default''
)
Set client's API key and secret after constructing the object
Parameters
Examples
client.login('key here', 'secret here');
Get ticker information
Parameters
Examples
client.getTicker('btc', 'usd').then(console.log).catch(console.error);
Returns Object ticker information
Get all tickers' information
Examples
client.getAllTickers().then(console.log).catch(console.error);
Returns Object all tickers' information
Get information on most recent trades
Parameters
ticker
string currency tickerpair
string currency being traded withoptions
Object? options for the query (optional, default{}
)
Examples
client.getLastTrades('btc', 'usd').then(console.log);
client.getLastTrades('eth', 'btc', {minOrHr: true}).then(console.log);
Returns Object information on most recent trades
Get information on orders
Parameters
ticker
string currency tickerpair
string currency being traded withoptions
Object? options for the query (optional, default{}
)
Examples
client.getOrders('btc', 'usd').then(console.log).catch(console.log);
client.getOrders('eth', 'btc', {groupByPrice: true, depth: 4}).then(console.log);
Returns Object information on orders
Get information on orders for all exchanges
Parameters
options
Object? options for the query (optional, default{}
)
Examples
client.getAllOrders().then(console.log).catch(console.log);
client.getAllOrders({groupByPrice: true, depth: 4}).then(console.log);
Returns Object information on orders for all exchanges
Get maximum bid and minimum ask for a currency
Parameters
Examples
client.getBidAndAsk('btc', 'usd').then(console.log).catch(console.error);
Returns Object maximum bid and minimum ask
Get maximum bid and minimum ask for all currencies
Examples
client.getAllBidsAndAsks().then(console.log).catch(console.error);
Returns Object maximum bid and minimum ask for all currencies
Get minimum amount to open order for all currencies
Examples
client.getRestrictions().then(console.log).catch(console.error);
Returns Object minimum amount to open order for all currencies
Get minimum amount to open order for all currencies
Examples
client.getCurrencies().then(console.log).catch(console.error);
Returns Object minimum amount to open order for all currencies
Get information on user's recent trades, requires API key and secret
Parameters
options
Object? options for the query (optional, default{}
)
Examples
client.getUserTrades({orderDesc: true, limit: 4}).then(console.log);
Returns Object information on user's trades
Get information on user's orders, requires API key and secret
Parameters
options
Object? options for the query (optional, default{}
)options.currencyPair
string? exchange in the format BTC/USDoptions.openClosed
string? type of order, e.g 'ALL' or 'OPEN'options.issuedFrom
number? start date in UNIX formatoptions.issuedTo
number? end date in UNIX formatoptions.startRow
number? sequence number of first recordoptions.endRow
number? sequence number of last record
Examples
client.getClientOrders({openClosed: 'CANCELLED', startRow: 2}).then(console.log);
Returns Object information on user's orders
Get order information, requires API key and secret
Parameters
orderId
number ID of the order, e.g. 88504958
Examples
client.getUserOrder(88504958).then(console.log).catch(console.error);
Returns Object order information
Get information on balances, requires API key and secret
Parameters
currency
string? will return all balances if not given, e.g. USD (optional, default''
)
Examples
client.getBalances().then(console.log).catch(console.error);
Returns Array<Object> information on balances
Get information on balance for a currency, requires API key and secret
Parameters
currency
string currency to get balance for, e.g. BTC
Examples
client.getBalance('BTC').then(console.log).catch(console.error);
Returns Object information on balances
Get list of transactions, requires API key and secret
Parameters
start
string start date in UNIX formatend
string end date in UNIX formatoptions
Object? options for the query (optional, default{}
)
Examples
client.getTransactions('1409920436000', '1409920636000',
{types: 'BUY', limit: 2}).then(console.log).catch(console.error);
Returns Array<Object> list of transactions in the date range
Get number of transactions, requires API key and secret
Parameters
Examples
client.getNumTransactions('1409920436000', '1409920636000', 'BUY').then(console.log);
Returns number number of transactions in the date range
Get customer's trading fee
Examples
client.getTradingFee().then(console.log).catch(console.error);
Returns Object trading fee
Get customer's trading fee and volume
Examples
client.getTradingFeeAndVolume().then(console.log).catch(console.error);
Returns Object trading fee and volume
Make a buy limit order
Parameters
ticker
string currency tickerpair
string currency being traded withprice
number price of currencyquantity
number amount of currency to buy
Examples
client.buyLimit('btc', 'usd', 10000, 0.1).then(console.log);
Returns Object order ID
Make a sell limit order
Parameters
ticker
string currency tickerpair
string currency being traded withprice
number price of currencyquantity
number amount of currency to sell
Examples
client.sellLimit('btc', 'usd', 10000, 0.1).then(console.log);
Returns Object order ID
Make a buy market order
Parameters
ticker
string currency tickerpair
string currency being traded withquantity
number amount of currency to buy
Examples
client.buyMarket('btc', 'usd', 0.1).then(console.log);
Returns Object order ID
Make a sell market order
Parameters
ticker
string currency tickerpair
string currency being traded withquantity
number amount of currency to sell
Examples
client.sellMarket('btc', 'usd', 0.1).then(console.log);
Returns Object order ID
Cancel order
Parameters
ticker
string currency tickerpair
string currency being traded withorderId
number ID of order to cancel
Examples
client.cancelLimit('btc', 'usd', 1111).then(console.log);
Returns Object order ID
Get wallet address for a currency
Parameters
ticker
string currency ticker
Examples
client.getAddress('btc').then(console.log);
Returns Object wallet address
Withdraw to wallet address
Parameters
Examples
client.withdraw(1, 'usd', '1MfTTxGnBBgvyk9477hWurosfqj8MZKkAG')
.then(console.log);
Returns Object information on withdrawal
Withdraw to Payeer account
Parameters
amount
number amount to withdrawticker
string currency tickerwallet
string wallet addressoptions
Object? options object (optional, default{}
)
Examples
client.toPayeer(1, 'usd', '1MfTTxGnBBgvyk9477hWurosfqj8MZKkAG')
.then(console.log);
Returns Object information on withdrawal
Withdraw to Capitalist account
Parameters
amount
number amount to withdrawcurrency
string can be USD, EUR, or RUR onlywallet
string wallet address
Examples
client.toCapitalist(1, 'USD', 'U0000001')
.then(console.log);
Returns Object information on withdrawal
Withdraw to Advcash account
Parameters
amount
number amount to withdrawcurrency
string can be USD, EUR, or RUR onlywallet
string wallet address
Examples
client.toAdvcash(1, 'USD', 'U123456789012')
.then(console.log);
Returns Object information on withdrawal
Withdraw to Yandex account
Parameters
Examples
client.toYandex(1, 'RUR', '410011234567890')
.then(console.log);
Returns Object information on withdrawal
Withdraw to Qiwi account
Parameters
amount
number amount to withdrawcurrency
string can be RUR onlywallet
string wallet address including country code without '+'
Examples
client.toQiwi(1, 'RUR', '79036660099')
.then(console.log);
Returns Object information on withdrawal
Withdraw to bank card
Parameters
amount
number amount to withdrawcurrency
string can be USD, EUR, or RUR onlyaccount
string bank account number
Examples
client.toBankCard(1, 'USD', '5567025017512543', '09', '18')
.then(console.log);
Returns Object information on withdrawal
Withdraw to Mastercard card
Parameters
amount
number amount to withdrawcurrency
string can be USD or EUR onlycardNumber
string Card numbercardHolder
string Cardholder namecardHolderCountry
string Cardholder country in ISO 3166-1 alpha-2 format (e.g. RU)cardHolderCity
string Cardholder citycardHolderDOB
string Cardholder DOB in YYYY-MM-DD formatcardHolderMobilePhone
string Cardholder phone number including country code without '+'
Examples
client.toMastercard(1, 'USD', '1234123412341234',
'John Smith', 'US', 'Dallas', '1968-05-15', '79036660099')
.then(console.log);
Returns Object information on withdrawal
Withdraw to Okpay card
Parameters
amount
number amount to withdrawcurrency
string can be USD, EUR, or RUR onlywallet
string account walletinvoice
number? optional invoice number (optional, default''
)
Examples
client.toOkpay(1, 'USD', 'OK123456789')
.then(console.log);
Returns Object information on withdrawal
Withdraw to PerfectMoney account
Parameters
amount
number amount to withdrawticker
string currency tickerwallet
string wallet addressoptions
Object? options object (optional, default{}
)
Examples
client.toPerfectMoney(1, 'usd', '1MfTTxGnBBgvyk9477hWurosfqj8MZKkAG')
.then(console.log);
Returns Object information on withdrawal
Creates a voucher
Parameters
amount
number amount to withdrawticker
string currency tickerdescription
string? purpose of payment (optional, default''
)
Examples
client.makeVoucher(1, 'usd', 'need a voucher')
.then(console.log);
Returns string voucher code
Get voucher amount from voucher code
Parameters
voucherCode
string voucher code
Examples
client.getVoucherAmount('LVC-USD-12345678-87654321-ABCDEFGI-ABCD1234')
.then(console.log);
Returns string voucher amount
Redeem voucher from code
Parameters
voucherCode
string voucher code
Examples
client.redeemVoucher('LVC-USD-12345678-87654321-ABCDEFGI-ABCD1234')
.then(console.log);
Returns Object information on voucher redeeming
Contributions welcome!
# 1. Fork the repo and clone it to your computer
$ git clone https://github.com/your-username/livecoin-api.git
$ cd livecoin-api
# 2. Connect your fork with this repo to stay up to date on any changes
$ git remote add upstream https://github.com/abhinavk99/livecoin-api.git
# 3. Make your feature branch
$ git checkout -b new-feature
# 4. Test your changes
$ npm test
# 5. Add and commit the changes you made
$ git add .
$ git commit -m "Added new feature"
# 6. Push to your branch
$ git push origin new-feature
# 7. Create a pull request on GitHub
Alternatively, feel free to open an issue.