SkillAgentSearch skills...

Kucoin Api

npm module for the KuCoin API.

Install / Use

npx skills add Satoshinaire/kucoin-api

Installs into whichever agent you are using.

About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<p align="center"> <img src="https://user-images.githubusercontent.com/30309816/31295829-c8d25310-ab2b-11e7-8885-fb335d0c3baf.png" width="125px;"> </p> <h1 align="center">KuCoin API Client</h1> <p align="center"> A Node.js client for the [KuCoin](https://www.kucoin.com/) API. </p>

Overview

What does it currently do

The KuCoin API documentation is not too bad, though some holes and inconsistencies. This Node.js client attempts to make up for some of those. 25 of the 29 endpoints are supported, the missing ones are mainly relating to Kline data.

Get help or give help

  • Open a new issue if you encounter a problem.
  • Or ping @satoshinaire on Twitter.
  • Pull requests welcome.

Getting started

Installation

npm install --save kucoin-api

Usage

'use strict'

require('dotenv').config()
const Kucoin = require('kucoin-api')

let kc = new Kucoin(process.env.KUCOIN_API_KEY, process.env.KUCOIN_API_SECRET)

kc.getBalance({
    symbol: 'GAS'
  })
  .then((result) => {
    console.log(result)
  })
  .catch((err) => {
    console.log(err)
  })

API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

Kucoin

A Node.js client for the KuCoin API.

Parameters

  • apiKey string Your KuCoin API Key.
  • apiSecret string Your KuCoin API Secret.

Examples

let kc = new Kucoin();

Meta

  • version: 0.0.2

getExchangeRates

Retrieve exchange rates for coins.

Parameters

  • params {symbols: Array<string>}? An Array of symbols, or if blank BTC will be returned. (optional, default {})

Examples

Specify one or more symbols:

kc.getExchangeRates({
  symbols: ['NEO','GAS']
}).then(console.log).catch(console.error)

// Returns:

{
  "success": true,
  "code": "OK",
  "msg": "Operation succeeded.",
  "timestamp": 1509589905631,
  "data": {
    "currencies": [["USD", "$"], ["EUR", "€"], ["AUD", "$"], ["CAD", "$"], ["CHF", "CHF"], ["CNY", "¥"], ["GBP", "£"], ["JPY", "¥"], ["NZD", "$"], ["BGN", "лв."], ["BRL", "R$"], ["CZK", "Kč"], ["DKK", "kr"], ["HKD", "$"], ["HRK", "kn"], ["HUF", "Ft"], ["IDR", "Rp"], ["ILS", "₪"], ["INR", "₹"], ["KRW", "₩"], ["MXN", "$"], ["MYR", "RM"], ["NOK", "kr"], ["PHP", "₱"], ["PLN", "zł"], ["RON", "lei"], ["RUB", "₽"], ["SEK", "kr"], ["SGD", "$"], ["THB", "฿"], ["TRY", "₺"], ["ZAR", "R"]],
    "rates": {
      "GAS": { "CHF": 14.57, "HRK": 94.19, "MXN": 279.02, "ZAR": 205.31, "INR": 939.59, "CNY": 96.15, "THB": 482.3, "AUD": 18.95, "ILS": 51.16, "KRW": 16176.81, "JPY": 1660.88, "PLN": 53.03, "GBP": 10.94, "IDR": 197577.69, "HUF": 3904.86, "PHP": 751.63, "TRY": 55.6, "RUB": 845.61, "HKD": 113.47, "EUR": 12.52, "DKK": 93.21, "USD": 14.54, "CAD": 18.77, "MYR": 61.54, "BGN": 24.49, "NOK": 118.5, "RON": 57.66, "SGD": 19.8, "CZK": 320.11, "SEK": 122.16, "NZD": 21.12, "BRL": 47.78
      },
      "NEO": {
        "CHF": 25.33, "HRK": 163.66, "MXN": 484.81, "ZAR": 356.73, "INR": 1632.55, "CNY": 167.07, "THB": 838.01, "AUD": 32.94, "ILS": 88.89, "KRW": 28107.31, "JPY": 2885.78, "PLN": 92.14, "GBP": 19.01, "IDR": 343292.4, "HUF": 6784.72, "PHP": 1305.97, "TRY": 96.61, "RUB": 1469.25, "HKD": 197.16, "EUR": 21.76, "DKK": 161.95, "USD": 25.27, "CAD": 32.61, "MYR": 106.93, "BGN": 42.56, "NOK": 205.9, "RON": 100.18, "SGD": 34.4, "CZK": 556.2, "SEK": 212.27, "NZD": 36.7, "BRL": 83.02
      }
    }
  }
}

Retrieve data for BTC by default:

kc.getExchangeRates().then(console.log).catch(console.error)

// Returns:

{
  "success": true,
  "code": "OK",
  "msg": "Operation succeeded.",
  "timestamp": 1509590207497,
  "data": {
    "rates": {
      "BTC": { "CHF": 6817.62, "HRK": 44045.89, "MXN": 130476.13, "ZAR": 96007.15, "INR": 439363.98, "CNY": 44963.39, "THB": 225531.1, "AUD": 8865.49, "ILS": 23923.57, "KRW": 7564405.86, "JPY": 776640.44, "PLN": 24798.21, "GBP": 5118.25, "IDR": 92388859.2, "HUF": 1825945.01, "PHP": 351470.78, "TRY": 26002.05, "RUB": 395413.97, "HKD": 53061.7, "EUR": 5857.14, "DKK": 43586.13, "USD": 6801.3, "CAD": 8777.75, "MYR": 28779.7, "BGN": 11455.42, "NOK": 55414.27, "RON": 26962.39, "SGD": 9259.28, "CZK": 149689.81, "SEK": 57127.51, "NZD": 9878.88, "BRL": 22344.99
      }
    },
    "currencies": [["USD", "$"], ["EUR", "€"], ["AUD", "$"], ["CAD", "$"], ["CHF", "CHF"], ["CNY", "¥"], ["GBP", "£"], ["JPY", "¥"], ["NZD", "$"], ["BGN", "лв."], ["BRL", "R$"], ["CZK", "Kč"], ["DKK", "kr"], ["HKD", "$"], ["HRK", "kn"], ["HUF", "Ft"], ["IDR", "Rp"], ["ILS", "₪"], ["INR", "₹"], ["KRW", "₩"], ["MXN", "$"], ["MYR", "RM"], ["NOK", "kr"], ["PHP", "₱"], ["PLN", "zł"], ["RON", "lei"], ["RUB", "₽"], ["SEK", "kr"], ["SGD", "$"], ["THB", "฿"], ["TRY", "₺"], ["ZAR", "R"]]
  }
}

Returns Promise An object containing the API response.

getLanguages

Retrieve a list of supported languages.

Examples

kc.getLanguages().then(console.log).catch(console.error)

// Returns:

{
  "success": true,
  "code": "OK",
  "msg": "Operation succeeded.",
  "timestamp": 1509590811348,
  "data": [["zh_CN", "中文简体", true], ["zh_HK", "中文繁体", true], ["en_US", "English", true], ["ja_JP", "日本語", true], ["ru_RU", "русский", true], ["pt_PT", "Portugues", true], ["de_DE", "Deutsch", true], ["nl_NL", "Nederlands", true], ["ko_KR", "한국어", true], ["fr_FR", "Français", true], ["es_ES", "Español", false]]
}

Returns Promise An object containing the API response.

changeLanguage

Change the language for your account.

Parameters

  • params {lang: string} The specific language locale to change to from the list provided by getLanguages. (optional, default {})

Examples

kc.changeLanguage({
  lang: 'en_US'
}).then(console.log).catch(console.error)

// Returns:

{
  "success": true,
  "code": "OK",
  "msg": "Operation succeeded.",
  "timestamp": 1509590866149,
  "data": null
}

Returns Promise An object containing the API response.

getUserInfo

Get account information for the authenticated user.

Examples

kc.getUserInfo().then(console.log).catch(console.error)

// Returns:

{
  "success": true,
  "code": "OK",
  "msg": "Operation succeeded.",
  "timestamp": 1509590943414,
  "data": {
    "referrer_code": "XXXXXX",
    "photoCredentialValidated": false,
    "videoValidated": false,
    "language": "en_US",
    "csrf": "XXXXXXXXXXXXXXXXXXXXXXX=",
    "oid": "xxxxxxxxxxxxxxxxxxxxxxxx",
    "baseFeeRate": 1,
    "hasCredential": false,
    "phoneValidated": true,
    "phone": "",
    "credentialValidated": false,
    "googleTwoFaBinding": true,
    "nickname": null,
    "name": "",
    "hasTradePassword": false,
    "currency": null,
    "emailValidated": true,
    "email": "hello@example.com"
  }
}

Returns Promise An object containing the API response.

getInviteCount

Get the number of invitees from the authenticated user's referral code.

Examples

kc.getInviteCount().then(console.log).catch(console.error)

// Returns:

{
  "success": true,
  "code": "OK",
  "msg": "Operation succeeded.",
  "timestamp": 1509591130780,
  "data": {
    "countThree": 0,
    "count": 0,
    "countTwo": 0
  }
}

Returns Promise An object containing the API response.

getPromotionRewardInfo

Get promotion reward info.

Parameters

  • params {symbol: string}? The coin's symbol to retrieve reward info for. (optional, default {})

Examples

Specify a symbol:

kc.getPromotionRewardInfo({
  symbol: 'NEO'
}).then(console.log).catch(console.error)

Retrieve data for all symbols:

kc.getPromotionRewardInfo().then(console.log).catch(console.error)

// Returns:

{
  "success": true,
  "code": "OK",
  "msg": "Operation succeeded.",
  "timestamp": 1509591205512,
  "data": {
    "grantCountDownSeconds": 219994,
    "drawingCount": 0,
    "assignedCount": 0
  }
}

Returns Promise An object containing the API response.

getPromotionRewardSummary

Get promotion reward summary.

Parameters

  • params {symbol: string}? The coin's symbol to retrieve reward summary for. (optional, default {})

Examples

Specify a symbol:

kc.getPromotionRewardSummary({
  symbol: 'NEO'
}).then(console.log).catch(console.error)

Retrieve data for all symbols:

kc.getPromotionRewardSummary().then(console.log).catch(console.error)

// Returns:

{
  "success": true,
  "code": "OK",
  "msg": "Operation succeeded.",
  "timestamp": 1509591324280,
  "data": []
}

Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Ref

Related Skills

View on GitHub
GitHub Stars46
CategoryDevelopment
Updated3y ago
Forks21

Languages

JavaScript

Security Score

75/100

Audited on Sep 26, 2022

No findings