From b771ea7f4cf2bce335f62c3493215ccb24883d3a Mon Sep 17 00:00:00 2001 From: gannicus Date: Thu, 30 May 2024 20:10:59 +0800 Subject: [PATCH 1/5] feat: Added some APIs --- demo/margin.js | 323 ++++++++++++++++++++++++++++++++++ demo/order_test_demo.js | 73 ++++++++ demo/user.js | 48 +++++ src/index.js | 1 + src/rest/Margin/MarginInfo.js | 70 +++++++- src/rest/Margin/MarginV3.js | 235 +++++++++++++++++++++++++ src/rest/Trade/Orders.js | 57 +++++- src/rest/User/Account.js | 48 ++++- 8 files changed, 852 insertions(+), 3 deletions(-) create mode 100644 demo/margin.js create mode 100644 demo/order_test_demo.js create mode 100644 demo/user.js create mode 100644 src/rest/Margin/MarginV3.js diff --git a/demo/margin.js b/demo/margin.js new file mode 100644 index 0000000..03e5765 --- /dev/null +++ b/demo/margin.js @@ -0,0 +1,323 @@ +const API = require("../src"); + +API.init(require("./config")); + +const marginMain = async () => { + const getTimestampRl = await API.rest.Others.getTimestamp(); + console.log(getTimestampRl.data); + + /** + * @name marginBorrowV3 + * @description Initiates a margin borrow request for either cross-margin or isolated margin. + * @param {boolean} [isIsolated=false] - Indicates whether to use isolated margin (true) or cross-margin (false). + * @param {string} [symbol] - The trading pair, mandatory for isolated margin accounts. + * @param {string} currency - The currency to borrow. + * @param {BigDecimal} size - The amount to borrow. + * @param {string} timeInForce - Order time in force policy, e.g., IOC, FOK. + * @param {boolean} [isHf=false] - Indicates high frequency borrowing (true) or low frequency borrowing (false). + * @return {Promise} A promise that resolves to the response with the borrowing details. + */ + async function marginBorrowV3() { + try { + // Prepare the data to send along with the margin borrow request + const requestData = { + isIsolated: true, // We are assuming isolated margin + symbol: "BTC-USDT", // The trading pair + currency: "BTC", // The currency to borrow + size: "0.01", // The amount to borrow + timeInForce: "IOC", // Order time in force policy + // Optionally, if high frequency borrowing is needed, set isHf to true + // isHf: true + }; + + // Call the borrowMargin function with the requestData object + const response = await API.rest.Margin.MarginV3.marginBorrowV3(requestData); + + // Log the response from the API + console.log("Borrow Margin Response:", response); + } catch (error) { + // Log the error in case of a failure + console.error("Error performing borrow margin:", error); + } + } + marginBorrowV3(); + + /** + * @name getBorrowHistory + * @description Request via this endpoint to retrieve the borrowing history for both isolated and cross-margin accounts. + * @updateTime 05/29/24 + * @param {String} currency - Currency (Mandatory) + * @param {Boolean} isIsolated - true for isolated margin, false for cross-margin (Optional, default: false) + * @param {String} symbol - Trading pair (required for isolated margin accounts) + * @param {String} orderNo - Order ID (Optional) + * @param {Long} startTime - Start time (Optional) + * @param {Long} endTime - End time (Optional) + * @param {Int} currentPage - Current page for query (starting from 1, default: 1) + * @param {Int} pageSize - Records per page (default: 50, minimum: 10, maximum: 500) + * @return {Object} { orderNo, symbol, currency, size, actualSize, status, createdTime } + */ + async function getBorrowHistoryV3() { + try { + const result = await API.rest.Margin.MarginV3.getBorrowHistoryV3({ + currency: "USDT", + isIsolated: false, + symbol: "BTC-USDT", + currentPage: 1, + pageSize: 10, + }); + + console.log("Borrow history:", result); + } catch (error) { + console.error("Error fetching borrow history:", error.message); + } + } + getBorrowHistoryV3(); + + /** + * @name repayMarginLoan + * @description Request via this endpoint to initiate a repayment application for either cross-margin or isolated margin accounts. + * @updateTime 05/29/24 + * @param {Boolean} isIsolated - true for isolated margin, false for cross-margin (Optional, default: false) + * @param {Boolean} isHf - High-frequency repayment (true) or low-frequency repayment (false, default) (Optional) + * @param {String} symbol - Trading pair (required for isolated margin accounts) + * @param {String} currency - Currency (Mandatory) + * @param {BigDecimal} size - Repayment amount (Mandatory) + * @return {Object} { orderNo, actualSize } + */ + async function repayMarginLoanV3() { + try { + const result = await API.rest.Margin.MarginV3.repayMarginLoanV3({ + currency: "USDT", + size: 10, + }); + + console.log("Repayment order details:", result); + } catch (error) { + console.error("Error initiating repayment:", error.message); + } + } + repayMarginLoanV3(); + + /** + * @name getRepayHistory + * @description Request via this endpoint to query the repayment history for both cross-margin and isolated margin accounts. + * @updateTime 05/29/24 + * @param {String} currency - Currency (Mandatory) + * @param {Boolean} isIsolated - true for isolated margin, false for cross-margin (Optional, default: false) + * @param {String} symbol - Trading pair (required for isolated margin accounts) + * @param {String} orderNo - Order ID (Optional) + * @param {Long} startTime - Start time (Optional) + * @param {Long} endTime - End time (Optional) + * @param {Int} currentPage - Current page for query (starting from 1, default: 1) + * @param {Int} pageSize - Records per page (default: 50, minimum: 10, maximum: 500) + * @return {Object} { orderNo, symbol, currency, size, principal, interest, status, createdTime } + */ + async function getRepayHistoryV3() { + try { + const result = await API.rest.Margin.MarginV3.getRepayHistoryV3({ + currency: "USDT", + currentPage: 1, + pageSize: 10, + }); + + console.log("Repayment history:", result); + } catch (error) { + console.error("Error fetching repayment history:", error.message); + } + } + getRepayHistoryV3(); + + /** + * @name getMarginInterestRecords + * @description Request via this endpoint to retrieve the borrowing interest records for both cross-margin and isolated margin accounts. + * @updateTime 05/29/24 + * @param {Boolean} isIsolated - true for isolated margin, false for cross-margin (Optional, default: false) + * @param {String} symbol - Trading pair (required for isolated margin accounts) + * @param {String} currency - Currency (Optional) + * @param {Long} startTime - Start timestamp (milliseconds) (Optional) + * @param {Long} endTime - End timestamp (milliseconds) (Optional) + * @param {Int} currentPage - Current page for query (starting from 1, default: 1) + * @param {Int} pageSize - Records per page (default: 50, minimum: 10, maximum: 500) + * @return {Object} { currency, dayRatio, interestAmount, createdTime } + */ + async function getMarginInterestRecordsV3() { + try { + const result = await API.rest.Margin.MarginV3.getMarginInterestRecordsV3({ + currency: "USDT", + currentPage: 1, + pageSize: 10, + }); + + console.log("Interest records:", result); + } catch (error) { + console.error("Error fetching interest records:", error.message); + } + } + getMarginInterestRecordsV3(); + + /** + * @name getLendingCurrencyInfo + * @description Request via this endpoint to get information about lending currencies supported in the lending market. + * @updateTime 05/29/24 + * @param {String} currency - Currency (Optional) + * @return {Object} { currency, purchaseEnable, redeemEnable, increment, minPurchaseSize, minInterestRate, maxInterestRate, interestIncrement, maxPurchaseSize, marketInterestRate, autoPurchaseEnable } + */ + async function getLendingCurrencyInfoV3() { + try { + const result = await API.rest.Margin.MarginV3.getLendingCurrencyInfoV3({ + currency: "BTC", + }); + + console.log("Lending currency info:", result); + } catch (error) { + console.error("Error fetching lending currency info:", error.message); + } + } + getLendingCurrencyInfoV3(); + + /** + * @name getMarketInterestRate + * @description Request via this endpoint to get the interest rates for the lending market over the last 7 days. + * @updateTime 05/29/24 + * @param {String} currency - Currency (Mandatory) + * @return {Object[]} Array of { time, marketInterestRate } + */ + async function getMarketInterestRateV3() { + try { + const result = await API.rest.Margin.MarginV3.getMarketInterestRateV3({ + currency: "BTC", + }); + + console.log("Market interest rates:", result); + } catch (error) { + console.error("Error fetching market interest rates:", error.message); + } + } + getMarketInterestRateV3(); + + /** + * @name initiatePurchase + * @description Request via this endpoint to initiate a subscription in the lending market. + * @updateTime 05/29/24 + * @param {String} currency - Currency (Mandatory) + * @param {String} size - Subscription amount (Mandatory) + * @param {String} interestRate - Subscription interest rate (Mandatory) + * @return {Object} { orderNo } + */ + async function initiatePurchaseV3() { + try { + const result = await API.rest.Margin.MarginV3.initiatePurchaseV3({ + currency: "BTC", + size: "1000", + interestRate: "0.005", + }); + + console.log("Purchase order details:", result); + } catch (error) { + console.error("Error initiating purchase:", error.message); + } + } + initiatePurchaseV3(); + + /** + * @name getPurchaseOrders + * @description Request via this endpoint to retrieve paginated purchase orders in the lending market. + * @updateTime 05/29/24 + * @param {String} currency - Currency (Mandatory) + * @param {String} status - DONE (completed) or PENDING (settling) (Mandatory) + * @param {Int} currentPage - Current page number (Optional, default: 1) + * @param {Int} pageSize - Records per page (Optional, default: 50, minimum: 1, maximum: 100) + * @return {Object[]} Array of { currency, purchaseOrderNo, purchaseSize, matchSize, redeemSize, interestRate, incomeSize, applyTime, status } + */ + async function getPurchaseOrdersV3() { + try { + const result = await API.rest.Margin.MarginV3.getPurchaseOrdersV3({ + currency: "BTC", + status: "DONE", + currentPage: 1, + pageSize: 10, + }); + + console.log("Purchase orders:", result); + } catch (error) { + console.error("Error fetching purchase orders:", error.message); + } + } + getPurchaseOrdersV3(); + + /** + * @name redeemMarket_V3 + * @description Initiates a redemption in the lending market + * @updateTime 04/15/24 + * @param {String} currency - Currency (Mandatory) + * @param {String} size - Redemption amount (Mandatory) + * @param {String} purchaseOrderNo - Purchase order number (Mandatory) + * @return {Object} { code, success, data } + */ + async function redeemMarketV3() { + try { + const result = await API.rest.Margin.MarginV3.redeemMarketV3({ + currency: "USDT", + size: "100", + purchaseOrderNo: "5da6dba0f943c0c81f5d5db5", + }); + console.log("Redemption order number:", result.data.orderNo); + } catch (error) { + console.error("Error fetching postRedeemMarketV3 orders:", error.message); + } + } + redeemMarketV3(); + + /** + * @name getRedemptionOrders_V3 + * @description Retrieve redemption orders from the lending market (paginated) + * @updateTime 04/15/24 + * @param {String} currency - Currency (Mandatory) + * @param {String} redeemOrderNo - Redemption order number (Optional) + * @param {String} status - Status (Mandatory, values: DONE-已完結; PENDING-結算中) + * @param {Int} currentPage - Current page (Optional, default: 1) + * @param {Int} pageSize - Page size (Optional, default: 50, range: 1<=pageSize<=100) + * @return {Object} { currency, purchaseOrderNo, redeemOrderNo, redeemSize, receiptSize, applyTime, status } + */ + async function getRedemptionOrdersV3() { + try { + const result = await API.rest.Margin.MarginV3.getRedemptionOrdersV3({ + currency: "BTC", + status: "PENDING", + currentPage: 1, + pageSize: 10, + }); + console.log("Redemption order number:", result.data.orderNo); + } catch (error) { + console.error("Error fetching redemption orders:", error.message); + } + } + getRedemptionOrdersV3(); + + /** + * @name updatePurchaseOrderInterestRateV3 + * @description Update the interest rate for a lending market purchase order (effective at the next whole hour) + * @updateTime 04/15/24 + * @param {String} currency - Currency (Mandatory) + * @param {String} purchaseOrderNo - Purchase order number (Mandatory) + * @param {String} interestRate - Updated purchase interest rate (Mandatory) + * @return {void} + */ + async function getRedemptionOrdersV3() { + try { + const result = await API.rest.Margin.MarginV3.updatePurchaseOrderInterestRateV3({ + currency: "BTC", + purchaseOrderNo: "5da6dba0f943c0c81f5d5db5", + interestRate: "0.05", // Updated interest rate + }); + console.log("purchaseOrderNo number:", result.data.purchaseOrderNo); + } catch (error) { + console.error("Error fetching purchaseOrderNo:", error.message); + } + } + + getRedemptionOrdersV3(); +}; + +// run rest marginMain +marginMain(); diff --git a/demo/order_test_demo.js b/demo/order_test_demo.js new file mode 100644 index 0000000..ff41e42 --- /dev/null +++ b/demo/order_test_demo.js @@ -0,0 +1,73 @@ +const API = require("../src"); + +API.init(require("./config")); + +const orderTestMain = async () => { + const getTimestampRl = await API.rest.Others.getTimestamp(); + console.log(getTimestampRl.data); + + async function placeOrderTest() { + try { + const orderParams = { + side: "buy", // or 'sell' + symbol: "ETH-BTC", + type: "limit", // or 'market' (default is limit) + price: "0.035", // Price for limit orders (Mandatory for limit orders) + size: "1.5", // Quantity for limit orders (Mandatory for limit orders) + timeInForce: "GTC", // Order time-in-force strategy: GTC, GTT, IOC, FOK (default is GTC) + remark: "My order", // Order description (Optional) + stp: "CN", // Self-trade prevention strategy: CN, CO, CB, DC (Optional) + tradeType: "TRADE", // Trade type: TRADE (spot trading) or MARGIN_TRADE (margin trading) (default is TRADE) + postOnly: false, // Flag for post-only orders, invalid when timeInForce is IOC or FOK (Optional) + hidden: false, // Whether to hide the order (not displayed in the order book) (Optional) + iceberg: false, // Whether to display only the visible part of the iceberg order (Optional) + visibleSize: "0.8", // Maximum display quantity for iceberg orders (Optional) + funds: "100", // Funds for market orders (Optional, either size or funds must be specified) + }; + const response = await API.rest.Trade.Orders.placeOrderTest(orderParams) + console.log("Order created successfully:", response); + } catch (error) { + console.error("Error creating order:", error.message); + } + } + placeOrderTest(); + + async function placeHfOrderTest(){ + try { + const orderParams = { + side: "buy", // 'buy' or 'sell' + symbol: "ETH-BTC", // Trading pair (e.g., ETH-BTC) + type: "limit", // Order type: 'limit' or 'market' (default is 'limit') + price: "0.05", // Specify the price for limit orders + size: "1.5", // Specify the quantity + // Other optional parameters can be added here + }; + const orderResult = await API.rest.Trade.Orders.placeHfOrderTest(orderParams) + console.log("HfOrder created successfully::", orderResult); + } catch (error) { + console.error("Error creating hforder::", error.message); + } + } + placeHfOrderTest(); + + async function postMarginOrderTest(){ + try { + const orderParams = { + side: "buy", // 'buy' or 'sell' + symbol: "ETH-BTC", // Trading pair (e.g., ETH-BTC) + type: "limit", // Order type: 'limit' or 'market' (default is 'limit') + price: "0.05", // Specify the price for limit orders + size: "1.5", // Specify the quantity + // Other optional parameters can be added here + }; + const orderResult = await API.rest.Margin.MarginInfo.postMarginOrderTest(orderParams) + console.log("Order result:", orderResult); + } catch (error) { + console.error("Error:", error.message); + } + } + postMarginOrderTest(); +}; + +// run rest orderTestMain +orderTestMain(); diff --git a/demo/user.js b/demo/user.js new file mode 100644 index 0000000..f6a0b14 --- /dev/null +++ b/demo/user.js @@ -0,0 +1,48 @@ +const API = require("../src"); + +API.init(require("./config")); + +const userMain = async () => { + const getTimestampRl = await API.rest.Others.getTimestamp(); + console.log(getTimestampRl.data); + + /** + * @name universalTransfer + * @description Request via this endpoint to perform a universal transfer between accounts + * @updateTime 04/15/24 + * @param {String} clientOid - Client Order Id, a unique identifier created by the client, recommended to use UUID, maximum length is 128 characters (Mandatory) + * @param {String} currency - Currency (Mandatory) + * @param {String} amount - Transfer amount, must be an integer multiple of the currency precision (Mandatory) + * @param {String} fromUserId - User ID from which the funds are transferred, required when transferring from sub-account to main account, optional for internal transfers (Optional) + * @param {String} fromAccountType - Account type from which the funds are transferred: MAIN, TRADE, CONTRACT, MARGIN, ISOLATED, TRADE_HF, MARGIN_V2, ISOLATED_V2 (Mandatory) + * @param {String} fromAccountTag - Trading pair, required when the account type is ISOLATED or ISOLATED_V2, e.g., BTC-USDT (Optional) + * @param {String} type - Transfer type: INTERNAL (internal transfer), PARENT_TO_SUB (main account to sub-account), SUB_TO_PARENT (sub-account to main account) (Mandatory) + * @param {String} toUserId - User ID to which the funds are transferred, required when transferring from main account to sub-account, optional for internal transfers (Optional) + * @param {String} toAccountType - Account type to which the funds are transferred: MAIN, TRADE, CONTRACT, MARGIN, ISOLATED, TRADE_HF, MARGIN_V2, ISOLATED_V2 (Mandatory) + * @param {String} toAccountTag - Trading pair, required when the account type is ISOLATED or ISOLATED_V2, e.g., BTC-USDT (Optional) + * @return {Object} { code, success, data } + */ + async function universalTransfer() { + try { + const response = await API.rest.User.Account.universalTransfer({ + clientOid: "unique-client-oid", + currency: "BTC", + amount: "0.01", + fromUserId: "12345", + fromAccountType: "MAIN", + fromAccountTag: "BTC-USDT", + type: "INTERNAL", + toUserId: "67890", + toAccountType: "TRADE", + toAccountTag: "BTC-USDT", + }); + console.log(response); + } catch (error) { + console.error("Error performing universal transfer:", error); + } + } + universalTransfer(); +}; + +// run rest userMain +userMain(); diff --git a/src/index.js b/src/index.js index 650f2f9..4f688e8 100644 --- a/src/index.js +++ b/src/index.js @@ -43,6 +43,7 @@ exports.rest = { MarginInfo: require('./rest/Margin/MarginInfo'), BorrowAndLend: require('./rest/Margin/BorrowAndLend'), Isolated:require('./rest/Margin/Isolated'), + MarginV3:require('./rest/Margin/MarginV3'), }, Others: require('./rest/Others'), }; diff --git a/src/rest/Margin/MarginInfo.js b/src/rest/Margin/MarginInfo.js index 730a238..cf4d044 100644 --- a/src/rest/Margin/MarginInfo.js +++ b/src/rest/Margin/MarginInfo.js @@ -196,4 +196,72 @@ exports.getIsolatedAccounts = async function getIsolatedAccounts({ quoteCurrency, queryType, }); -}; \ No newline at end of file +}; + +/** +* @name postMarginOrderTest +* @description Place a margin order with the specified parameters +* @updateTime 05/30/24 +* @param {String} clientOid - Client Order Id, a unique identifier created by the client (recommended to use UUID) +* @param {String} side - buy (for buying) or sell (for selling) +* @param {String} symbol - Trading pair, e.g., ETH-BTC +* @param {String} type - Order type: limit or market (default is limit) +* @param {String} remark - Order description (Optional, maximum length is 50 characters, encoding supports ASCII) +* @param {String} stp - Self-trade prevention strategy: CN, CO, CB, DC (Optional) +* @param {String} marginModel - Margin trading mode: cross (cross margin) or isolated (isolated margin) (default is cross) +* @param {boolean} autoBorrow - Automatically borrow coins for the order (Optional, only supported for cross margin) +* @param {boolean} autoRepay - Automatically repay borrowed coins after order execution (Optional, only supported for cross margin) +* @param {String} price - Price for limit orders (Mandatory for limit orders) +* @param {String} size - Quantity for limit orders (Mandatory for limit orders) +* @param {String} timeInForce - Order time-in-force strategy: GTC, GTT, IOC, FOK (default is GTC) (Optional) +* @param {long} cancelAfter - Cancel after n seconds, applicable when timeInForce is GTT (Optional) +* @param {boolean} postOnly - Flag for post-only orders, invalid when timeInForce is IOC or FOK (Optional) +* @param {boolean} hidden - Whether to hide the order (not displayed in the order book) (Optional) +* @param {boolean} iceberg - Whether to display only the visible part of the iceberg order (Optional) +* @param {String} visibleSize - Maximum display quantity for iceberg orders (Optional) +* @param {String} funds - Funds for market orders (Optional, either size or funds must be specified) +* @return {Object} { orderId, borrowSize, loanApplyId } +*/ +exports.postMarginOrderTest = async function postMarginOrderTest({ + clientOid, + side, + symbol, + type, + remark, + stp, + marginModel, + autoBorrow, + autoRepay, + price, + size, + timeInForce, + cancelAfter, + postOnly, + hidden, + iceberg, + visibleSize, + funds +}) { + // Implementation logic for placing a margin order goes here + // ... + return await Http().POST('/api/v1/margin/order/test', { + clientOid, + side, + symbol, + type, + remark, + stp, + marginModel, + autoBorrow, + autoRepay, + price, + size, + timeInForce, + cancelAfter, + postOnly, + hidden, + iceberg, + visibleSize, + funds + }); +} \ No newline at end of file diff --git a/src/rest/Margin/MarginV3.js b/src/rest/Margin/MarginV3.js new file mode 100644 index 0000000..046f73f --- /dev/null +++ b/src/rest/Margin/MarginV3.js @@ -0,0 +1,235 @@ +const Http = require("../../lib/http"); +/** + * @name marginBorrowV3 + * @description Initiates a margin borrow request for either cross-margin or isolated margin. + * @param {boolean} [isIsolated=false] - Indicates whether to use isolated margin (true) or cross-margin (false). + * @param {string} [symbol] - The trading pair, mandatory for isolated margin accounts. + * @param {string} currency - The currency to borrow. + * @param {BigDecimal} size - The amount to borrow. + * @param {string} timeInForce - Order time in force policy, e.g., IOC, FOK. + * @param {boolean} [isHf=false] - Indicates high frequency borrowing (true) or low frequency borrowing (false). + * @return {Promise} A promise that resolves to the response with the borrowing details. + */ +exports.marginBorrowV3 = async function marginBorrowV3({ + isIsolated = false, + symbol, + currency, + size, + timeInForce, + isHf = false, +}) { + const payload = { + isIsolated, + currency, + size, + timeInForce, + isHf, + }; + + // 对于逐仓账户,symbol 是必填的 + if (isIsolated && !symbol) { + throw new Error("Symbol is required for isolated margin accounts."); + } + + // 如果是逐仓模式,则需要添加 symbol 参数 + if (isIsolated) { + payload.symbol = symbol; + } + + try { + // 发起 POST 请求 + return await Http().POST("/api/v3/margin/borrow", payload); + } catch (error) { + console.error("Error borrowing margin:", error); + throw error; + } +}; + + +/** +* @name getBorrowHistory +* @description Request via this endpoint to retrieve the borrowing history for both isolated and cross-margin accounts. +* @updateTime 05/29/24 +* @param {String} currency - Currency (Mandatory) +* @param {Boolean} isIsolated - true for isolated margin, false for cross-margin (Optional, default: false) +* @param {String} symbol - Trading pair (required for isolated margin accounts) +* @param {String} orderNo - Order ID (Optional) +* @param {Long} startTime - Start time (Optional) +* @param {Long} endTime - End time (Optional) +* @param {Int} currentPage - Current page for query (starting from 1, default: 1) +* @param {Int} pageSize - Records per page (default: 50, minimum: 10, maximum: 500) +* @return {Object} { orderNo, symbol, currency, size, actualSize, status, createdTime } +*/ +exports.getBorrowHistoryV3 = async function getBorrowHistoryV3({ currency, isIsolated, symbol, orderNo, startTime, endTime, currentPage, pageSize }) { + return await Http().GET('/api/v3/margin/borrow', { + currency, isIsolated, symbol, orderNo, startTime, endTime, currentPage, pageSize + }); +} + +/** +* @name repayMarginLoan +* @description Request via this endpoint to initiate a repayment application for either cross-margin or isolated margin accounts. +* @updateTime 05/29/24 +* @param {Boolean} isIsolated - true for isolated margin, false for cross-margin (Optional, default: false) +* @param {Boolean} isHf - High-frequency repayment (true) or low-frequency repayment (false, default) (Optional) +* @param {String} symbol - Trading pair (required for isolated margin accounts) +* @param {String} currency - Currency (Mandatory) +* @param {BigDecimal} size - Repayment amount (Mandatory) +* @return {Object} { orderNo, actualSize } +*/ +exports.repayMarginLoanV3 = async function repayMarginLoanV3({ isIsolated, isHf, symbol, currency, size }) { + return await Http().POST('/api/v3/margin/repay', { + isIsolated, isHf, symbol, currency, size + }); +} + +/** +* @name getRepayHistory +* @description Request via this endpoint to query the repayment history for both cross-margin and isolated margin accounts. +* @updateTime 05/29/24 +* @param {String} currency - Currency (Mandatory) +* @param {Boolean} isIsolated - true for isolated margin, false for cross-margin (Optional, default: false) +* @param {String} symbol - Trading pair (required for isolated margin accounts) +* @param {String} orderNo - Order ID (Optional) +* @param {Long} startTime - Start time (Optional) +* @param {Long} endTime - End time (Optional) +* @param {Int} currentPage - Current page for query (starting from 1, default: 1) +* @param {Int} pageSize - Records per page (default: 50, minimum: 10, maximum: 500) +* @return {Object} { orderNo, symbol, currency, size, principal, interest, status, createdTime } +*/ +exports.getRepayHistoryV3 = async function getRepayHistoryV3({ currency, isIsolated, symbol, orderNo, startTime, endTime, currentPage, pageSize }) { + return await Http().GET('/api/v3/margin/repay', { + currency, isIsolated, symbol, orderNo, startTime, endTime, currentPage, pageSize + }); +} + +/** +* @name getMarginInterestRecords +* @description Request via this endpoint to retrieve the borrowing interest records for both cross-margin and isolated margin accounts. +* @updateTime 05/29/24 +* @param {Boolean} isIsolated - true for isolated margin, false for cross-margin (Optional, default: false) +* @param {String} symbol - Trading pair (required for isolated margin accounts) +* @param {String} currency - Currency (Optional) +* @param {Long} startTime - Start timestamp (milliseconds) (Optional) +* @param {Long} endTime - End timestamp (milliseconds) (Optional) +* @param {Int} currentPage - Current page for query (starting from 1, default: 1) +* @param {Int} pageSize - Records per page (default: 50, minimum: 10, maximum: 500) +* @return {Object} { currency, dayRatio, interestAmount, createdTime } +*/ +exports.getMarginInterestRecordsV3 = async function getMarginInterestRecordsV3({ isIsolated, symbol, currency, startTime, endTime, currentPage, pageSize }) { + return await Http().GET('/api/v3/margin/interest', { + isIsolated, symbol, currency, startTime, endTime, currentPage, pageSize + }); +} + +/** +* @name getLendingCurrencyInfo +* @description Request via this endpoint to get information about lending currencies supported in the lending market. +* @updateTime 05/29/24 +* @param {String} currency - Currency (Optional) +* @return {Object} { currency, purchaseEnable, redeemEnable, increment, minPurchaseSize, minInterestRate, maxInterestRate, interestIncrement, maxPurchaseSize, marketInterestRate, autoPurchaseEnable } +*/ +exports.getLendingCurrencyInfoV3 = async function getLendingCurrencyInfoV3({ currency }) { + return await Http().GET('/api/v3/project/list', { + currency + }); +} + +/** +* @name getMarketInterestRate +* @description Request via this endpoint to get the interest rates for the lending market over the last 7 days. +* @updateTime 05/29/24 +* @param {String} currency - Currency (Mandatory) +* @return {Object[]} Array of { time, marketInterestRate } +*/ +exports.getMarketInterestRateV3 = async function getMarketInterestRateV3({ currency }) { + return await Http().GET('/api/v3/project/marketInterestRate', { + currency + }); +} + +/** +* @name initiatePurchase +* @description Request via this endpoint to initiate a subscription in the lending market. +* @updateTime 05/29/24 +* @param {String} currency - Currency (Mandatory) +* @param {String} size - Subscription amount (Mandatory) +* @param {String} interestRate - Subscription interest rate (Mandatory) +* @return {Object} { orderNo } +*/ +exports.initiatePurchaseV3 = async function initiatePurchaseV3({ currency, size, interestRate }) { + return await Http().POST('/api/v3/purchase', { + currency, size, interestRate + }); +} + +/** +* @name getPurchaseOrders +* @description Request via this endpoint to retrieve paginated purchase orders in the lending market. +* @updateTime 05/29/24 +* @param {String} currency - Currency (Mandatory) +* @param {String} status - DONE (completed) or PENDING (settling) (Mandatory) +* @param {Int} currentPage - Current page number (Optional, default: 1) +* @param {Int} pageSize - Records per page (Optional, default: 50, minimum: 1, maximum: 100) +* @return {Object[]} Array of { currency, purchaseOrderNo, purchaseSize, matchSize, redeemSize, interestRate, incomeSize, applyTime, status } +*/ +exports.getPurchaseOrdersV3 = async function getPurchaseOrdersV3({ currency, status, currentPage, pageSize }) { + return await Http().GET('/api/v3/purchase/orders', { + currency, status, currentPage, pageSize + }); +} + +/** + * @name redeemMarket_V3 + * @description Initiates a redemption in the lending market + * @updateTime 04/15/24 + * @param {String} currency - Currency (Mandatory) + * @param {String} size - Redemption amount (Mandatory) + * @param {String} purchaseOrderNo - Purchase order number (Mandatory) + * @return {Object} { code, success, data } + */ +exports.redeemMarketV3 = async function redeemMarketV3({ currency, size, purchaseOrderNo }) { + return await Http().POST('/api/v3/redeem', { + currency, + size, + purchaseOrderNo + }); +} + +/** + * @name getRedemptionOrders_V3 + * @description Retrieve redemption orders from the lending market (paginated) + * @updateTime 04/15/24 + * @param {String} currency - Currency (Mandatory) + * @param {String} redeemOrderNo - Redemption order number (Optional) + * @param {String} status - Status (Mandatory, values: DONE-已完結; PENDING-結算中) + * @param {Int} currentPage - Current page (Optional, default: 1) + * @param {Int} pageSize - Page size (Optional, default: 50, range: 1<=pageSize<=100) + * @return {Object} { currency, purchaseOrderNo, redeemOrderNo, redeemSize, receiptSize, applyTime, status } + */ +exports.getRedemptionOrdersV3 = async function getRedemptionOrdersV3({ currency, redeemOrderNo, status, currentPage, pageSize }) { + return await Http().GET('/api/v3/redeem/orders', { + currency, + redeemOrderNo, + status, + currentPage, + pageSize + }); +} + +/** + * @name updatePurchaseOrderInterestRate_V3 + * @description Update the interest rate for a lending market purchase order (effective at the next whole hour) + * @updateTime 04/15/24 + * @param {String} currency - Currency (Mandatory) + * @param {String} purchaseOrderNo - Purchase order number (Mandatory) + * @param {String} interestRate - Updated purchase interest rate (Mandatory) + * @return {void} + */ +exports.updatePurchaseOrderInterestRateV3 = async function updatePurchaseOrderInterestRateV3({ currency, purchaseOrderNo, interestRate }) { + await Http().POST('/api/v3/lend/purchase/update', { + currency, + purchaseOrderNo, + interestRate + }); +} \ No newline at end of file diff --git a/src/rest/Trade/Orders.js b/src/rest/Trade/Orders.js index 57e63e5..b5849ba 100644 --- a/src/rest/Trade/Orders.js +++ b/src/rest/Trade/Orders.js @@ -747,4 +747,59 @@ exports.queryHfAutoCancelOrderSetting = async function queryHfAutoCancelOrderSet */ exports.cancelAllHfOrders = async function cancelAllHfOrders() { return await Http().DELETE('/api/v1/hf/orders/cancelAll'); -} \ No newline at end of file +} + +/** +* @name placeOrderTest +* @description Place a new order. This endpoint requires the "Trade" permission. +* @param baseParams +* - {string} clientOid - Unique order id created by users to identify their orders, e.g. UUID. +* - {string} side - buy or sell +* - {string} symbol - a valid trading symbol code. e.g. ETH-BTC +* - {string} type - [Optional] limit or market (default is limit) +* - {string} remark - [Optional] remark for the order, length cannot exceed 100 utf8 characters +* - {string} stop - [Optional] Either loss or entry. Requires stopPrice to be defined +* - {string} stopPrice - [Optional] Need to be defined if stop is specified. +* - {string} stp - [Optional] self trade prevention , CN, CO, CB or DC +* - {string} tradeType - [Optional] The type of trading : TRADE(Spot Trade), MARGIN_TRADE (Margin Trade). Default is TRADE +* @param orderParams +* LIMIT ORDER PARAMETERS +* - {string} price - price per base currency +* - {string} size - amount of base currency to buy or sell +* - {string} timeInForce - [Optional] GTC, GTT, IOC, or FOK (default is GTC), read Time In Force. +* - {number} cancelAfter - [Optional] cancel after n seconds, requires timeInForce to be GTT +* - {boolean} postOnly - [Optional] Post only flag, invalid when timeInForce is IOC or FOK +* - {boolean} hidden - [Optional] Order will not be displayed in the order book +* - {boolean} iceberg - [Optional] Only aportion of the order is displayed in the order book +* - {string} visibleSize - [Optional] The maximum visible size of an iceberg order +* +* MARKET ORDER PARAMETERS / It is required that you use one of the two parameters, size or funds. +* - {string} size [Optional] - Desired amount in base currency +* - {string} funds [Optional] - The desired amount of quote currency to use +* @return {Object} { code, success, data } +*/ +exports.placeOrderTest = async function placeOrderTest(params = {}) { + return await Http().POST('/api/v1/orders/test',{ + ...params + }); +}; + +/** + * @name placeHfOrderTest + * @description Place hf order + * @updateTime 02/03/23 + * @param {Object} + * - {String} clientOid Client Order Id,unique identifier created by the user, the use of UUID is recommended + * - {String} symbol Trading pair, such as, ETH-BTC + * - {String} type Order type limit and market + * - {String} side buy or sell + * - {String} stp Self trade prevention (self trade prevention) is divided into four strategies: CN, CO, CB , and DC + * - {String} tags Order tag, cannot exceed 20 characters (ASCII) in length + * - {String} remark Order placement remarks, length cannot exceed 20 characters (ASCII) in length + * @return {Object} { code, success, data } + */ +exports.placeHfOrderTest = async function placeHfOrderTest({clientOid,symbol,type,side,stp,tags,remark}) { + return await Http().POST('/api/v1/hf/orders/test',{ + clientOid,symbol,type,side,stp,tags,remark + }); +} diff --git a/src/rest/User/Account.js b/src/rest/User/Account.js index 888b397..3833c07 100644 --- a/src/rest/User/Account.js +++ b/src/rest/User/Account.js @@ -586,4 +586,50 @@ exports.getHighFrequencyAccountLedger = async function getHighFrequencyAccountLe return await Http().GET('/api/v1/hf/accounts/ledgers',{ currency,direction,bizType,lastId,limit,startAt,endAt }); -} \ No newline at end of file +} + +/** + + * @name universalTransfer + * @description Request via this endpoint to perform a universal transfer between accounts + * @updateTime 04/15/24 + * @param {String} clientOid - Client Order Id, a unique identifier created by the client, recommended to use UUID, maximum length is 128 characters (Mandatory) + * @param {String} currency - Currency (Mandatory) + * @param {String} amount - Transfer amount, must be an integer multiple of the currency precision (Mandatory) + * @param {String} fromUserId - User ID from which the funds are transferred, required when transferring from sub-account to main account, optional for internal transfers (Optional) + * @param {String} fromAccountType - Account type from which the funds are transferred: MAIN, TRADE, CONTRACT, MARGIN, ISOLATED, TRADE_HF, MARGIN_V2, ISOLATED_V2 (Mandatory) + * @param {String} fromAccountTag - Trading pair, required when the account type is ISOLATED or ISOLATED_V2, e.g., BTC-USDT (Optional) + * @param {String} type - Transfer type: INTERNAL (internal transfer), PARENT_TO_SUB (main account to sub-account), SUB_TO_PARENT (sub-account to main account) (Mandatory) + * @param {String} toUserId - User ID to which the funds are transferred, required when transferring from main account to sub-account, optional for internal transfers (Optional) + * @param {String} toAccountType - Account type to which the funds are transferred: MAIN, TRADE, CONTRACT, MARGIN, ISOLATED, TRADE_HF, MARGIN_V2, ISOLATED_V2 (Mandatory) + * @param {String} toAccountTag - Trading pair, required when the account type is ISOLATED or ISOLATED_V2, e.g., BTC-USDT (Optional) + * @return {Object} { code, success, data } + */ +exports.universalTransfer = async function universalTransfer({ + clientOid, + currency, + amount, + fromUserId, + fromAccountType, + fromAccountTag, + type, + toUserId, + toAccountType, + toAccountTag, +}) { + // Construct the request payload + const payload = { + clientOid, + currency, + amount, + fromUserId, + fromAccountType, + fromAccountTag, + type, + toUserId, + toAccountType, + toAccountTag, + }; + // Make the POST request to the API endpoint + return await Http().POST("/api/v3/accounts/universal-transfer", payload); +}; \ No newline at end of file From a6b0900026a784af97ccb778f702376ba5c54c24 Mon Sep 17 00:00:00 2001 From: gannicus Date: Thu, 30 May 2024 20:11:31 +0800 Subject: [PATCH 2/5] feat: Added some APIs+update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e826f2b..1ff020c 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kucoin-node-sdk", - "version": "1.0.8", + "version": "1.0.9", "description": "KuCoin API SDK for Node.js language", "main": "src/index.js", "scripts": { From 75f205cd97e7b0508061cf857d8ea760053bdcbe Mon Sep 17 00:00:00 2001 From: gannicus Date: Thu, 30 May 2024 20:49:50 +0800 Subject: [PATCH 3/5] feat: Added some APIs+Changelog --- CHANGELOG.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 13 +++++++++++ 2 files changed, 74 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b498fc7..387c056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,64 @@ +## [1.0.9] - 2024-05-30 + +### Added APIs +#### Universal Transfer API +- **Added**: `POST /api/v3/accounts/universal-transfer` + +#### Margin Borrowing APIs +- **Added**: `POST /api/v3/margin/borrow` +- **Added**: `GET /api/v3/margin/borrow` + +#### Margin Repayment APIs +- **Added**: `POST /api/v3/margin/repay` +- **Added**: `GET /api/v3/margin/repay` + +#### Margin Interest APIs +- **Added**: `GET /api/v3/margin/interest` + +#### Project APIs +- **Added**: `GET /api/v3/project/list` +- **Added**: `GET /api/v3/project/marketInterestRate` + +#### Purchase APIs +- **Added**: `POST /api/v3/purchase` +- **Added**: `POST /api/v3/redeem` +- **Added**: `POST /api/v3/lend/purchase/update` +- **Added**: `GET /api/v3/redeem/orders` +- **Added**: `GET /api/v3/purchase/orders` + +#### Test Order APIs +- **Added**: `POST /api/v1/hf/orders/test` +- **Added**: `POST /api/v1/margin/order/test` +- **Added**: `POST /api/v1/orders/test` + +### Deprecated APIs +#### Margin Borrowing APIs +- **Deprecated**: Publish Borrow Order, deprecated `POST /api/v1/margin/borrow` +- **Deprecated**: Query Borrow Orders, deprecated `GET /api/v1/margin/borrow` +- **Deprecated**: Query Repaid Records, deprecated `GET /api/v1/margin/borrow/repaid` +- **Deprecated**: One-Click Repayment, deprecated `POST /api/v1/margin/repay/all` +- **Deprecated**: Single Repayment, deprecated `POST /api/v1/margin/repay/single` + +#### Margin Lending APIs +- **Deprecated**: Publish Lend Order, deprecated `POST /api/v1/margin/lend` +- **Deprecated**: Cancel Lend Order, deprecated `DELETE /api/v1/margin/lend/{orderId}` +- **Deprecated**: Set Auto-Lend, deprecated `POST /api/v1/margin/toggle-auto-lend` +- **Deprecated**: Query Active Lend Orders, deprecated `GET /api/v1/margin/lend/active` +- **Deprecated**: Query Historical Lend Orders, deprecated `GET /api/v1/margin/lend/done` +- **Deprecated**: Query Unsettled Lend Records, deprecated `GET /api/v1/margin/lend/trade/unsettled` +- **Deprecated**: Query Settled Lend Records, deprecated `GET /api/v1/margin/lend/trade/settled` +- **Deprecated**: Asset Lend Records, deprecated `GET /api/v1/margin/lend/assets` +- **Deprecated**: Lend Market Information, deprecated `GET /api/v1/margin/market` +- **Deprecated**: Lending Market Transaction Information, deprecated `GET /api/v1/margin/trade/last` + +#### Isolated Margin Borrowing APIs +- **Deprecated**: Isolated Borrowing, deprecated `POST /api/v1/isolated/borrow` +- **Deprecated**: One-Click Repayment, deprecated `POST /api/v1/isolated/repay/all` +- **Deprecated**: Single Repayment, deprecated `POST /api/v1/isolated/repay/single` +- **Deprecated**: Query Repaid Records, deprecated `GET /api/v1/isolated/borrow/repaid` +- **Deprecated**: Query Outstanding Isolated Borrow Records, deprecated `GET /api/v1/isolated/borrow/outstanding` +- **Deprecated**: Query Outstanding Borrow Records, deprecated `GET /api/v1/margin/borrow/outstanding` + ## [1.0.8] - 2024-04-15 ### Added - Added `getCurrencyDetail_V3` Request via this endpoint to get the currency details of a specified currency. diff --git a/README.md b/README.md index 63a9093..e17c886 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,19 @@ Signature is not required for this part - [x] queryRepaymentRecords - [x] quickRepayment - [x] singleRepayment +#### Rest/Margin/MarginV3 +- [x] marginBorrowV3 +- [x] getBorrowHistoryV3 +- [x] repayMarginLoanV3 +- [x] getRepayHistoryV3 +- [x] getMarginInterestRecordsV3 +- [x] getLendingCurrencyInfoV3 +- [x] getMarketInterestRateV3 +- [x] initiatePurchaseV3 +- [x] getPurchaseOrdersV3 +- [x] redeemMarketV3 +- [x] getRedemptionOrdersV3 +- [x] updatePurchaseOrderInterestRateV3 #### Rest/Others - [x] getTimestamp From b2d0bc4b0cda84bcc82c6215658edbb052c9d919 Mon Sep 17 00:00:00 2001 From: gannicus Date: Fri, 31 May 2024 09:58:22 +0800 Subject: [PATCH 4/5] feat: Added some APIs+ChangeDate --- demo/margin.js | 6 +++--- demo/user.js | 2 +- src/rest/Margin/MarginV3.js | 9 +++------ src/rest/Trade/Orders.js | 2 +- src/rest/User/Account.js | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/demo/margin.js b/demo/margin.js index 03e5765..75b5005 100644 --- a/demo/margin.js +++ b/demo/margin.js @@ -248,7 +248,7 @@ const marginMain = async () => { /** * @name redeemMarket_V3 * @description Initiates a redemption in the lending market - * @updateTime 04/15/24 + * @updateTime 05/29/24 * @param {String} currency - Currency (Mandatory) * @param {String} size - Redemption amount (Mandatory) * @param {String} purchaseOrderNo - Purchase order number (Mandatory) @@ -271,7 +271,7 @@ const marginMain = async () => { /** * @name getRedemptionOrders_V3 * @description Retrieve redemption orders from the lending market (paginated) - * @updateTime 04/15/24 + * @updateTime 05/29/24 * @param {String} currency - Currency (Mandatory) * @param {String} redeemOrderNo - Redemption order number (Optional) * @param {String} status - Status (Mandatory, values: DONE-已完結; PENDING-結算中) @@ -297,7 +297,7 @@ const marginMain = async () => { /** * @name updatePurchaseOrderInterestRateV3 * @description Update the interest rate for a lending market purchase order (effective at the next whole hour) - * @updateTime 04/15/24 + * @updateTime 05/29/24 * @param {String} currency - Currency (Mandatory) * @param {String} purchaseOrderNo - Purchase order number (Mandatory) * @param {String} interestRate - Updated purchase interest rate (Mandatory) diff --git a/demo/user.js b/demo/user.js index f6a0b14..028481e 100644 --- a/demo/user.js +++ b/demo/user.js @@ -9,7 +9,7 @@ const userMain = async () => { /** * @name universalTransfer * @description Request via this endpoint to perform a universal transfer between accounts - * @updateTime 04/15/24 + * @updateTime 05/29/24 * @param {String} clientOid - Client Order Id, a unique identifier created by the client, recommended to use UUID, maximum length is 128 characters (Mandatory) * @param {String} currency - Currency (Mandatory) * @param {String} amount - Transfer amount, must be an integer multiple of the currency precision (Mandatory) diff --git a/src/rest/Margin/MarginV3.js b/src/rest/Margin/MarginV3.js index 046f73f..ade0b02 100644 --- a/src/rest/Margin/MarginV3.js +++ b/src/rest/Margin/MarginV3.js @@ -26,18 +26,15 @@ exports.marginBorrowV3 = async function marginBorrowV3({ isHf, }; - // 对于逐仓账户,symbol 是必填的 if (isIsolated && !symbol) { throw new Error("Symbol is required for isolated margin accounts."); } - // 如果是逐仓模式,则需要添加 symbol 参数 if (isIsolated) { payload.symbol = symbol; } try { - // 发起 POST 请求 return await Http().POST("/api/v3/margin/borrow", payload); } catch (error) { console.error("Error borrowing margin:", error); @@ -182,7 +179,7 @@ exports.getPurchaseOrdersV3 = async function getPurchaseOrdersV3({ currency, sta /** * @name redeemMarket_V3 * @description Initiates a redemption in the lending market - * @updateTime 04/15/24 + * @updateTime 05/29/24 * @param {String} currency - Currency (Mandatory) * @param {String} size - Redemption amount (Mandatory) * @param {String} purchaseOrderNo - Purchase order number (Mandatory) @@ -199,7 +196,7 @@ exports.redeemMarketV3 = async function redeemMarketV3({ currency, size, purchas /** * @name getRedemptionOrders_V3 * @description Retrieve redemption orders from the lending market (paginated) - * @updateTime 04/15/24 + * @updateTime 05/29/24 * @param {String} currency - Currency (Mandatory) * @param {String} redeemOrderNo - Redemption order number (Optional) * @param {String} status - Status (Mandatory, values: DONE-已完結; PENDING-結算中) @@ -220,7 +217,7 @@ exports.getRedemptionOrdersV3 = async function getRedemptionOrdersV3({ currency, /** * @name updatePurchaseOrderInterestRate_V3 * @description Update the interest rate for a lending market purchase order (effective at the next whole hour) - * @updateTime 04/15/24 + * @updateTime 05/29/24 * @param {String} currency - Currency (Mandatory) * @param {String} purchaseOrderNo - Purchase order number (Mandatory) * @param {String} interestRate - Updated purchase interest rate (Mandatory) diff --git a/src/rest/Trade/Orders.js b/src/rest/Trade/Orders.js index b5849ba..b2844a4 100644 --- a/src/rest/Trade/Orders.js +++ b/src/rest/Trade/Orders.js @@ -787,7 +787,7 @@ exports.placeOrderTest = async function placeOrderTest(params = {}) { /** * @name placeHfOrderTest * @description Place hf order - * @updateTime 02/03/23 + * @updateTime 05/29/24 * @param {Object} * - {String} clientOid Client Order Id,unique identifier created by the user, the use of UUID is recommended * - {String} symbol Trading pair, such as, ETH-BTC diff --git a/src/rest/User/Account.js b/src/rest/User/Account.js index 3833c07..555cf6f 100644 --- a/src/rest/User/Account.js +++ b/src/rest/User/Account.js @@ -592,7 +592,7 @@ exports.getHighFrequencyAccountLedger = async function getHighFrequencyAccountLe * @name universalTransfer * @description Request via this endpoint to perform a universal transfer between accounts - * @updateTime 04/15/24 + * @updateTime 05/29/24 * @param {String} clientOid - Client Order Id, a unique identifier created by the client, recommended to use UUID, maximum length is 128 characters (Mandatory) * @param {String} currency - Currency (Mandatory) * @param {String} amount - Transfer amount, must be an integer multiple of the currency precision (Mandatory) From bacf24fac0c986df3e57c21eed01793602620d7d Mon Sep 17 00:00:00 2001 From: gannicus Date: Fri, 31 May 2024 10:03:21 +0800 Subject: [PATCH 5/5] feat: Added some APIs+ChangeDate --- demo/margin.js | 2 +- src/rest/Margin/MarginV3.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/margin.js b/demo/margin.js index 75b5005..61cd632 100644 --- a/demo/margin.js +++ b/demo/margin.js @@ -274,7 +274,7 @@ const marginMain = async () => { * @updateTime 05/29/24 * @param {String} currency - Currency (Mandatory) * @param {String} redeemOrderNo - Redemption order number (Optional) - * @param {String} status - Status (Mandatory, values: DONE-已完結; PENDING-結算中) + * @param {String} status - Status (Mandatory, values: DONE; PENDING) * @param {Int} currentPage - Current page (Optional, default: 1) * @param {Int} pageSize - Page size (Optional, default: 50, range: 1<=pageSize<=100) * @return {Object} { currency, purchaseOrderNo, redeemOrderNo, redeemSize, receiptSize, applyTime, status } diff --git a/src/rest/Margin/MarginV3.js b/src/rest/Margin/MarginV3.js index ade0b02..170a754 100644 --- a/src/rest/Margin/MarginV3.js +++ b/src/rest/Margin/MarginV3.js @@ -199,7 +199,7 @@ exports.redeemMarketV3 = async function redeemMarketV3({ currency, size, purchas * @updateTime 05/29/24 * @param {String} currency - Currency (Mandatory) * @param {String} redeemOrderNo - Redemption order number (Optional) - * @param {String} status - Status (Mandatory, values: DONE-已完結; PENDING-結算中) + * @param {String} status - Status (Mandatory, values: DONE; PENDING) * @param {Int} currentPage - Current page (Optional, default: 1) * @param {Int} pageSize - Page size (Optional, default: 50, range: 1<=pageSize<=100) * @return {Object} { currency, purchaseOrderNo, redeemOrderNo, redeemSize, receiptSize, applyTime, status }