abhinavk99 / Livecoin Api
Programming Languages
Labels
Projects that are alternatives of or similar to Livecoin Api
livecoin-api
Simple LiveCoin API wrapper for Node.js
LiveCoin API documentation can be found at https://www.livecoin.net/api/common
Installation
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.
Usage
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.
Tests
npm test
API
Table of Contents
-
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
LiveCoin
Class representing LiveCoin client
Parameters
-
apiKey
(optional, default''
) -
apiSecret
(optional, default''
)
login
Set client's API key and secret after constructing the object
Parameters
Examples
client.login('key here', 'secret here');
getTicker
Get ticker information
Parameters
Examples
client.getTicker('btc', 'usd').then(console.log).catch(console.error);
Returns Object ticker information
getAllTickers
Get all tickers' information
Examples
client.getAllTickers().then(console.log).catch(console.error);
Returns Object all tickers' information
getLastTrades
Get information on most recent trades
Parameters
-
ticker
string currency ticker -
pair
string currency being traded with -
options
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
getOrders
Get information on orders
Parameters
-
ticker
string currency ticker -
pair
string currency being traded with -
options
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
getAllOrders
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
getBidAndAsk
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
getAllBidsAndAsks
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
getRestrictions
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
getCurrencies
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
getUserTrades
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
getClientOrders
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/USD -
options.openClosed
string? type of order, e.g 'ALL' or 'OPEN' -
options.issuedFrom
number? start date in UNIX format -
options.issuedTo
number? end date in UNIX format -
options.startRow
number? sequence number of first record -
options.endRow
number? sequence number of last record
-
Examples
client.getClientOrders({openClosed: 'CANCELLED', startRow: 2}).then(console.log);
Returns Object information on user's orders
getUserOrder
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
getBalances
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
getBalance
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
getTransactions
Get list of transactions, requires API key and secret
Parameters
-
start
string start date in UNIX format -
end
string end date in UNIX format -
options
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
getNumTransactions
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
getTradingFee
Get customer's trading fee
Examples
client.getTradingFee().then(console.log).catch(console.error);
Returns Object trading fee
getTradingFeeAndVolume
Get customer's trading fee and volume
Examples
client.getTradingFeeAndVolume().then(console.log).catch(console.error);
Returns Object trading fee and volume
buyLimit
Make a buy limit order
Parameters
-
ticker
string currency ticker -
pair
string currency being traded with -
price
number price of currency -
quantity
number amount of currency to buy
Examples
client.buyLimit('btc', 'usd', 10000, 0.1).then(console.log);
Returns Object order ID
sellLimit
Make a sell limit order
Parameters
-
ticker
string currency ticker -
pair
string currency being traded with -
price
number price of currency -
quantity
number amount of currency to sell
Examples
client.sellLimit('btc', 'usd', 10000, 0.1).then(console.log);
Returns Object order ID
buyMarket
Make a buy market order
Parameters
-
ticker
string currency ticker -
pair
string currency being traded with -
quantity
number amount of currency to buy
Examples
client.buyMarket('btc', 'usd', 0.1).then(console.log);
Returns Object order ID
sellMarket
Make a sell market order
Parameters
-
ticker
string currency ticker -
pair
string currency being traded with -
quantity
number amount of currency to sell
Examples
client.sellMarket('btc', 'usd', 0.1).then(console.log);
Returns Object order ID
cancelLimit
Cancel order
Parameters
-
ticker
string currency ticker -
pair
string currency being traded with -
orderId
number ID of order to cancel
Examples
client.cancelLimit('btc', 'usd', 1111).then(console.log);
Returns Object order ID
getAddress
Get wallet address for a currency
Parameters
-
ticker
string currency ticker
Examples
client.getAddress('btc').then(console.log);
Returns Object wallet address
withdraw
Withdraw to wallet address
Parameters
Examples
client.withdraw(1, 'usd', '1MfTTxGnBBgvyk9477hWurosfqj8MZKkAG')
.then(console.log);
Returns Object information on withdrawal
toPayeer
Withdraw to Payeer account
Parameters
-
amount
number amount to withdraw -
ticker
string currency ticker -
wallet
string wallet address -
options
Object? options object (optional, default{}
)
Examples
client.toPayeer(1, 'usd', '1MfTTxGnBBgvyk9477hWurosfqj8MZKkAG')
.then(console.log);
Returns Object information on withdrawal
toCapitalist
Withdraw to Capitalist account
Parameters
-
amount
number amount to withdraw -
currency
string can be USD, EUR, or RUR only -
wallet
string wallet address
Examples
client.toCapitalist(1, 'USD', 'U0000001')
.then(console.log);
Returns Object information on withdrawal
toAdvcash
Withdraw to Advcash account
Parameters
-
amount
number amount to withdraw -
currency
string can be USD, EUR, or RUR only -
wallet
string wallet address
Examples
client.toAdvcash(1, 'USD', 'U123456789012')
.then(console.log);
Returns Object information on withdrawal
toYandex
Withdraw to Yandex account
Parameters
Examples
client.toYandex(1, 'RUR', '410011234567890')
.then(console.log);
Returns Object information on withdrawal
toQiwi
Withdraw to Qiwi account
Parameters
-
amount
number amount to withdraw -
currency
string can be RUR only -
wallet
string wallet address including country code without '+'
Examples
client.toQiwi(1, 'RUR', '79036660099')
.then(console.log);
Returns Object information on withdrawal
toBankCard
Withdraw to bank card
Parameters
-
amount
number amount to withdraw -
currency
string can be USD, EUR, or RUR only -
account
string bank account number
Examples
client.toBankCard(1, 'USD', '5567025017512543', '09', '18')
.then(console.log);
Returns Object information on withdrawal
toMastercard
Withdraw to Mastercard card
Parameters
-
amount
number amount to withdraw -
currency
string can be USD or EUR only -
cardNumber
string Card number -
cardHolder
string Cardholder name -
cardHolderCountry
string Cardholder country in ISO 3166-1 alpha-2 format (e.g. RU) -
cardHolderCity
string Cardholder city -
cardHolderDOB
string Cardholder DOB in YYYY-MM-DD format -
cardHolderMobilePhone
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
toOkpay
Withdraw to Okpay card
Parameters
-
amount
number amount to withdraw -
currency
string can be USD, EUR, or RUR only -
wallet
string account wallet -
invoice
number? optional invoice number (optional, default''
)
Examples
client.toOkpay(1, 'USD', 'OK123456789')
.then(console.log);
Returns Object information on withdrawal
toPerfectMoney
Withdraw to PerfectMoney account
Parameters
-
amount
number amount to withdraw -
ticker
string currency ticker -
wallet
string wallet address -
options
Object? options object (optional, default{}
)
Examples
client.toPerfectMoney(1, 'usd', '1MfTTxGnBBgvyk9477hWurosfqj8MZKkAG')
.then(console.log);
Returns Object information on withdrawal
makeVoucher
Creates a voucher
Parameters
-
amount
number amount to withdraw -
ticker
string currency ticker -
description
string? purpose of payment (optional, default''
)
Examples
client.makeVoucher(1, 'usd', 'need a voucher')
.then(console.log);
Returns string voucher code
getVoucherAmount
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
redeemVoucher
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
Contributing
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.