npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-liqui

v1.0.5

Published

An unofficial Node.js wrapper for the Liqui exchange.

Downloads

16

Readme

node-liqui

A unofficial Promise-based Node.js wrapper for the Liqui crypto-currency exchange.

I created a package because I had found other package in which errors were and it were not fixed.

Install

Install via NPM:

npm install node-liqui

Usage

const Liqui = require('node-liqui');
let liqui = new Liqui(apiKey, apiSecret);

Public Methods

These methods do not require an API Key and API Secret.

Info

All the information about currently active pairs, such as the maximum number of digits after the decimal point, the minimum price, the maximum price, the minimum transaction size, whether the pair is hidden, the commission for each pair.

liqui.info().then( result => {
  console.log(result);
});
/*
{
    "server_time":1370814956,
    "pairs":{
        "eth_btc":{
            "decimal_places":3,
            "min_price":0.1,
            "max_price":400,
            "min_amount":0.01,
            "hidden":0,
            "fee":0.2
        }
        ...
    }
} 
*/

Ticker

Information about currently active pairs, such as: the maximum price, the minimum price, average price, trade volume, trade volume in currency, the last trade, Buy and Sell price. All information is provided over the past 24 hours.

Requires you to send in a trading pair, such as 'eth_btc'.

liqui.ticker('eth_btc').then( result => {
  console.log(result)
});
/*
{
    "eth_btc":{
        "high":109.88,
        "low":91.14,
        "avg":100.51,
        "vol":1632898.2249,
        "vol_cur":16541.51969,
        "last":101.773,
        "buy":101.9,
        "sell":101.773,
        "updated":1370816308
    }
    ...
}
*/

Depth

Information about active orders on the pair.

Requires you to send in a trading pair, such as 'eth_btc'.

liqui.depth('eth_btc').then( result => {
  console.log(result)
});
/*
{
    "eth_btc":{
        "asks":[
            [103.426,0.01],
            [103.5,15],
            [103.504,0.425],
            [103.505,0.1],
            ...
        ],
        "bids":[
            [103.2,2.48502251],
            [103.082,0.46540304],
            [102.91,0.99007913],
            [102.83,0.07832332],
            ...
        ]
    }
    ...
}
*/

Trades

Information about the last trades. Requires you to send in a trading pair, such as 'eth_btc'.

liqui.trades('eth_btc').then( result => {
  console.log(result)
});
/*
{
    "eth_btc":[
        {
            "type":"ask",
            "price":103.6,
            "amount":0.101,
            "tid":4861261,
            "timestamp":1370818007
        },
        {
            "type":"bid",
            "price":103.989,
            "amount":1.51414,
            "tid":4861254,
            "timestamp":1370817960
        },
        ...
    ]
    ...
}
*/

Trade API

These methods require you to provide an API Key and API Secret.

Get Info

Returns information about the user’s current balance, API-key privileges, the number of open orders and Server Time.

liqui.getInfo().then( result => {
  console.log(result)
});
/*
{
    funds":{
        "eth":325,
        "btc":23.998,
        "ltc":0,
        ...
        },
    "rights":{
        "info":1,
        "trade":0,
        "withdraw":0
        },
    "transaction_count":0,
    "open_orders":1,
    "server_time":1342123547
}
*/

Buy

Used to create buy limit orders on the exchange. Note that orders may not be filled immediately.

let params = {
  pair: 'eth_btc',
  rate: 0.1024, // the exchange rate between eth and btc to use
  amount: 1 // the number of ethereum to buy at this rate
}
liqui.buy(params).then( result => {
  console.log(result);
});
/*
{
  "received":0,
  "remains":0.00759027,
  "order_id":212800014,
  "funds":{
    "eth":0.000749800505,
    "btc":0.0002074586994295
  }
}
*/

Sell

Used to create sell limit orders on the exchange. Note that orders may not be filled immediately.

let params = {
  pair: 'eth_btc',
  rate: 0.1024, // the exchange rate between eth and btc to use
  amount: 1 // the number of ethereum to sell at this rate
}
liqui.sell(params).then( result => {
  console.log(result);
});
/*
{
  "received":0,
  "remains":0.00759027,
  "order_id":212800014,
  "funds":{
    "eth":0.000749800505,
    "btc":0.0002074586994295
  }
}
*/

Active Orders

Get your list of active orders. You may optionally provide a trading pair to filter the results returned.

liqui.activeOrders('eth_btc').then( result => {
  console.log(result);
});
/*
{
  "343152":{
    "pair":"eth_btc",
    "type":"sell",
    "amount":12.345,
    "rate":485,
    "timestamp_created":1342448420,
    "status":0
  }
}
*/

Order Info

Returns the information on particular order. Requires an Order Id.

liqui.orderInfo(343152).then( result => {
  console.log(result);
});
/*
{
  "343152":{
    "pair":"eth_btc",
    "type":"sell",
    "amount":12.345,
    "rate":485,
    "timestamp_created":1342448420,
    "status":0
  }
}
*/

Cancel Order

Cancels an open order. Require an Order Id.

liqui.cancelOrder(343152).then( result => {
  console.log(result);
});
/*
{
  "order_id":343154,
  "funds":{
    "eth":325,
    "btc":24.998,
    "ltc":0
  }
}
*/

Trade History

Returns your trade history, filtered based on the parameters you pass in. from - trade ID, from which the display starts count - the number of trades for display, from_id - trade ID, from which the display starts, end_id trade ID on which the display ends, order - Sorting - ASC or DESC since - the time to start the display UTC time end - the time to end the display UTC time pair - pair to be displayed eth_btc (example)

let params = {
  from: '301412',
  count: 50,
  order: 'ASC'
}
liqui.tradeHistory(params).then( result => {
  console.log(result);
});
/*
{
    "166830":{
        "pair":"eth_btc",
        "type":"sell",
        "amount":1,
        "rate":450,
        "order_id":343148,
        "is_your_order":1,
        "timestamp":1342445793
    }
    ...
}
*/