Giter VIP home page Giter VIP logo

Comments (4)

StephaneTurquay avatar StephaneTurquay commented on July 24, 2024 1

@RezaAb Thanks for sharing this however how do you make us of it? Do you have an example with Get Order Id for instance? Thanks

from kucoin-node-sdk.

RezaAb avatar RezaAb commented on July 24, 2024

You can review the source code of the utils file.
The utils file

If you use this package you don't need to create a sign again.
But for your manual handling, you can review the code.

 function sign(text, secret, outputType = 'base64') {
   return CryptoJS
    .createHmac('sha256', secret)
     .update(text)
     .digest(outputType);
 }

 function auth(ApiKey, method, url, data) {
   const { authVersion } = getConfig();
   const timestamp = Date.now();
   const signature = sign(timestamp + method.toUpperCase() + url + data, ApiKey.secret);
   const returnData = {
     'KC-API-KEY': ApiKey.key,
     'KC-API-SIGN': signature,
     'KC-API-TIMESTAMP': timestamp.toString(),
     'KC-API-PASSPHRASE': ApiKey.passphrase || '',
     'Content-Type': 'application/json',
     'User-Agent': 'KuCoin-Node-SDK/${version}',
   };
   if (authVersion && (authVersion === 2 || authVersion === '2')) { // for v2 API-KEY
     returnData['KC-API-KEY-VERSION'] = 2;
     returnData['KC-API-PASSPHRASE'] = sign(ApiKey.passphrase || '', ApiKey.secret);
   }
   return returnData;
 }

from kucoin-node-sdk.

AndrejGajdos avatar AndrejGajdos commented on July 24, 2024

@RezaAb same here. How to use this library?

from kucoin-node-sdk.

RezaAb avatar RezaAb commented on July 24, 2024

@StephaneTurquay @AndrejGajdos
You don't need to sign anything. It is automated.

 const kucoinAPI = require('kucoin-node-sdk');
 kucoinAPI.init({
 	baseUrl: 'https://api.kucoin.com',
 	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.
 });
 let orderId = "";
 let result = await kucoinAPI.rest.Trade.Orders.getOrderByID(orderId);

from kucoin-node-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.