Skip to content

Commit

Permalink
Merge pull request #63 from Kucoin/feature/2024.11.28_update
Browse files Browse the repository at this point in the history
feat: Added some APIs
  • Loading branch information
Apexrsq authored Nov 13, 2024
2 parents 110fcfe + 68c5ef6 commit c390bf4
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 4 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
## [1.0.10] - 2024-06-15
## [1.1.1] - 2024-11-12

### Added
- **Spot High-Frequency Upgrade**: All users can now use high-frequency interfaces without a whitelist. The system is more stable, and the rate limits are more relaxed.
- **User Type API**: Added `GET /api/v1/hf/accounts/opened` to determine the user type.
- **Fetch Announcements** API: Added `GET /api/v3/announcements` to retrieve news and announcements.

### Modified
- **Get Currency Details API**: `GET /api/v3/currencies/{currency}` now includes additional fields: `withdrawPrecision`, `needTag`, `maxWithdraw`, and `maxDeposit`.
- **Get Currency List API**: `GET /api/v3/currencies` now includes additional fields: `withdrawPrecision`, `needTag`, `maxWithdraw`, and `maxDeposit`.

### Deprecated
- **Get Deposit Address API**: Deprecated `GET /api/v1/deposit-addresses`, replaced by `GET /api/v3/deposit-addresses`.
- **Get Deposit Address API (V2)**: Deprecated `GET /api/v2/deposit-addresses`, replaced by `GET /api/v3/deposit-addresses`.
- **Apply for Deposit Address API**: Deprecated `POST /api/v1/deposit-addresses`, replaced by `POST /api/v3/deposit-address/create`.
- **Apply for Withdrawal API**: Deprecated `POST /api/v1/withdrawals`, replaced by `POST /api/v3/withdrawals`.

## [1.1.0] - 2024-06-15

### Added APIs
- `GET /api/v3/hf/margin/order/active/symbols`
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Signature is required for this part.
- [x] getPaginatedSubAccountInformation
- [x] transferToHFAccount
- [x] getHighFrequencyAccountLedger
- [x] getUserType

#### Rest/User/Deposit
- [x] createDepositAddress
Expand Down Expand Up @@ -184,7 +185,8 @@ Signature is not required for this part
- [x] getAllTickers
- [x] get24hrStats
- [x] getMarketList
- [x] getSymbolsList
- [x] getSymbolDetail

#### Rest/Market/OrderBook
- [x] getLevel2_20
- [x] getLevel2_100
Expand Down Expand Up @@ -277,6 +279,7 @@ Signature is not required for this part
#### Rest/Others
- [x] getTimestamp
- [x] getStatus
- [x] getAnnouncements

## Websocket Datafeed

Expand Down
11 changes: 10 additions & 1 deletion demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ console.log(transferToHFAccountResult ,"transferToHFAccountResult---");
const getSymbolsListResult = await API.rest.Market.Symbols.getSymbolsList({market:"BTC"});
console.log(getSymbolsListResult ,"getSymbolsListResult---");


const getSymbolDetail = await API.rest.Market.Symbols.getSymbolDetail("BTC-USDT");
console.log(getSymbolDetail,"getSymbolDetailResult---");

/**
* @name getCurrencyDetail
* @description Get Currency Detail(Recommend)
Expand Down Expand Up @@ -362,6 +366,11 @@ const getHighFrequencyAccountLedgerResult = await API.rest.User.Account.getHighF
});
console.log(getHighFrequencyAccountLedgerResult ,"getHighFrequencyAccountLedgerResult---");


const getUserTypeResult = await API.rest.User.Account.getUserType();
console.log("User Type:", getUserTypeResult.data ? "High-Frequency" : "Low-Frequency");


/**
* @name getHfTransactionRecords
* @description HF transaction records
Expand Down Expand Up @@ -742,4 +751,4 @@ console.log(queryHfAutoCancelOrderSettingResult ,"queryHfAutoCancelOrderSettingR


// run rest main
main();
main();
36 changes: 36 additions & 0 deletions demo/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,42 @@ const userMain = async () => {
}
}
universalTransfer();


/**
* @name getAnnouncements
* @description Get the latest news announcements
* @updateTime 11/13/24
* @param {Object} params
* @param {Number} [params.currentPage] - Page number (Optional)
* @param {Number} [params.pageSize] - Page size (Optional)
* @param {String} [params.annType] - Announcement types: latest-announcements, activities, new-listings, product-updates, vip, maintenance-updates, delistings, others, api-campaigns (Optional)
* @param {String} [params.lang] - Language type, default is en_US (Optional)
* @param {Number} [params.startTime] - Announcement online start time (milliseconds) (Optional)
* @param {Number} [params.endTime] - Announcement online end time (milliseconds) (Optional)
* @return {Promise} { code, data: { totalNum, items, currentPage, pageSize, totalPage } }
*/
async function getAnnouncementsDemo() {
try {
const response = await API.rest.Others.getAnnouncements({
currentPage: 1,
pageSize: 10,
annType: 'latest-announcements',
lang: 'en_US'
});

console.log("Announcements:", response);

if (response.data && response.data.items) {
console.log("Total announcements:", response.data.totalNum);
console.log("First announcement title:", response.data.items[0].annTitle);
}
} catch (error) {
console.error("Error fetching announcements:", error);
}
}

getAnnouncementsDemo();
};

// run rest userMain
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kucoin-node-sdk",
"version": "1.1.0",
"version": "1.1.1",
"description": "KuCoin API SDK for Node.js language",
"main": "src/index.js",
"scripts": {
Expand Down
11 changes: 11 additions & 0 deletions src/rest/Market/Symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,15 @@ exports.getSymbolsList = async function getSymbolsList({ market = undefined } =
return await Http().GET("/api/v2/symbols", {
market,
});
};

/**
* @name getSymbolDetail
* @description Request via this endpoint to get detail currency pairs for trading.
* @param {String} symbol - Symbol (e.g., BTC-USDT)
* @return {Object} { code, success, data }
*/
exports.getSymbolDetail = async function getSymbolDetail(symbol) {
// Make the GET request to the API endpoint
return await Http().GET(`/api/v2/symbols/${symbol}`);
};
17 changes: 17 additions & 0 deletions src/rest/Others.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,20 @@ exports.getStatus = async function getStatus() {
*/
return await Http().GET('/api/v1/status');
};

/**
* @name getAnnouncements
* @description Get the latest news announcements
* @updateTime 11/13/24
* @param {Object} params
* @param {Number} [params.currentPage] - Page number (Optional)
* @param {Number} [params.pageSize] - Page size (Optional)
* @param {String} [params.annType] - Announcement types: latest-announcements, activities, new-listings, product-updates, vip, maintenance-updates, delistings, others, api-campaigns (Optional)
* @param {String} [params.lang] - Language type, default is en_US (Optional)
* @param {Number} [params.startTime] - Announcement online start time (milliseconds) (Optional)
* @param {Number} [params.endTime] - Announcement online end time (milliseconds) (Optional)
* @return {Promise} { code, data: { totalNum, items, currentPage, pageSize, totalPage } }
*/
exports.getAnnouncements = async function getAnnouncements(params = {}) {
return await Http().GET("/api/v3/announcements", params);
};
10 changes: 10 additions & 0 deletions src/rest/User/Account.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,16 @@ exports.getHighFrequencyAccountLedger = async function getHighFrequencyAccountLe
});
}

/**
* @name getUserType
* @description Determines whether the current user is a spot high-frequency user or a spot low-frequency user.
* @return {Object} { code, success, data }
*/
exports.getUserType = async function getUserType() {
return await Http().GET('/api/v1/hf/accounts/opened');
};


/**
* @name universalTransfer
Expand Down
6 changes: 6 additions & 0 deletions src/rest/User/Withdrawals.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,18 @@ exports.getWithdrawalQuotas = async function getWithdrawalQuotas(currency, {
* - {boolean} isInner - [Optional] Internal withdrawal or not. Default setup: false
* - {string} remark - [Optional] Remark
* - {string} chain - [Optional] The chain name of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20, default is ERC20. This only apply for multi-chain currency, and there is no need for single chain currency.
* - {string} feeDeductType - [Optional] Withdrawal fee deduction type: INTERNAL or EXTERNAL or not specified
1. INTERNAL- deduct the transaction fees from your withdrawal amount
2. EXTERNAL- deduct the transaction fees from your main account
3. If you don't specify the feeDeductType parameter, when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount. For example: Suppose you are going to withdraw 1 BTC from the KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC.
* @return {Object} { code, success, data }
*/
exports.applyWithdraw = async function applyWithdraw(currency, address, amount, {
memo,
isInner,
remark,
chain,
feeDeductType
} = {}) {
/*
{
Expand All @@ -175,6 +180,7 @@ exports.applyWithdraw = async function applyWithdraw(currency, address, amount,
isInner,
remark,
chain,
feeDeductType
});
};

Expand Down

0 comments on commit c390bf4

Please sign in to comment.