1.1.31 • Published 6 years ago

@stacksavings/poloniex-client v1.1.31

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

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
1.1.31

6 years ago

1.1.30

6 years ago

1.1.29

6 years ago

1.1.28

6 years ago

1.1.27

6 years ago

1.1.26

6 years ago

1.1.25

6 years ago

1.1.24

6 years ago

1.1.23

6 years ago

1.1.22

6 years ago

1.1.21

6 years ago

1.1.20

6 years ago

1.1.19

6 years ago

1.1.18

6 years ago

1.1.17

6 years ago

1.1.16

6 years ago

1.1.15

6 years ago

1.1.14

6 years ago

1.1.13

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago