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
tickerstring currency tickerpairstring currency being traded withoptionsObject? 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
tickerstring currency tickerpairstring currency being traded withoptionsObject? 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
optionsObject? 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
optionsObject? 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
optionsObject? options for the query (optional, default{})options.currencyPairstring? exchange in the format BTC/USDoptions.openClosedstring? type of order, e.g 'ALL' or 'OPEN'options.issuedFromnumber? start date in UNIX formatoptions.issuedTonumber? end date in UNIX formatoptions.startRownumber? sequence number of first recordoptions.endRownumber? 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
orderIdnumber 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
currencystring? 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
currencystring 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
startstring start date in UNIX formatendstring end date in UNIX formatoptionsObject? 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
tickerstring currency tickerpairstring currency being traded withpricenumber price of currencyquantitynumber 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
tickerstring currency tickerpairstring currency being traded withpricenumber price of currencyquantitynumber 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
tickerstring currency tickerpairstring currency being traded withquantitynumber 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
tickerstring currency tickerpairstring currency being traded withquantitynumber amount of currency to sell
Examples
client.sellMarket('btc', 'usd', 0.1).then(console.log);Returns Object order ID
Cancel order
Parameters
tickerstring currency tickerpairstring currency being traded withorderIdnumber 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
tickerstring 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
amountnumber amount to withdrawtickerstring currency tickerwalletstring wallet addressoptionsObject? options object (optional, default{})
Examples
client.toPayeer(1, 'usd', '1MfTTxGnBBgvyk9477hWurosfqj8MZKkAG')
.then(console.log);Returns Object information on withdrawal
Withdraw to Capitalist account
Parameters
amountnumber amount to withdrawcurrencystring can be USD, EUR, or RUR onlywalletstring wallet address
Examples
client.toCapitalist(1, 'USD', 'U0000001')
.then(console.log);Returns Object information on withdrawal
Withdraw to Advcash account
Parameters
amountnumber amount to withdrawcurrencystring can be USD, EUR, or RUR onlywalletstring 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
amountnumber amount to withdrawcurrencystring can be RUR onlywalletstring 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
amountnumber amount to withdrawcurrencystring can be USD, EUR, or RUR onlyaccountstring bank account number
Examples
client.toBankCard(1, 'USD', '5567025017512543', '09', '18')
.then(console.log);Returns Object information on withdrawal
Withdraw to Mastercard card
Parameters
amountnumber amount to withdrawcurrencystring can be USD or EUR onlycardNumberstring Card numbercardHolderstring Cardholder namecardHolderCountrystring Cardholder country in ISO 3166-1 alpha-2 format (e.g. RU)cardHolderCitystring Cardholder citycardHolderDOBstring Cardholder DOB in YYYY-MM-DD formatcardHolderMobilePhonestring 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
amountnumber amount to withdrawcurrencystring can be USD, EUR, or RUR onlywalletstring account walletinvoicenumber? optional invoice number (optional, default'')
Examples
client.toOkpay(1, 'USD', 'OK123456789')
.then(console.log);Returns Object information on withdrawal
Withdraw to PerfectMoney account
Parameters
amountnumber amount to withdrawtickerstring currency tickerwalletstring wallet addressoptionsObject? options object (optional, default{})
Examples
client.toPerfectMoney(1, 'usd', '1MfTTxGnBBgvyk9477hWurosfqj8MZKkAG')
.then(console.log);Returns Object information on withdrawal
Creates a voucher
Parameters
amountnumber amount to withdrawtickerstring currency tickerdescriptionstring? 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
voucherCodestring voucher code
Examples
client.getVoucherAmount('LVC-USD-12345678-87654321-ABCDEFGI-ABCD1234')
.then(console.log);Returns string voucher amount
Redeem voucher from code
Parameters
voucherCodestring 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 GitHubAlternatively, feel free to open an issue.
