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

@stacksavings/poloniex-client

v1.1.31

Published

Poloniex Client

Downloads

102

Readme

Stacksavings - Poloniex Client

Hemos creado un paquete "@stacksavings/poloniex-client" para poder usar los metodos de Public y Trading API de Poloniex.

Table of contents

Getting Started

Installing

Para poder instalar el cliente solo basta con ejecutar el comando:

npm i @stacksavings/poloniex-client

Usage

Para empezar a usarlo solo debe de incluirlo en tu código asi:

const client = require('@stacksavings/poloniex-client')

Public API Methods

  • currenciesAvailable:
const logger = require('@stacksavings/utils').log()
const client = require(@stacksavings/poloniex-client)
const currencies = client.currenciesAvailable()

currencies.then(data => {
  logger.info(data);
}, err => {
  logger.error(err);
})

    Output:

{
  "1CR":{
         "maxDailyWithdrawal":10000,
         "txFee":0.01,
         "minConf":3,
         "disabled":0
        },
  "ABY":{
         "maxDailyWithdrawal":10000000,
         "txFee":0.01,
         "minConf":8,
         "disabled":0
        },
   ...
}
  • returnChartData:
const logger = require('@stacksavings/utils').log()
const client = require('./poloniex-client')
const TimeStamp = require('@stacksavings/utils')

let parameters = {
  currencyPair: "BTC_LTC",
  period: 14400,
  start: TimeStamp.toTimeStampUnix(20171218),
  end: TimeStamp.toTimeStampUnix(20171219)
}

const ChartData = client.returnChartData(parameters)
ChartData.then(data => {
  logger.info(data);
}, err => {
  logger.error(err);
})

    Output:

[
  {
    "date":1405699200,
    "high":0.0045388,
    "low":0.00403001,
    "open":0.00404545,
    "close":0.00427592,
    "volume":44.11655644,
    "quoteVolume":10259.29079097,
    "weightedAverage":0.00430015
  },
  ...
]

Trading API Methods

Estos métodos requieren el "Key" y "Secret" asociado a la organización Stacksavings.

  • buy:

    Example to call it:

const logger = require('@stacksavings/utils').log()
const client = require(@stacksavings/poloniex-client)

let parameters = {
  currencyPair: 'BTC_ETH',
  amount: 0.008,
  rate: 0.058,
}
let credentials = {
  key: 'KEY STRING',
  secret: 'SECRET STRING'
}

const buyer = client.buy(parameters,credentials)
buyer.then(data => {
  logger.info(data);
}, err => {
  logger.error(err);
})

    Output:

{
  "orderNumber":31226040,
  "resultingTrades":[
                     {
                      "amount":"338.8732",
                      "date":"2014-10-18 23:03:21",
                      "rate":"0.00000173",
                      "total":"0.00058625",
                      "tradeID":"16164",
                      "type":"buy"
                     }
                    ]
}
  • sell:

    Example to call it:

const logger = require('@stacksavings/utils').log()
const client = require(@stacksavings/poloniex-client)

let parameters = {
  currencyPair: 'BTC_ETH',
  amount: 0.008,
  rate: 0.058,
}
let credentials = {
  key: 'KEY STRING',
  secret: 'SECRET STRING'
}

const seller = client.sell(parameters,credentials)
seller.then(data => {
  logger.info(data);
}, err => {
  logger.error(err);
})

    Output:

{
  "orderNumber":31226040,
  "resultingTrades":[
                     {
                      "amount":"338.8732",
                      "date":"2014-10-18 23:03:21",
                      "rate":"0.00000173",
                      "total":"0.00058625",
                      "tradeID":"16164",
                      "type":"sell"
                     }
                    ]
}
  • returnBalances:

    Example to call it:

const logger = require('@stacksavings/utils').log()
const client = require(@stacksavings/poloniex-client)

let credentials = {
  key: 'KEY STRING',
  secret: 'SECRET STRING'
}

const balances = client.returnBalances(credentials)
balances.then(data => {
  logger.info(data);
}, err => {
  logger.error(err);
})

    Output:

{
  "BTC":"0.59098578",
  "LTC":"3.31117268",
  ...
}
  • returnCompleteBalances:

    Example to call it:

const logger = require('@stacksavings/utils').log()
const client = require(@stacksavings/poloniex-client)

let credentials = {
  key: 'KEY STRING',
  secret: 'SECRET STRING'
}

const balances = client.returnCompleteBalances(credentials)
balances.then(data => {
  logger.info(data);
}, err => {
  logger.error(err);
})

    Output:

{
  "LTC":
    {
      "available":"5.015",
      "onOrders":"1.0025",
      "btcValue":"0.078"
    },
  "NXT:{...} 
  ...
}

Creators

Stacksavings

  • https://site.stacksavings.com

David Molina

  • https://dmolina101.github.io