Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/2024.04.15 update get currency detail #58

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.0.8] - 2024-04-15
### Added
- Added `getCurrencyDetail_V3` Request via this endpoint to get the currency details of a specified currency.

## [1.0.7] - 2024-01-29
### Added
- Added `placeOrder` API endpoint for placing a new order.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Signature is not required for this part
- [x] getCurrencies
- [x] getCurrencyDetail
- [x] getFiatPrice
- [x] getCurrencyDetail
- [x] getCurrencyDetail_V3
#### Rest/Margin/MarginInfo
- [x] getMarkPrice
- [x] getMarginConfigurationInfo
Expand Down
17 changes: 14 additions & 3 deletions demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,21 @@ console.log(transferToHFAccountResult ,"transferToHFAccountResult---");
* - {String} chain [Optional] Support for querying the chain of currency, return the currency details of all chains by default.
* @return {Object} { code, success, data }
*/
const getCurrencyDetailResult = await API.rest.Market.Currencies.getCurrencyDetail({currency:"BTC",chain:"chain"});
const getCurrencyDetailResult = await API.rest.Market.Currencies.getCurrencyDetail({currency:"BTC"});
console.log(getCurrencyDetailResult ,"getCurrencyDetailResult---");

// /////////////////////Margin//////////////////////////////////////////////////////

/**
* @name getCurrencyDetail_V3
* @description Request via this endpoint to get the currency details of a specified currency
* @updateTime 04/15/24
* @param {String} currency - Path parameter, Currency (Mandatory)
* @param {String} chain - Support for querying the chain of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20. This only apply for multi-chain currency, and there is no need for single chain currency. (Optional)
* @return {Object} { code, success, data }
*/
const getCurrencyDetailResult_V3 = await API.rest.Market.Currencies.getCurrencyDetail_V3({currency:"BTC"});
console.log(getCurrencyDetailResult_V3 ,"getCurrencyDetailResult_V3---");

/////////////////////Margin//////////////////////////////////////////////////////
/**
* @name queryIsolatedMarginTradingPairConfiguration
* @description Query Isolated Margin Trading Pair Configuration
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.0.6",
"version": "1.0.8",
"description": "KuCoin API SDK for Node.js language",
"main": "src/index.js",
"scripts": {
Expand Down
44 changes: 15 additions & 29 deletions src/rest/Market/Currencies.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const Http = require('../../lib/http');

/**
Expand Down Expand Up @@ -41,34 +40,6 @@ exports.getCurrencies = async function getCurrencies() {
return await Http().GET('/api/v1/currencies');
};

/**
* @name getCurrencyDetail
* @description Get Currency Detail
* @param {string} currency - Path parameter. Currency
* @param {string} chain - [Optional] Support for querying the chain of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20. This only apply for multi-chain currency, and there is no need for single chain currency.
* @return {Object} { code, success, data }
*/
exports.getCurrencyDetail = async function getCurrencyDetail(currency, chain) {
/*
{
"code": "200000",
"data": {
"currency": "BTC",
"name": "BTC",
"fullName": "Bitcoin",
"precision": 8,
"withdrawalMinSize": "0.002",
"withdrawalMinFee": "0.0005",
"isWithdrawEnabled": true,
"isDepositEnabled": true,
"isMarginEnabled": true,
"isDebitEnabled": true
}
}
*/
return await Http().GET(`/api/v1/currencies/${currency}`, { chain });
};

/**
* @name getFiatPrice
* @description Request via this endpoint to get the fiat price of the currencies for the available trading pairs.
Expand Down Expand Up @@ -108,4 +79,19 @@ exports.getCurrencyDetail = async function getCurrencyDetail({currency,chain}) {
return await Http().GET(`/api/v2/currencies/${currency}`,{
currency,chain
});
}


/**
* @name getCurrencyDetail_V3
* @description Request via this endpoint to get the currency details of a specified currency
* @updateTime 04/15/24
* @param {String} currency - Path parameter, Currency (Mandatory)
* @param {String} chain - Support for querying the chain of currency, e.g. The available value for USDT are OMNI, ERC20, TRC20. This only apply for multi-chain currency, and there is no need for single chain currency. (Optional)
* @return {Object} { code, success, data }
*/
exports.getCurrencyDetail_V3 = async function getCurrencyDetail_V3({currency,chain}) {
return await Http().GET(`/api/v3/currencies/${currency}`,{
currency,chain
});
}