KuCoin API SDK for Node.js language
The detailed document https://docs.kucoin.com.
Nodejs version >= 10.0
# install by npm
npm install kucoin-node-sdk
# install by yarn
yarn add kucoin-node-sdk
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.
/** 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: demo/index.js
Signature is required for this part.
Signature is required for this part.
Signature is not required for this part
[x] getSymbolsList
[x] getTicker
[x] getAllTickers
[x] get24hrStats
[x] getMarketList
[x] getSymbolsList
[x] getLevel2_20
[x] getLevel2_100
[x] getLevel2_full
[x] getLevel3_full
[x] getMarketHistories
[x] getMarketCandles
[x] getCurrencies
[x] getCurrencyDetail
[x] getFiatPrice
[x] getCurrencyDetail_V3
[x] getMarkPrice
[x] getMarginConfigurationInfo
[x] getMarginAccount
[x] postMarginOrder
[x] getMarginPriceStrategy
[x] getMarginCurrencies
[x] getEtfInfo
[x] postBorrowOrder
[x] getBorrowOrder
[x] getRepayRecord
[x] getRepaymentRecord
[x] repayAll
[x] repaySingle
[x] postLendOrder
[x] cancelLendOrder
[x] setAutoLend
[x] getActiveOrder
[x] getLentHistory
[x] getActiveLendOrdersList
[x] getSettledLendOrderHistory
[x] getAccountLendRecord
[x] getLendingMarketData
[x] getMarginFillsTradeData
[x] queryIsolatedMarginTradingPairConfiguration
[x] queryIsolatedMarginAccountInfo
[x] querySingleIsolatedMarginAccountInfo
[x] isolatedMarginBorrowing
[x] queryOutstandingRepaymentRecords
[x] queryRepaymentRecords
[x] quickRepayment
[x] singleRepayment
[x] marginBorrowV3
[x] getBorrowHistoryV3
[x] repayMarginLoanV3
[x] getRepayHistoryV3
[x] getMarginInterestRecordsV3
[x] getLendingCurrencyInfoV3
[x] getMarketInterestRateV3
[x] initiatePurchaseV3
[x] getPurchaseOrdersV3
[x] redeemMarketV3
[x] getRedemptionOrdersV3
[x] updatePurchaseOrderInterestRateV3
[x] getCrossMarginTradingPairs
[x] updateLeverageMultiplier
[x] placeHfMarginOrder
[x] testHfMarginOrder
[x] cancelHfMarginOrder
[x] cancelHfMarginOrderByClientOid
[x] cancelAllHfMarginOrdersBySymbol
[x] getActiveHfMarginOrders
[x] getFilledHfMarginOrders
[x] getHfOrderDetails
[x] getHfOrderDetailsByClientOid
[x] getHfTransactionRecords
[x] getActiveHfOrderSymbols
[x] subscribeToEarnFixedIncomeProducts
[x] redeemByEarnHoldingId
[x] getEarnRedeemPreviewByHoldingId
[x] getEarnSavingsProducts
[x] getEarnFixedIncomeCurrentHoldings
[x] getEarnPromotionProducts
[x] getKcsStakingProducts
[x] getEarnStakingProducts
[x] getEthStakingProducts
[x] getOtcLoanInformation
[x] getOtcLoanAccounts
[x] getTimestamp
[x] getStatus
Manage websocket connect/private/subscribe/unsubscribe and get realtime datafeed.
DEMO: demo/ticker_demo.js
Get realtime orderbook in level2 datafeed.
DEMO: demo/level2_demo.js
yarn test
// TODO