Kucoin / kucoin-node-sdk

KuCoin API SDK for Node.js language.
Apache License 2.0
106 stars 53 forks source link

kucoin-node-sdk for KuCoin API

KuCoin API SDK for Node.js language

The detailed document https://docs.kucoin.com.

Latest Version

Env

Nodejs version >= 10.0

Install

# install by npm
npm install kucoin-node-sdk

# install by yarn
yarn add kucoin-node-sdk

Init Configure

module.exports = {
  baseUrl: '',
  apiAuth: {
    key: '', // KC-API-KEY
    secret: '', // API-Secret
    passphrase: '', // KC-API-PASSPHRASE
  },
  authVersion: 2, // KC-API-KEY-VERSION. Notice: for v2 API-KEY, not required for v1 version.
};
You can use baseUrl method to change evironment. Environment BaseUri
Production DEFAULT https://openapi-v2.kucoin.com
Sandbox https://openapi-sandbox.kucoin.com

If you only need to use the public web socket client or REST client public method, you can igonre withApiKey method. To customize your own API implementation, you may use the with*API method we provided for you.

Usage

/** Require SDK */
const API = require('kucoin-node-sdk');

/** Init Configure */
API.init(require('./config'));

/** API use */
const main = async () => {
  const getTimestampRl = await API.rest.Others.getTimestamp();
  console.log(getTimestampRl.data);
};

/** Run Demo for all apis */
REST API: yarn dev
SW:  yarn dev-ws (you can opt the params for different sw demo in demo,such as follow exp)

"dev-ws": "cross-env PRODUCTION=dev nodemon demo/xxx_demo.js",

Demo SDK for all APIS

DEMO: demo/index.js

API Modules

Rest/User

Signature is required for this part.

Rest/User/UserInfo

Rest/User/Deposit

Rest/Trade

Signature is required for this part.

Rest/Trade/Orders

Rest/Market

Signature is not required for this part

Rest/Market/Symbols

Websocket Datafeed

API.websocket.Datafeed

Manage websocket connect/private/subscribe/unsubscribe and get realtime datafeed.

DEMO: demo/ticker_demo.js

API.websocket.Level2

Get realtime orderbook in level2 datafeed.

DEMO: demo/level2_demo.js

API.websocket.Level3

test exp

yarn test

// TODO

LICENSE

Apache-2.0 License