From 7ca06583d03ff4c19abb2dd8490ac5fbd13892e8 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Wed, 17 May 2023 17:18:17 +0800 Subject: [PATCH 1/4] bitget: fix apis limit rule, add missing apis --- ts/src/bitget.ts | 90 ++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/ts/src/bitget.ts b/ts/src/bitget.ts index a9db49302626..ceffc1b7e513 100644 --- a/ts/src/bitget.ts +++ b/ts/src/bitget.ts @@ -127,12 +127,12 @@ export default class bitget extends Exchange { 'spot': { 'get': { 'public/time': 1, - 'public/currencies': 1, + 'public/currencies': 6.6667, // 3 times/1s (IP) => 20/3 = 6.6667 'public/products': 1, 'public/product': 1, 'market/ticker': 1, 'market/tickers': 1, - 'market/fills': 1, + 'market/fills': 2, // 10 times/1s (IP) => 20/10 = 2 'market/fills-history': 2, 'market/candles': 1, 'market/depth': 1, @@ -145,7 +145,9 @@ export default class bitget extends Exchange { 'market/depth': 1, 'market/ticker': 1, 'market/tickers': 1, + 'market/contract-vip-level': 2, 'market/fills': 1, + 'market/fills-history': 2, 'market/candles': 1, 'market/index': 1, 'market/funding-time': 1, @@ -154,8 +156,6 @@ export default class bitget extends Exchange { 'market/open-interest': 1, 'market/mark-price': 1, 'market/symbol-leverage': 1, - 'market/contract-vip-level': 2, - 'market/fills-history': 2, 'market/queryPositionLever': 1, }, }, @@ -163,84 +163,88 @@ export default class bitget extends Exchange { 'private': { 'spot': { 'get': { - 'account/getInfo': 20, - 'account/assets': 2, - 'account/transferRecords': 4, 'wallet/deposit-address': 4, - 'wallet/withdrawal-inner': 4, 'wallet/withdrawal-list': 1, 'wallet/deposit-list': 1, + 'account/getInfo': 20, + 'account/assets': 2, + 'account/transferRecords': 1, // 20 times/1s (UID) => 20/20 = 1 }, 'post': { - 'account/bills': 2, + 'wallet/transfer': 4, + 'wallet/transfer-v2': 4, + 'wallet/subTransfer': 10, + 'wallet/withdrawal': 4, + 'wallet/withdrawal-v2': 4, + 'wallet/withdrawal-inner': 4, + 'wallet/withdrawal-inner-v2': 4, 'account/sub-account-spot-assets': 200, + 'account/bills': 2, 'trade/orders': 2, 'trade/batch-orders': 4, 'trade/cancel-order': 2, + 'trade/cancel-order-v2': 2, + 'trade/cancel-symbol-order': 2, 'trade/cancel-batch-orders': 4, 'trade/cancel-batch-orders-v2': 4, 'trade/orderInfo': 1, 'trade/open-orders': 1, 'trade/history': 1, 'trade/fills': 1, - 'trade/cancel-order-v2': 2, - 'trade/cancel-symbol-order': 2, - 'wallet/transfer': 4, - 'wallet/withdrawal': 4, - 'wallet/subTransfer': 10, - 'wallet/transfer-v2': 4, - 'wallet/withdrawal-v2': 4, - 'wallet/withdrawal-inner-v2': 4, 'plan/placePlan': 1, 'plan/modifyPlan': 1, 'plan/cancelPlan': 1, 'plan/currentPlan': 1, 'plan/historyPlan': 1, + 'plan/batchCancelPlan': 2, // 10 times/1s (UID) => 20/10 = 2 }, }, 'mix': { 'get': { 'account/account': 2, 'account/accounts': 2, + 'position/singlePosition': 2, + 'position/singlePosition-v2': 2, + 'position/allPosition': 4, // 5 times/1s (UID) => 20/5 = 4 + 'position/allPosition-v2': 4, // 5 times/1s (UID) => 20/5 = 4 'account/accountBill': 2, 'account/accountBusinessBill': 4, - 'account/open-count': 1, - 'order/current': 2, + 'order/current': 1, // 20 times/1s (UID) => 20/20 = 1 + 'order/marginCoinCurrent': 1, // 20 times/1s (UID) => 20/20 = 1 'order/history': 2, + 'order/historyProductType': 4, // 5 times/1s (UID) => 20/5 = 4 'order/detail': 2, 'order/fills': 2, - 'order/historyProductType': 8, 'order/allFills': 2, - 'plan/currentPlan': 2, + 'plan/currentPlan': 1, // 20 times/1s (UID) => 20/20 = 1 'plan/historyPlan': 2, - 'position/singlePosition': 2, - 'position/singlePosition-v2': 2, - 'position/allPosition': 2, - 'position/allPosition-v2': 2, 'trace/currentTrack': 2, 'trace/followerOrder': 2, + 'trace/followerHistoryOrders': 2, 'trace/historyTrack': 2, - 'trace/summary': 2, - 'trace/profitSettleTokenIdGroup': 2, - 'trace/profitDateGroupList': 2, + 'trace/summary': 1, // 20 times/1s (UID) => 20/20 = 1 + 'trace/profitSettleTokenIdGroup': 1, // 20 times/1s (UID) => 20/20 = 1 + 'trace/profitDateGroupList': 1, // 20 times/1s (UID) => 20/20 = 1 'trade/profitDateList': 2, - 'trace/waitProfitDateList': 2, - 'trace/traderSymbols': 2, + 'trace/waitProfitDateList': 1, // 20 times/1s (UID) => 20/20 = 1 + 'trace/traderSymbols': 1, // 20 times/1s (UID) => 20/20 = 1 'trace/traderList': 2, + 'trace/traderDetail': 2, // 10 times/1s (UID) => 20/10 = 2 'trace/queryTraceConfig': 2, - 'order/marginCoinCurrent': 2, }, 'post': { - 'account/setLeverage': 8, - 'account/setMargin': 8, - 'account/setMarginMode': 8, - 'account/setPositionMode': 8, + 'account/sub-account-contract-assets': 200, // 0.1 times/1s (UID) => 20/0.1 = 200 + 'account/open-count': 1, + 'account/setLeverage': 4, // 5 times/1s (UID) => 20/5 = 4 + 'account/setMargin': 4, // 5 times/1s (UID) => 20/5 = 4 + 'account/setMarginMode': 4, // 5 times/1s (UID) => 20/5 = 4 + 'account/setPositionMode': 4, // 5 times/1s (UID) => 20/5 = 4 'order/placeOrder': 2, 'order/batch-orders': 2, 'order/cancel-order': 2, - 'order/cancel-all-orders': 2, 'order/cancel-batch-orders': 2, 'order/cancel-symbol-orders': 2, + 'order/cancel-all-orders': 2, 'plan/placePlan': 2, 'plan/modifyPlan': 2, 'plan/modifyPlanPreset': 2, @@ -249,14 +253,16 @@ export default class bitget extends Exchange { 'plan/placePositionsTPSL': 2, 'plan/modifyTPSLPlan': 2, 'plan/cancelPlan': 2, - 'plan/cancelAllPlan': 2, 'plan/cancelSymbolPlan': 2, + 'plan/cancelAllPlan': 2, 'trace/closeTrackOrder': 2, + 'trace/modifyTPSL': 2, // 10 times/1s (UID) => 20/10 = 2 'trace/setUpCopySymbols': 2, 'trace/followerSetBatchTraceConfig': 2, 'trace/followerCloseByTrackingNo': 2, 'trace/followerCloseByAll': 2, 'trace/followerSetTpsl': 2, + 'trace/cancelCopyTrader': 4, // 5 times/1s (UID) => 20/5 = 4 }, }, 'user': { @@ -268,17 +274,17 @@ export default class bitget extends Exchange { 'post': { 'sub/virtual-create': 4, 'sub/virtual-modify': 4, - 'sub/virtual-api-batch-create': 4, + 'sub/virtual-api-batch-create': 20, // 1 times/1s (UID) => 20/1 = 20 'sub/virtual-api-create': 4, 'sub/virtual-api-modify': 4, }, }, 'p2p': { 'get': { - 'merchant/merchantList': 1, - 'merchant/merchantInfo': 1, - 'merchant/advList': 1, - 'merchant/orderList': 1, + 'merchant/merchantList': 2, // 10 times/1s (UID) => 20/10 = 2 + 'merchant/merchantInfo': 2, // 10 times/1s (UID) => 20/10 = 2 + 'merchant/advList': 2, // 10 times/1s (UID) => 20/10 = 2 + 'merchant/orderList': 2, // 10 times/1s (UID) => 20/10 = 2 }, }, }, From d0973f88196071f50edb7491153a524f10fa5ef3 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Wed, 17 May 2023 17:41:48 +0800 Subject: [PATCH 2/4] bitget: add broker apis --- ts/src/bitget.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ts/src/bitget.ts b/ts/src/bitget.ts index ceffc1b7e513..8b0448ae0d0f 100644 --- a/ts/src/bitget.ts +++ b/ts/src/bitget.ts @@ -112,6 +112,7 @@ export default class bitget extends Exchange { 'mix': 'https://api.{hostname}', 'user': 'https://api.{hostname}', 'p2p': 'https://api.{hostname}', + 'broker': 'https://api.{hostname}', }, 'www': 'https://www.bitget.com', 'doc': [ @@ -287,6 +288,26 @@ export default class bitget extends Exchange { 'merchant/orderList': 2, // 10 times/1s (UID) => 20/10 = 2 }, }, + 'broker': { + 'get': { + 'account/info': 2, // 10 times/1s (UID) => 20/10 = 2 + 'account/sub-list': 20, // 1 times/1s (UID) => 20/1 = 20 + 'account/sub-email': 20, // 1 times/1s (UID) => 20/1 = 20 + 'account/sub-spot-assets': 2, // 10 times/1s (UID) => 20/10 = 2 + 'account/sub-future-assets': 2, // 10 times/1s (UID) => 20/10 = 2 + 'account/sub-api-list': 2, // 10 times/1s (UID) => 20/10 = 2 + }, + 'post': { + 'account/sub-create': 20, // 1 times/1s (UID) => 20/1 = 20 + 'account/sub-modify': 20, // 1 times/1s (UID) => 20/1 = 20 + 'account/sub-modify-email': 20, // 1 times/1s (UID) => 20/1 = 20 + 'account/sub-address': 2, // 10 times/1s (UID) => 20/10 = 2 + 'account/sub-withdrawal': 2, // 10 times/1s (UID) => 20/10 = 2 + 'account/sub-auto-transfer': 4, // 5 times/1s (UID) => 20/5 = 4 + 'account/sub-api-create': 2, // 10 times/1s (UID) => 20/10 = 2 + 'account/sub-api-modify': 2, // 10 times/1s (UID) => 20/10 = 2 + }, + }, }, }, 'fees': { @@ -4461,6 +4482,8 @@ export default class bitget extends Exchange { pathPart = '/api/mix/v1'; } else if (endpoint === 'user') { pathPart = '/api/user/v1'; + } else if (endpoint === 'broker') { + pathPart = '/api/broker/v1'; } else { pathPart = '/api/p2p/v1'; } From 70edf9873833a7b3fabc2051dc6b6c0d4d5d2e54 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Thu, 18 May 2023 11:05:01 +0800 Subject: [PATCH 3/4] bitget: add margin apis --- ts/src/bitget.ts | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/ts/src/bitget.ts b/ts/src/bitget.ts index 8b0448ae0d0f..27b5bfa46ea6 100644 --- a/ts/src/bitget.ts +++ b/ts/src/bitget.ts @@ -113,12 +113,14 @@ export default class bitget extends Exchange { 'user': 'https://api.{hostname}', 'p2p': 'https://api.{hostname}', 'broker': 'https://api.{hostname}', + 'margin': 'https://api.{hostname}', }, 'www': 'https://www.bitget.com', 'doc': [ 'https://bitgetlimited.github.io/apidoc/en/mix', 'https://bitgetlimited.github.io/apidoc/en/spot', 'https://bitgetlimited.github.io/apidoc/en/broker', + 'https://bitgetlimited.github.io/apidoc/en/margin', ], 'fees': 'https://www.bitget.cc/zh-CN/rate?tab=1', 'referral': 'https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j', @@ -160,6 +162,17 @@ export default class bitget extends Exchange { 'market/queryPositionLever': 1, }, }, + 'margin': { + 'get': { + 'cross/public/interestRateAndLimit': 2, // 10 times/1s (IP) => 20/10 = 2 + 'isolated/public/interestRateAndLimit': 2, // 10 times/1s (IP) => 20/10 = 2 + 'cross/public/tierData': 2, // 10 times/1s (IP) => 20/10 = 2 + 'isolated/public/tierData': 2, // 10 times/1s (IP) => 20/10 = 2 + 'public/currencies': 1, // 20 times/1s (IP) => 20/20 = 1 + 'cross/account/assets': 2, // 10 times/1s (IP) => 20/10 = 2 + 'isolated/account/assets': 2, // 10 times/1s (IP) => 20/10 = 2 + }, + }, }, 'private': { 'spot': { @@ -308,6 +321,46 @@ export default class bitget extends Exchange { 'account/sub-api-modify': 2, // 10 times/1s (UID) => 20/10 = 2 }, }, + 'margin': { + 'get': { + 'cross/account/riskRate': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/account/maxTransferOutAmount': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/account/maxTransferOutAmount': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/order/openOrders': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/order/history': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/order/fills': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/loan/list': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/repay/list': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/interest/list': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/liquidation/list': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/fin/list': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/order/openOrders': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/order/history': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/order/fills': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/loan/list': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/repay/list': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/interest/list': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/liquidation/list': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/fin/list': 2, // 10 times/1s (UID) => 20/10 = 2 + }, + 'post': { + 'cross/account/borrow': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/account/borrow': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/account/repay': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/account/repay': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/account/riskRate': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/account/maxBorrowableAmount': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/account/maxBorrowableAmount': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/order/placeOrder': 4, // 5 times/1s (UID) => 20/5 = 4 + 'isolated/order/batchPlaceOrder': 4, // 5 times/1s (UID) => 20/5 = 4 + 'isolated/order/cancelOrder': 2, // 10 times/1s (UID) => 20/10 = 2 + 'isolated/order/batchCancelOrder': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/order/placeOrder': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/order/batchPlaceOrder': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/order/cancelOrder': 2, // 10 times/1s (UID) => 20/10 = 2 + 'cross/order/batchCancelOrder': 2, // 10 times/1s (UID) => 20/10 = 2 + }, + }, }, }, 'fees': { @@ -4484,6 +4537,8 @@ export default class bitget extends Exchange { pathPart = '/api/user/v1'; } else if (endpoint === 'broker') { pathPart = '/api/broker/v1'; + } else if (endpoint === 'margin') { + pathPart = '/api/margin/v1'; } else { pathPart = '/api/p2p/v1'; } From 337982dc96caeb2a8aab4c4858c1b7221421daf9 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Thu, 18 May 2023 11:15:56 +0800 Subject: [PATCH 4/4] bitget: add future copytrading apis --- ts/src/bitget.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ts/src/bitget.ts b/ts/src/bitget.ts index 27b5bfa46ea6..1a24dac9803f 100644 --- a/ts/src/bitget.ts +++ b/ts/src/bitget.ts @@ -211,6 +211,25 @@ export default class bitget extends Exchange { 'plan/currentPlan': 1, 'plan/historyPlan': 1, 'plan/batchCancelPlan': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/order/orderCurrentList': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/order/orderHistoryList': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/order/closeTrackingOrder': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/order/updateTpsl': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/order/followerEndOrder': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/order/spotInfoList': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/config/getTraderSettings': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/config/getFollowerSettings': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/user/myTraders': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/config/setFollowerConfig': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/user/myFollowers': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/config/setProductCode': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/user/removeTrader': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/profit/totalProfitInfo': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/profit/totalProfitList': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/profit/profitHisList': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/profit/profitHisDetailList': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/profit/waitProfitDetailList': 2, // 10 times/1s (UID) => 20/10 = 2 + 'trace/user/getTraderInfo': 2, // 10 times/1s (UID) => 20/10 = 2 }, }, 'mix': {