From 6b8710f5dd9a8a9e023818f8e2dcd040825dc372 Mon Sep 17 00:00:00 2001 From: hirokisan Date: Sat, 15 Jun 2024 16:59:57 +0900 Subject: [PATCH 1/3] feat: handle cursor on GetRiskLimit --- v5_market_service.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/v5_market_service.go b/v5_market_service.go index 4c84c9a..f65ff54 100644 --- a/v5_market_service.go +++ b/v5_market_service.go @@ -1053,6 +1053,7 @@ type V5GetRiskLimitParam struct { Category CategoryV5 `url:"category"` Symbol *SymbolV5 `url:"symbol,omitempty"` + Cursor *string `url:"cursor,omitempty"` } func (p V5GetRiskLimitParam) validate() error { @@ -1070,8 +1071,9 @@ type V5GetRiskLimitResponse struct { // V5GetRiskLimitResult : type V5GetRiskLimitResult struct { - Category CategoryV5 `json:"category"` - List []V5GetRiskLimitItem `json:"list"` + Category CategoryV5 `json:"category"` + List []V5GetRiskLimitItem `json:"list"` + NextPageCursor string `json:"nextPageCursor"` } type V5GetRiskLimitItem struct { From 4e82c6c6bb8100fce63b61e2a833afa7a38d181a Mon Sep 17 00:00:00 2001 From: hirokisan Date: Sat, 15 Jun 2024 17:01:30 +0900 Subject: [PATCH 2/3] test(unit): handle cursor on GetRiskLimit --- v5_market_service_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/v5_market_service_test.go b/v5_market_service_test.go index 1c37b6b..b5281cd 100644 --- a/v5_market_service_test.go +++ b/v5_market_service_test.go @@ -870,6 +870,7 @@ func TestV5Market_GetRiskLimit(t *testing.T) { "maxLeverage": "57.14", }, }, + "nextPageCursor": "first%3D10000000AIDOGEUSDT%26last%3DAIOZUSDT", }, } bytesBody, err := json.Marshal(respBody) From a50b730aea7c9a585101a29740544555d1564488 Mon Sep 17 00:00:00 2001 From: hirokisan Date: Sat, 15 Jun 2024 17:01:58 +0900 Subject: [PATCH 3/3] test(integration): handle cursor on GetRiskLimit --- .../testdata/v5-market-get-risk-limit.json | 258 +++++++++--------- 1 file changed, 134 insertions(+), 124 deletions(-) diff --git a/integrationtest/v5/market/testdata/v5-market-get-risk-limit.json b/integrationtest/v5/market/testdata/v5-market-get-risk-limit.json index 1516863..37e1607 100644 --- a/integrationtest/v5/market/testdata/v5-market-get-risk-limit.json +++ b/integrationtest/v5/market/testdata/v5-market-get-risk-limit.json @@ -13,277 +13,277 @@ { "id": 2, "symbol": "BTCUSDT", - "riskLimitValue": "4000000", - "maintenanceMargin": "0.01", - "initialMargin": "0.0175", + "riskLimitValue": "2600000", + "maintenanceMargin": "0.0056", + "initialMargin": "0.0111", "isLowestRisk": 0, - "maxLeverage": "57.14" + "maxLeverage": "90.00" }, { "id": 3, "symbol": "BTCUSDT", - "riskLimitValue": "6000000", - "maintenanceMargin": "0.015", - "initialMargin": "0.025", + "riskLimitValue": "3200000", + "maintenanceMargin": "0.0063", + "initialMargin": "0.0125", "isLowestRisk": 0, - "maxLeverage": "40.00" + "maxLeverage": "80.00" }, { "id": 4, "symbol": "BTCUSDT", - "riskLimitValue": "8000000", - "maintenanceMargin": "0.02", - "initialMargin": "0.0325", + "riskLimitValue": "3800000", + "maintenanceMargin": "0.0067", + "initialMargin": "0.0133", "isLowestRisk": 0, - "maxLeverage": "30.77" + "maxLeverage": "75.00" }, { "id": 5, "symbol": "BTCUSDT", - "riskLimitValue": "10000000", - "maintenanceMargin": "0.025", - "initialMargin": "0.04", + "riskLimitValue": "4400000", + "maintenanceMargin": "0.0071", + "initialMargin": "0.0143", "isLowestRisk": 0, - "maxLeverage": "25.00" + "maxLeverage": "70.00" }, { "id": 6, "symbol": "BTCUSDT", - "riskLimitValue": "12000000", - "maintenanceMargin": "0.03", - "initialMargin": "0.0475", + "riskLimitValue": "5000000", + "maintenanceMargin": "0.0077", + "initialMargin": "0.0154", "isLowestRisk": 0, - "maxLeverage": "21.05" + "maxLeverage": "65.00" }, { "id": 7, "symbol": "BTCUSDT", - "riskLimitValue": "14000000", - "maintenanceMargin": "0.035", - "initialMargin": "0.055", + "riskLimitValue": "5600000", + "maintenanceMargin": "0.0091", + "initialMargin": "0.0182", "isLowestRisk": 0, - "maxLeverage": "18.18" + "maxLeverage": "55.00" }, { "id": 8, "symbol": "BTCUSDT", - "riskLimitValue": "16000000", - "maintenanceMargin": "0.04", - "initialMargin": "0.0625", + "riskLimitValue": "8500000", + "maintenanceMargin": "0.01", + "initialMargin": "0.02", "isLowestRisk": 0, - "maxLeverage": "16.00" + "maxLeverage": "50.00" }, { "id": 9, "symbol": "BTCUSDT", - "riskLimitValue": "18000000", - "maintenanceMargin": "0.045", - "initialMargin": "0.07", + "riskLimitValue": "10000000", + "maintenanceMargin": "0.013", + "initialMargin": "0.0222", "isLowestRisk": 0, - "maxLeverage": "14.29" + "maxLeverage": "45.00" }, { "id": 10, "symbol": "BTCUSDT", - "riskLimitValue": "20000000", - "maintenanceMargin": "0.05", - "initialMargin": "0.0775", + "riskLimitValue": "14000000", + "maintenanceMargin": "0.015", + "initialMargin": "0.025", "isLowestRisk": 0, - "maxLeverage": "12.90" + "maxLeverage": "40.00" }, { "id": 11, "symbol": "BTCUSDT", - "riskLimitValue": "22000000", - "maintenanceMargin": "0.055", - "initialMargin": "0.085", + "riskLimitValue": "20000000", + "maintenanceMargin": "0.016", + "initialMargin": "0.0286", "isLowestRisk": 0, - "maxLeverage": "11.76" + "maxLeverage": "35.00" }, { "id": 12, "symbol": "BTCUSDT", - "riskLimitValue": "24000000", - "maintenanceMargin": "0.06", - "initialMargin": "0.0925", + "riskLimitValue": "28000000", + "maintenanceMargin": "0.02", + "initialMargin": "0.0333", "isLowestRisk": 0, - "maxLeverage": "10.81" + "maxLeverage": "30.00" }, { "id": 13, "symbol": "BTCUSDT", - "riskLimitValue": "26000000", - "maintenanceMargin": "0.065", - "initialMargin": "0.1", + "riskLimitValue": "38000000", + "maintenanceMargin": "0.025", + "initialMargin": "0.04", "isLowestRisk": 0, - "maxLeverage": "10.00" + "maxLeverage": "25.00" }, { "id": 14, "symbol": "BTCUSDT", - "riskLimitValue": "28000000", - "maintenanceMargin": "0.07", - "initialMargin": "0.1075", + "riskLimitValue": "50000000", + "maintenanceMargin": "0.029", + "initialMargin": "0.05", "isLowestRisk": 0, - "maxLeverage": "9.30" + "maxLeverage": "20.00" }, { "id": 15, "symbol": "BTCUSDT", - "riskLimitValue": "30000000", - "maintenanceMargin": "0.075", - "initialMargin": "0.115", + "riskLimitValue": "55000000", + "maintenanceMargin": "0.03", + "initialMargin": "0.0526", "isLowestRisk": 0, - "maxLeverage": "8.70" + "maxLeverage": "19.00" }, { "id": 16, "symbol": "BTCUSDT", - "riskLimitValue": "32000000", - "maintenanceMargin": "0.08", - "initialMargin": "0.1225", + "riskLimitValue": "60000000", + "maintenanceMargin": "0.035", + "initialMargin": "0.0556", "isLowestRisk": 0, - "maxLeverage": "8.16" + "maxLeverage": "18.00" }, { "id": 17, "symbol": "BTCUSDT", - "riskLimitValue": "34000000", - "maintenanceMargin": "0.085", - "initialMargin": "0.13", + "riskLimitValue": "65000000", + "maintenanceMargin": "0.036", + "initialMargin": "0.0588", "isLowestRisk": 0, - "maxLeverage": "7.69" + "maxLeverage": "17.00" }, { "id": 18, "symbol": "BTCUSDT", - "riskLimitValue": "36000000", - "maintenanceMargin": "0.09", - "initialMargin": "0.1375", + "riskLimitValue": "70000000", + "maintenanceMargin": "0.038", + "initialMargin": "0.0625", "isLowestRisk": 0, - "maxLeverage": "7.27" + "maxLeverage": "16.00" }, { "id": 19, "symbol": "BTCUSDT", - "riskLimitValue": "38000000", - "maintenanceMargin": "0.095", - "initialMargin": "0.145", + "riskLimitValue": "75000000", + "maintenanceMargin": "0.04", + "initialMargin": "0.0667", "isLowestRisk": 0, - "maxLeverage": "6.90" + "maxLeverage": "15.00" }, { "id": 20, "symbol": "BTCUSDT", - "riskLimitValue": "40000000", - "maintenanceMargin": "0.1", - "initialMargin": "0.1525", + "riskLimitValue": "80000000", + "maintenanceMargin": "0.045", + "initialMargin": "0.0714", "isLowestRisk": 0, - "maxLeverage": "6.56" + "maxLeverage": "14.00" }, { "id": 21, "symbol": "BTCUSDT", - "riskLimitValue": "42000000", - "maintenanceMargin": "0.105", - "initialMargin": "0.16", + "riskLimitValue": "85000000", + "maintenanceMargin": "0.05", + "initialMargin": "0.0769", "isLowestRisk": 0, - "maxLeverage": "6.25" + "maxLeverage": "13.00" }, { "id": 22, "symbol": "BTCUSDT", - "riskLimitValue": "44000000", - "maintenanceMargin": "0.11", - "initialMargin": "0.1675", + "riskLimitValue": "90000000", + "maintenanceMargin": "0.055", + "initialMargin": "0.0833", "isLowestRisk": 0, - "maxLeverage": "5.97" + "maxLeverage": "12.00" }, { "id": 23, "symbol": "BTCUSDT", - "riskLimitValue": "46000000", - "maintenanceMargin": "0.115", - "initialMargin": "0.175", + "riskLimitValue": "95000000", + "maintenanceMargin": "0.06", + "initialMargin": "0.0909", "isLowestRisk": 0, - "maxLeverage": "5.71" + "maxLeverage": "11.00" }, { "id": 24, "symbol": "BTCUSDT", - "riskLimitValue": "48000000", - "maintenanceMargin": "0.12", - "initialMargin": "0.1825", + "riskLimitValue": "100000000", + "maintenanceMargin": "0.065", + "initialMargin": "0.1", "isLowestRisk": 0, - "maxLeverage": "5.48" + "maxLeverage": "10.00" }, { "id": 25, "symbol": "BTCUSDT", - "riskLimitValue": "50000000", - "maintenanceMargin": "0.125", - "initialMargin": "0.19", + "riskLimitValue": "105000000", + "maintenanceMargin": "0.07", + "initialMargin": "0.1111", "isLowestRisk": 0, - "maxLeverage": "5.26" + "maxLeverage": "9.00" }, { "id": 26, "symbol": "BTCUSDT", - "riskLimitValue": "52000000", - "maintenanceMargin": "0.13", - "initialMargin": "0.1975", + "riskLimitValue": "110000000", + "maintenanceMargin": "0.085", + "initialMargin": "0.125", "isLowestRisk": 0, - "maxLeverage": "5.06" + "maxLeverage": "8.00" }, { "id": 27, "symbol": "BTCUSDT", - "riskLimitValue": "54000000", - "maintenanceMargin": "0.135", - "initialMargin": "0.205", + "riskLimitValue": "115000000", + "maintenanceMargin": "0.095", + "initialMargin": "0.1429", "isLowestRisk": 0, - "maxLeverage": "4.88" + "maxLeverage": "7.00" }, { "id": 28, "symbol": "BTCUSDT", - "riskLimitValue": "56000000", - "maintenanceMargin": "0.14", - "initialMargin": "0.2125", + "riskLimitValue": "120000000", + "maintenanceMargin": "0.1", + "initialMargin": "0.1667", "isLowestRisk": 0, - "maxLeverage": "4.71" + "maxLeverage": "6.00" }, { "id": 29, "symbol": "BTCUSDT", - "riskLimitValue": "58000000", - "maintenanceMargin": "0.145", - "initialMargin": "0.22", + "riskLimitValue": "150000000", + "maintenanceMargin": "0.12", + "initialMargin": "0.2", "isLowestRisk": 0, - "maxLeverage": "4.55" + "maxLeverage": "5.00" }, { "id": 30, "symbol": "BTCUSDT", - "riskLimitValue": "60000000", - "maintenanceMargin": "0.15", - "initialMargin": "0.2275", + "riskLimitValue": "200000000", + "maintenanceMargin": "0.14", + "initialMargin": "0.25", "isLowestRisk": 0, - "maxLeverage": "4.40" + "maxLeverage": "4.00" }, { "id": 31, "symbol": "BTCUSDT", - "riskLimitValue": "70000000", + "riskLimitValue": "250000000", "maintenanceMargin": "0.18", - "initialMargin": "0.3", + "initialMargin": "0.3333", "isLowestRisk": 0, - "maxLeverage": "3.33" + "maxLeverage": "3.00" }, { "id": 32, "symbol": "BTCUSDT", - "riskLimitValue": "85000000", + "riskLimitValue": "400000000", "maintenanceMargin": "0.3", "initialMargin": "0.5", "isLowestRisk": 0, @@ -292,20 +292,30 @@ { "id": 33, "symbol": "BTCUSDT", - "riskLimitValue": "100000000", + "riskLimitValue": "600000000", "maintenanceMargin": "0.42", - "initialMargin": "0.7", + "initialMargin": "0.6993", "isLowestRisk": 0, "maxLeverage": "1.43" }, { "id": 34, "symbol": "BTCUSDT", - "riskLimitValue": "200000000", + "riskLimitValue": "800000000", + "maintenanceMargin": "0.5", + "initialMargin": "0.7813", + "isLowestRisk": 0, + "maxLeverage": "1.28" + }, + { + "id": 35, + "symbol": "BTCUSDT", + "riskLimitValue": "1200000000", "maintenanceMargin": "0.6", "initialMargin": "1", "isLowestRisk": 0, "maxLeverage": "1.00" } - ] + ], + "nextPageCursor": "" } \ No newline at end of file