KuCoin TypeScript SDK example: rest-spot-private-trade.ts
KuCoin REST REST spot private trade example for the Siebly KuCoin SDK, with TypeScript source for exchange REST API and WebSocket integration, setup, and production SDK docs.
What This Example Covers
- KuCoin REST API example in TypeScript.
- Uses the Siebly KuCoin SDK package
kucoin-apiinstead of hand-written HTTP request plumbing. - Source path:
Kucoin/Rest/rest-spot-private-trade.ts. - Example category: REST.
- Imports SDK symbols including
SpotClient. - Calls SDK methods such as
submitHFOrder(),generateNewOrderID().
How To Use This Example
- Start here for the specific request or stream pattern, then check the matching SDK guide for install, credentials, and operational notes.
- Open the repository source when you need the latest committed version: GitHub source file.
Example Path
Kucoin/Rest/rest-spot-private-trade.ts
Source Link
Repository source: https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Kucoin/Rest/rest-spot-private-trade.ts
Related SDK Docs
Example Source
import { SpotClient } from 'kucoin-api';
async function start() {
const account = {
key: 'keyHere',
secret: 'secretHere',
passphrase: 'memoHere',
};
const client = new SpotClient({
apiKey: account.key,
apiSecret: account.secret,
apiPassphrase: account.passphrase,
});
try {
const spotBuyResult = await client.submitHFOrder({
clientOid: client.generateNewOrderID(),
side: 'buy',
type: 'market',
symbol: 'BTC-USDT',
size: '0.00001',
});
console.log('spotBuy ', JSON.stringify(spotBuyResult, null, 2));
const spotSellResult = await client.submitHFOrder({
clientOid: client.generateNewOrderID(),
side: 'sell',
type: 'market',
symbol: 'BTC-USDT',
size: '0.00001',
});
console.log('spotSellResult ', JSON.stringify(spotSellResult, null, 2));
} catch (e) {
console.error('Req error: ', e);
}
}
start();