From 2367915a8bc2f73e8af1e416116c7536a9b4126c Mon Sep 17 00:00:00 2001
From: alplabin <122352306+alplabin@users.noreply.github.com>
Date: Thu, 4 Apr 2024 18:22:01 +0900
Subject: [PATCH] v3.3.0
---
CHANGELOG.md | 26 ++++++
.../getCollateralRecord.test.js | 21 ++---
.../getFlexiblePersonalLeftQuota.test.js | 2 +-
.../getFlexibleProductList.test.js | 0
.../getFlexibleProductPosition.test.js | 0
.../getFlexibleRedemptionRecord.test.js | 0
.../getFlexibleRewardsRecord.test.js | 6 +-
.../getFlexibleSubscriptionPreview.test.js | 3 +-
.../getFlexibleSubscriptionRecord.test.js | 0
.../getLockedPersonalLeftQuota.test.js | 11 ++-
.../getLockedProductList.test.js | 0
.../getLockedProductPosition.test.js | 2 +-
.../getLockedRedemptionRecord.test.js | 2 +-
.../getLockedRewardsRecord.test.js | 0
.../getLockedSubscriptionPreview.test.js | 13 ++-
.../getLockedSubscriptionRecord.test.js | 0
.../getRateHistory.test.js | 3 +-
.../getSimpleAccount.test.js | 0
.../redeemFlexibleProduct.test.js | 1 -
.../redeemLockedProduct.test.js | 17 ++--
.../setFlexibleAutoSubscribe.test.js | 1 -
.../setLockedAutoSubscribe.test.js | 13 ++-
.../subscribeFlexibleProduct.test.js | 3 +-
.../subscribeLockedProduct.test.js | 13 ++-
.../spot/simple_earn/getCollateralRecord.js | 9 ++
.../getFlexiblePersonalLeftQuota.js | 9 ++
.../simple_earn/getFlexibleProductList.js | 9 ++
.../simple_earn/getFlexibleProductPosition.js | 9 ++
.../getFlexibleRedemptionRecord.js | 9 ++
.../simple_earn/getFlexibleRewardsRecord.js | 9 ++
.../getFlexibleSubscriptionPreview.js | 9 ++
.../getFlexibleSubscriptionRecord.js | 9 ++
.../simple_earn/getLockedPersonalLeftQuota.js | 9 ++
.../spot/simple_earn/getLockedProductList.js | 9 ++
.../simple_earn/getLockedProductPosition.js | 9 ++
.../simple_earn/getLockedRedemptionRecord.js | 9 ++
.../simple_earn/getLockedRewardsRecord.js | 9 ++
.../getLockedSubscriptionPreview.js | 9 ++
.../getLockedSubscriptionRecord.js | 9 ++
examples/spot/simple_earn/getRateHistory.js | 9 ++
examples/spot/simple_earn/getSimpleAccount.js | 9 ++
.../spot/simple_earn/redeemFlexibleProduct.js | 9 ++
.../spot/simple_earn/redeemLockedProduct.js | 9 ++
.../simple_earn/setFlexibleAutoSubscribe.js | 9 ++
.../simple_earn/setLockedAutoSubscribe.js | 9 ++
.../simple_earn/subscribeFlexibleProduct.js | 9 ++
.../simple_earn/subscribeLockedProduct.js | 9 ++
src/modules/restful/simpleEarn.js | 89 ++++++++++---------
48 files changed, 329 insertions(+), 104 deletions(-)
rename __tests__/spot/{simpleEarn => simple_earn}/getCollateralRecord.test.js (52%)
rename __tests__/spot/{simpleEarn => simple_earn}/getFlexiblePersonalLeftQuota.test.js (93%)
rename __tests__/spot/{simpleEarn => simple_earn}/getFlexibleProductList.test.js (100%)
rename __tests__/spot/{simpleEarn => simple_earn}/getFlexibleProductPosition.test.js (100%)
rename __tests__/spot/{simpleEarn => simple_earn}/getFlexibleRedemptionRecord.test.js (100%)
rename __tests__/spot/{simpleEarn => simple_earn}/getFlexibleRewardsRecord.test.js (91%)
rename __tests__/spot/{simpleEarn => simple_earn}/getFlexibleSubscriptionPreview.test.js (94%)
rename __tests__/spot/{simpleEarn => simple_earn}/getFlexibleSubscriptionRecord.test.js (100%)
rename __tests__/spot/{simpleEarn => simple_earn}/getLockedPersonalLeftQuota.test.js (79%)
rename __tests__/spot/{simpleEarn => simple_earn}/getLockedProductList.test.js (100%)
rename __tests__/spot/{simpleEarn => simple_earn}/getLockedProductPosition.test.js (97%)
rename __tests__/spot/{simpleEarn => simple_earn}/getLockedRedemptionRecord.test.js (97%)
rename __tests__/spot/{simpleEarn => simple_earn}/getLockedRewardsRecord.test.js (100%)
rename __tests__/spot/{simpleEarn => simple_earn}/getLockedSubscriptionPreview.test.js (77%)
rename __tests__/spot/{simpleEarn => simple_earn}/getLockedSubscriptionRecord.test.js (100%)
rename __tests__/spot/{simpleEarn => simple_earn}/getRateHistory.test.js (94%)
rename __tests__/spot/{simpleEarn => simple_earn}/getSimpleAccount.test.js (100%)
rename __tests__/spot/{simpleEarn => simple_earn}/redeemFlexibleProduct.test.js (99%)
rename __tests__/spot/{simpleEarn => simple_earn}/redeemLockedProduct.test.js (57%)
rename __tests__/spot/{simpleEarn => simple_earn}/setFlexibleAutoSubscribe.test.js (99%)
rename __tests__/spot/{simpleEarn => simple_earn}/setLockedAutoSubscribe.test.js (76%)
rename __tests__/spot/{simpleEarn => simple_earn}/subscribeFlexibleProduct.test.js (95%)
rename __tests__/spot/{simpleEarn => simple_earn}/subscribeLockedProduct.test.js (78%)
create mode 100644 examples/spot/simple_earn/getCollateralRecord.js
create mode 100644 examples/spot/simple_earn/getFlexiblePersonalLeftQuota.js
create mode 100644 examples/spot/simple_earn/getFlexibleProductList.js
create mode 100644 examples/spot/simple_earn/getFlexibleProductPosition.js
create mode 100644 examples/spot/simple_earn/getFlexibleRedemptionRecord.js
create mode 100644 examples/spot/simple_earn/getFlexibleRewardsRecord.js
create mode 100644 examples/spot/simple_earn/getFlexibleSubscriptionPreview.js
create mode 100644 examples/spot/simple_earn/getFlexibleSubscriptionRecord.js
create mode 100644 examples/spot/simple_earn/getLockedPersonalLeftQuota.js
create mode 100644 examples/spot/simple_earn/getLockedProductList.js
create mode 100644 examples/spot/simple_earn/getLockedProductPosition.js
create mode 100644 examples/spot/simple_earn/getLockedRedemptionRecord.js
create mode 100644 examples/spot/simple_earn/getLockedRewardsRecord.js
create mode 100644 examples/spot/simple_earn/getLockedSubscriptionPreview.js
create mode 100644 examples/spot/simple_earn/getLockedSubscriptionRecord.js
create mode 100644 examples/spot/simple_earn/getRateHistory.js
create mode 100644 examples/spot/simple_earn/getSimpleAccount.js
create mode 100644 examples/spot/simple_earn/redeemFlexibleProduct.js
create mode 100644 examples/spot/simple_earn/redeemLockedProduct.js
create mode 100644 examples/spot/simple_earn/setFlexibleAutoSubscribe.js
create mode 100644 examples/spot/simple_earn/setLockedAutoSubscribe.js
create mode 100644 examples/spot/simple_earn/subscribeFlexibleProduct.js
create mode 100644 examples/spot/simple_earn/subscribeLockedProduct.js
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dcdf420..0f8fb5a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,32 @@
## 3.3.0 - 2024-04-04
+### Added
+- Add Simple Earn endpoints:
+ - `GET /sapi/v1/simple-earn/flexible/list` to query available Simple Earn flexible product list
+ - `GET /sapi/v1/simple-earn/locked/list` to query available Simple Earn locked product list
+ - `POST /sapi/v1/simple-earn/flexible/subscribe` to subscribe to a flexible product
+ - `POST /sapi/v1/simple-earn/locked/subscribe` to subscribe to a locked product
+ - `POST /sapi/v1/simple-earn/flexible/redeem` to redeem a flexible product
+ - `POST /sapi/v1/simple-earn/locked/redeem` to redeem a locked product
+ - `GET /sapi/v1/simple-earn/flexible/position` to get a flexible product position
+ - `GET /sapi/v1/simple-earn/locked/position` to get a locked product position
+ - `GET /sapi/v1/simple-earn/account ` to get a simple account balances
+ - `GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord` to get flexible subscription records
+ - `GET /sapi/v1/simple-earn/locked/history/subscriptionRecord ` to get locked subscription records
+ - `GET /sapi/v1/simple-earn/flexible/history/redemptionRecord ` to retrieve flexible redemption records
+ - `GET /sapi/v1/simple-earn/locked/history/redemptionRecord ` to retrieve locked redemption records
+ - `GET /sapi/v1/simple-earn/flexible/history/rewardsRecord ` to get flexible rewards history
+ - `GET /sapi/v1/simple-earn/locked/history/rewardsRecord ` to get locked rewards history
+ - `POST /sapi/v1/simple-earn/flexible/setAutoSubscribe` to set an auto-subscription to a flexible product
+ - `POST /sapi/v1/simple-earn/locked/setAutoSubscribe` to set an auto-subscription to a locked product
+ - `GET /sapi/v1/simple-earn/flexible/personalLeftQuota` to get flexible personal left quota
+ - `GET /sapi/v1/simple-earn/locked/personalLeftQuota` to get locked personal left quota
+ - `GET /sapi/v1/simple-earn/flexible/subscriptionPreview` to get flexible subscription preview
+ - `GET /sapi/v1/simple-earn/locked/subscriptionPreview` to get locked subscription previews
+ - `GET /sapi/v1/simple-earn/flexible/history/rateHistory` to get a rate history
+ - `GET /sapi/v1/simple-earn/flexible/history/collateralRecord` to get collateral records
+
### Changed
- Update dependencies
diff --git a/__tests__/spot/simpleEarn/getCollateralRecord.test.js b/__tests__/spot/simple_earn/getCollateralRecord.test.js
similarity index 52%
rename from __tests__/spot/simpleEarn/getCollateralRecord.test.js
rename to __tests__/spot/simple_earn/getCollateralRecord.test.js
index a8f325e..5b103c0 100644
--- a/__tests__/spot/simpleEarn/getCollateralRecord.test.js
+++ b/__tests__/spot/simple_earn/getCollateralRecord.test.js
@@ -1,26 +1,23 @@
/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
-const productId = '1'
-
describe('#getCollateralRecord', () => {
- describe('throw MissingParameterError', () => {
- it('missing productId', () => {
- expect(() => {
- SpotClient.getCollateralRecord('')
- }).toThrow(MissingParameterError)
+ it('should return collateral records', () => {
+ nockMock('/sapi/v1/simple-earn/flexible/history/collateralRecord')(mockResponse)
+
+ return SpotClient.getCollateralRecord().then(response => {
+ expect(response).toBeDefined()
+ expect(response.data).toEqual(mockResponse)
})
})
- it('should suscribe locked product', () => {
+ it('should return collateral records with params', () => {
const parameters = {
- productId
+ productId: '1'
}
nockMock(`/sapi/v1/simple-earn/flexible/history/collateralRecord?${buildQueryString(parameters)}`)(mockResponse)
- return SpotClient.getCollateralRecord(productId).then(response => {
+ return SpotClient.getCollateralRecord(parameters).then(response => {
expect(response).toBeDefined()
expect(response.data).toEqual(mockResponse)
})
diff --git a/__tests__/spot/simpleEarn/getFlexiblePersonalLeftQuota.test.js b/__tests__/spot/simple_earn/getFlexiblePersonalLeftQuota.test.js
similarity index 93%
rename from __tests__/spot/simpleEarn/getFlexiblePersonalLeftQuota.test.js
rename to __tests__/spot/simple_earn/getFlexiblePersonalLeftQuota.test.js
index 7e740f4..123a71d 100644
--- a/__tests__/spot/simpleEarn/getFlexiblePersonalLeftQuota.test.js
+++ b/__tests__/spot/simple_earn/getFlexiblePersonalLeftQuota.test.js
@@ -14,7 +14,7 @@ describe('#getFlexiblePersonalLeftQuota', () => {
}).toThrow(MissingParameterError)
})
})
- it('should redeem flexible product', () => {
+ it('should return flexible personal left quota', () => {
const parameters = {
productId
}
diff --git a/__tests__/spot/simpleEarn/getFlexibleProductList.test.js b/__tests__/spot/simple_earn/getFlexibleProductList.test.js
similarity index 100%
rename from __tests__/spot/simpleEarn/getFlexibleProductList.test.js
rename to __tests__/spot/simple_earn/getFlexibleProductList.test.js
diff --git a/__tests__/spot/simpleEarn/getFlexibleProductPosition.test.js b/__tests__/spot/simple_earn/getFlexibleProductPosition.test.js
similarity index 100%
rename from __tests__/spot/simpleEarn/getFlexibleProductPosition.test.js
rename to __tests__/spot/simple_earn/getFlexibleProductPosition.test.js
diff --git a/__tests__/spot/simpleEarn/getFlexibleRedemptionRecord.test.js b/__tests__/spot/simple_earn/getFlexibleRedemptionRecord.test.js
similarity index 100%
rename from __tests__/spot/simpleEarn/getFlexibleRedemptionRecord.test.js
rename to __tests__/spot/simple_earn/getFlexibleRedemptionRecord.test.js
diff --git a/__tests__/spot/simpleEarn/getFlexibleRewardsRecord.test.js b/__tests__/spot/simple_earn/getFlexibleRewardsRecord.test.js
similarity index 91%
rename from __tests__/spot/simpleEarn/getFlexibleRewardsRecord.test.js
rename to __tests__/spot/simple_earn/getFlexibleRewardsRecord.test.js
index 117cb11..c124c96 100644
--- a/__tests__/spot/simpleEarn/getFlexibleRewardsRecord.test.js
+++ b/__tests__/spot/simple_earn/getFlexibleRewardsRecord.test.js
@@ -1,9 +1,9 @@
/* global describe, it, expect */
+const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockMock, SpotClient, buildQueryString } = require('../../testUtils/testSetup')
const { mockResponse } = require('../../testUtils/mockData')
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const type = 'FLEXIBLE'
+const type = 'REALTIME'
describe('#getFlexibleRewardsRecord', () => {
describe('throw MissingParameterError', () => {
@@ -14,7 +14,7 @@ describe('#getFlexibleRewardsRecord', () => {
})
})
- it('should return locked records history with params', () => {
+ it('should return flexible reward records', () => {
const parameters = {
type,
productId: '1',
diff --git a/__tests__/spot/simpleEarn/getFlexibleSubscriptionPreview.test.js b/__tests__/spot/simple_earn/getFlexibleSubscriptionPreview.test.js
similarity index 94%
rename from __tests__/spot/simpleEarn/getFlexibleSubscriptionPreview.test.js
rename to __tests__/spot/simple_earn/getFlexibleSubscriptionPreview.test.js
index 3def1ae..cbf9b32 100644
--- a/__tests__/spot/simpleEarn/getFlexibleSubscriptionPreview.test.js
+++ b/__tests__/spot/simple_earn/getFlexibleSubscriptionPreview.test.js
@@ -1,7 +1,6 @@
/* global describe, it, expect */
const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
const productId = '1'
@@ -21,7 +20,7 @@ describe('#getFlexibleSubscriptionPreview', () => {
}).toThrow(MissingParameterError)
})
})
- it('should suscribe locked product', () => {
+ it('should return flexible subscription previews', () => {
const parameters = {
productId,
amount
diff --git a/__tests__/spot/simpleEarn/getFlexibleSubscriptionRecord.test.js b/__tests__/spot/simple_earn/getFlexibleSubscriptionRecord.test.js
similarity index 100%
rename from __tests__/spot/simpleEarn/getFlexibleSubscriptionRecord.test.js
rename to __tests__/spot/simple_earn/getFlexibleSubscriptionRecord.test.js
diff --git a/__tests__/spot/simpleEarn/getLockedPersonalLeftQuota.test.js b/__tests__/spot/simple_earn/getLockedPersonalLeftQuota.test.js
similarity index 79%
rename from __tests__/spot/simpleEarn/getLockedPersonalLeftQuota.test.js
rename to __tests__/spot/simple_earn/getLockedPersonalLeftQuota.test.js
index ed17e8a..3375369 100644
--- a/__tests__/spot/simpleEarn/getLockedPersonalLeftQuota.test.js
+++ b/__tests__/spot/simple_earn/getLockedPersonalLeftQuota.test.js
@@ -1,26 +1,25 @@
/* global describe, it, expect */
const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
-const productId = '1'
+const projectId = '1'
describe('#getLockedPersonalLeftQuota', () => {
describe('throw MissingParameterError', () => {
- it('missing productId', () => {
+ it('missing projectId', () => {
expect(() => {
SpotClient.getLockedPersonalLeftQuota('')
}).toThrow(MissingParameterError)
})
})
- it('should redeem flexible product', () => {
+ it('should return locked personal left quota', () => {
const parameters = {
- productId
+ projectId
}
nockMock(`/sapi/v1/simple-earn/locked/personalLeftQuota?${buildQueryString({ ...parameters })}`)(mockResponse)
- return SpotClient.getLockedPersonalLeftQuota(productId).then(response => {
+ return SpotClient.getLockedPersonalLeftQuota(projectId).then(response => {
expect(response).toBeDefined()
expect(response.data).toEqual(mockResponse)
})
diff --git a/__tests__/spot/simpleEarn/getLockedProductList.test.js b/__tests__/spot/simple_earn/getLockedProductList.test.js
similarity index 100%
rename from __tests__/spot/simpleEarn/getLockedProductList.test.js
rename to __tests__/spot/simple_earn/getLockedProductList.test.js
diff --git a/__tests__/spot/simpleEarn/getLockedProductPosition.test.js b/__tests__/spot/simple_earn/getLockedProductPosition.test.js
similarity index 97%
rename from __tests__/spot/simpleEarn/getLockedProductPosition.test.js
rename to __tests__/spot/simple_earn/getLockedProductPosition.test.js
index fded184..535eeb7 100644
--- a/__tests__/spot/simpleEarn/getLockedProductPosition.test.js
+++ b/__tests__/spot/simple_earn/getLockedProductPosition.test.js
@@ -15,7 +15,7 @@ describe('#getLockedProductPosition', () => {
it('should return locked product position with params', () => {
const parameters = {
asset: 'USDT',
- productId: '1',
+ positionId: '1',
current: 5,
size: 10
}
diff --git a/__tests__/spot/simpleEarn/getLockedRedemptionRecord.test.js b/__tests__/spot/simple_earn/getLockedRedemptionRecord.test.js
similarity index 97%
rename from __tests__/spot/simpleEarn/getLockedRedemptionRecord.test.js
rename to __tests__/spot/simple_earn/getLockedRedemptionRecord.test.js
index 53e6f71..874df69 100644
--- a/__tests__/spot/simpleEarn/getLockedRedemptionRecord.test.js
+++ b/__tests__/spot/simple_earn/getLockedRedemptionRecord.test.js
@@ -15,7 +15,7 @@ describe('#getLockedRedemptionRecord', () => {
it('should return locked redemption records with params', () => {
const parameters = {
asset: 'USDT',
- productId: '1',
+ positionId: '1',
current: 5,
size: 10
}
diff --git a/__tests__/spot/simpleEarn/getLockedRewardsRecord.test.js b/__tests__/spot/simple_earn/getLockedRewardsRecord.test.js
similarity index 100%
rename from __tests__/spot/simpleEarn/getLockedRewardsRecord.test.js
rename to __tests__/spot/simple_earn/getLockedRewardsRecord.test.js
diff --git a/__tests__/spot/simpleEarn/getLockedSubscriptionPreview.test.js b/__tests__/spot/simple_earn/getLockedSubscriptionPreview.test.js
similarity index 77%
rename from __tests__/spot/simpleEarn/getLockedSubscriptionPreview.test.js
rename to __tests__/spot/simple_earn/getLockedSubscriptionPreview.test.js
index 22e5e97..5748034 100644
--- a/__tests__/spot/simpleEarn/getLockedSubscriptionPreview.test.js
+++ b/__tests__/spot/simple_earn/getLockedSubscriptionPreview.test.js
@@ -1,15 +1,14 @@
/* global describe, it, expect */
const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
-const productId = '1'
+const projectId = '1'
const amount = 10
describe('#getLockedSubscriptionPreview', () => {
describe('throw MissingParameterError', () => {
- it('missing productId', () => {
+ it('missing projectId', () => {
expect(() => {
SpotClient.getLockedSubscriptionPreview('', amount)
}).toThrow(MissingParameterError)
@@ -17,18 +16,18 @@ describe('#getLockedSubscriptionPreview', () => {
it('missing amount', () => {
expect(() => {
- SpotClient.getLockedSubscriptionPreview(productId, '')
+ SpotClient.getLockedSubscriptionPreview(projectId, '')
}).toThrow(MissingParameterError)
})
})
- it('should suscribe locked product', () => {
+ it('should return locked subscription preview', () => {
const parameters = {
- productId,
+ projectId,
amount
}
nockMock(`/sapi/v1/simple-earn/locked/subscriptionPreview?${buildQueryString({ ...parameters })}`)(mockResponse)
- return SpotClient.getLockedSubscriptionPreview(productId, amount).then(response => {
+ return SpotClient.getLockedSubscriptionPreview(projectId, amount).then(response => {
expect(response).toBeDefined()
expect(response.data).toEqual(mockResponse)
})
diff --git a/__tests__/spot/simpleEarn/getLockedSubscriptionRecord.test.js b/__tests__/spot/simple_earn/getLockedSubscriptionRecord.test.js
similarity index 100%
rename from __tests__/spot/simpleEarn/getLockedSubscriptionRecord.test.js
rename to __tests__/spot/simple_earn/getLockedSubscriptionRecord.test.js
diff --git a/__tests__/spot/simpleEarn/getRateHistory.test.js b/__tests__/spot/simple_earn/getRateHistory.test.js
similarity index 94%
rename from __tests__/spot/simpleEarn/getRateHistory.test.js
rename to __tests__/spot/simple_earn/getRateHistory.test.js
index 4cbdabf..ba26e66 100644
--- a/__tests__/spot/simpleEarn/getRateHistory.test.js
+++ b/__tests__/spot/simple_earn/getRateHistory.test.js
@@ -1,7 +1,6 @@
/* global describe, it, expect */
const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
const productId = '1'
@@ -14,7 +13,7 @@ describe('#getRateHistory', () => {
}).toThrow(MissingParameterError)
})
})
- it('should suscribe locked product', () => {
+ it('should return rate history', () => {
const parameters = {
productId
}
diff --git a/__tests__/spot/simpleEarn/getSimpleAccount.test.js b/__tests__/spot/simple_earn/getSimpleAccount.test.js
similarity index 100%
rename from __tests__/spot/simpleEarn/getSimpleAccount.test.js
rename to __tests__/spot/simple_earn/getSimpleAccount.test.js
diff --git a/__tests__/spot/simpleEarn/redeemFlexibleProduct.test.js b/__tests__/spot/simple_earn/redeemFlexibleProduct.test.js
similarity index 99%
rename from __tests__/spot/simpleEarn/redeemFlexibleProduct.test.js
rename to __tests__/spot/simple_earn/redeemFlexibleProduct.test.js
index e2c0a76..b4d1c75 100644
--- a/__tests__/spot/simpleEarn/redeemFlexibleProduct.test.js
+++ b/__tests__/spot/simple_earn/redeemFlexibleProduct.test.js
@@ -1,7 +1,6 @@
/* global describe, it, expect */
const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
const productId = '1'
diff --git a/__tests__/spot/simpleEarn/redeemLockedProduct.test.js b/__tests__/spot/simple_earn/redeemLockedProduct.test.js
similarity index 57%
rename from __tests__/spot/simpleEarn/redeemLockedProduct.test.js
rename to __tests__/spot/simple_earn/redeemLockedProduct.test.js
index b4db459..f9413f9 100644
--- a/__tests__/spot/simpleEarn/redeemLockedProduct.test.js
+++ b/__tests__/spot/simple_earn/redeemLockedProduct.test.js
@@ -1,26 +1,25 @@
/* global describe, it, expect */
const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
-const productId = '1'
+const positionId = '1'
-describe('#redeemFlexibleProduct', () => {
+describe('#redeemLockedProduct', () => {
describe('throw MissingParameterError', () => {
- it('missing productId', () => {
+ it('missing positionId', () => {
expect(() => {
- SpotClient.redeemFlexibleProduct('')
+ SpotClient.redeemLockedProduct('')
}).toThrow(MissingParameterError)
})
})
- it('should suscribe flexible product', () => {
+ it('should redeem locked product', () => {
const parameters = {
- productId
+ positionId
}
- nockPostMock(`/sapi/v1/simple-earn/flexible/redeem?${buildQueryString({ ...parameters })}`)(mockResponse)
+ nockPostMock(`/sapi/v1/simple-earn/locked/redeem?${buildQueryString({ ...parameters })}`)(mockResponse)
- return SpotClient.redeemFlexibleProduct(productId).then(response => {
+ return SpotClient.redeemLockedProduct(positionId).then(response => {
expect(response).toBeDefined()
expect(response.data).toEqual(mockResponse)
})
diff --git a/__tests__/spot/simpleEarn/setFlexibleAutoSubscribe.test.js b/__tests__/spot/simple_earn/setFlexibleAutoSubscribe.test.js
similarity index 99%
rename from __tests__/spot/simpleEarn/setFlexibleAutoSubscribe.test.js
rename to __tests__/spot/simple_earn/setFlexibleAutoSubscribe.test.js
index 31757ba..d7110e8 100644
--- a/__tests__/spot/simpleEarn/setFlexibleAutoSubscribe.test.js
+++ b/__tests__/spot/simple_earn/setFlexibleAutoSubscribe.test.js
@@ -1,7 +1,6 @@
/* global describe, it, expect */
const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
const productId = '1'
diff --git a/__tests__/spot/simpleEarn/setLockedAutoSubscribe.test.js b/__tests__/spot/simple_earn/setLockedAutoSubscribe.test.js
similarity index 76%
rename from __tests__/spot/simpleEarn/setLockedAutoSubscribe.test.js
rename to __tests__/spot/simple_earn/setLockedAutoSubscribe.test.js
index decea8d..81b40cf 100644
--- a/__tests__/spot/simpleEarn/setLockedAutoSubscribe.test.js
+++ b/__tests__/spot/simple_earn/setLockedAutoSubscribe.test.js
@@ -1,15 +1,14 @@
/* global describe, it, expect */
const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
-const productId = '1'
+const positionId = '1'
const autoSubscribe = true
describe('#setLockedAutoSubscribe', () => {
describe('throw MissingParameterError', () => {
- it('missing productId', () => {
+ it('missing positionId', () => {
expect(() => {
SpotClient.setLockedAutoSubscribe('', autoSubscribe)
}).toThrow(MissingParameterError)
@@ -17,18 +16,18 @@ describe('#setLockedAutoSubscribe', () => {
it('missing autoSubscribe', () => {
expect(() => {
- SpotClient.setLockedAutoSubscribe(productId, '')
+ SpotClient.setLockedAutoSubscribe(positionId, '')
}).toThrow(MissingParameterError)
})
})
- it('should suscribe flexible product', () => {
+ it('should suscribe locked product', () => {
const parameters = {
- productId,
+ positionId,
autoSubscribe
}
nockPostMock(`/sapi/v1/simple-earn/locked/setAutoSubscribe?${buildQueryString({ ...parameters })}`)(mockResponse)
- return SpotClient.setLockedAutoSubscribe(productId, autoSubscribe).then(response => {
+ return SpotClient.setLockedAutoSubscribe(positionId, autoSubscribe).then(response => {
expect(response).toBeDefined()
expect(response.data).toEqual(mockResponse)
})
diff --git a/__tests__/spot/simpleEarn/subscribeFlexibleProduct.test.js b/__tests__/spot/simple_earn/subscribeFlexibleProduct.test.js
similarity index 95%
rename from __tests__/spot/simpleEarn/subscribeFlexibleProduct.test.js
rename to __tests__/spot/simple_earn/subscribeFlexibleProduct.test.js
index fd420fd..73cacd4 100644
--- a/__tests__/spot/simpleEarn/subscribeFlexibleProduct.test.js
+++ b/__tests__/spot/simple_earn/subscribeFlexibleProduct.test.js
@@ -1,7 +1,6 @@
/* global describe, it, expect */
const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
const productId = '1'
@@ -21,7 +20,7 @@ describe('#subscribeFlexibleProduct', () => {
}).toThrow(MissingParameterError)
})
})
- it('should suscribe flexible product', () => {
+ it('should subscribe flexible product', () => {
const parameters = {
productId,
amount
diff --git a/__tests__/spot/simpleEarn/subscribeLockedProduct.test.js b/__tests__/spot/simple_earn/subscribeLockedProduct.test.js
similarity index 78%
rename from __tests__/spot/simpleEarn/subscribeLockedProduct.test.js
rename to __tests__/spot/simple_earn/subscribeLockedProduct.test.js
index a1c2e18..0ec5fed 100644
--- a/__tests__/spot/simpleEarn/subscribeLockedProduct.test.js
+++ b/__tests__/spot/simple_earn/subscribeLockedProduct.test.js
@@ -1,15 +1,14 @@
/* global describe, it, expect */
const MissingParameterError = require('../../../src/error/missingParameterError')
const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
const { mockResponse } = require('../../testUtils/mockData')
-const productId = '1'
+const projectId = '1'
const amount = 10
describe('#subscribeLockedProduct', () => {
describe('throw MissingParameterError', () => {
- it('missing productId', () => {
+ it('missing projectId', () => {
expect(() => {
SpotClient.subscribeLockedProduct('', amount)
}).toThrow(MissingParameterError)
@@ -17,18 +16,18 @@ describe('#subscribeLockedProduct', () => {
it('missing amount', () => {
expect(() => {
- SpotClient.subscribeLockedProduct(productId, '')
+ SpotClient.subscribeLockedProduct(projectId, '')
}).toThrow(MissingParameterError)
})
})
- it('should suscribe locked product', () => {
+ it('should subscribe locked product', () => {
const parameters = {
- productId,
+ projectId,
amount
}
nockPostMock(`/sapi/v1/simple-earn/locked/subscribe?${buildQueryString({ ...parameters })}`)(mockResponse)
- return SpotClient.subscribeLockedProduct(productId, amount).then(response => {
+ return SpotClient.subscribeLockedProduct(projectId, amount).then(response => {
expect(response).toBeDefined()
expect(response.data).toEqual(mockResponse)
})
diff --git a/examples/spot/simple_earn/getCollateralRecord.js b/examples/spot/simple_earn/getCollateralRecord.js
new file mode 100644
index 0000000..524d81b
--- /dev/null
+++ b/examples/spot/simple_earn/getCollateralRecord.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getCollateralRecord()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getFlexiblePersonalLeftQuota.js b/examples/spot/simple_earn/getFlexiblePersonalLeftQuota.js
new file mode 100644
index 0000000..a836a2f
--- /dev/null
+++ b/examples/spot/simple_earn/getFlexiblePersonalLeftQuota.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getFlexiblePersonalLeftQuota('BTC001')
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getFlexibleProductList.js b/examples/spot/simple_earn/getFlexibleProductList.js
new file mode 100644
index 0000000..12ad9c3
--- /dev/null
+++ b/examples/spot/simple_earn/getFlexibleProductList.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getFlexibleProductList()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getFlexibleProductPosition.js b/examples/spot/simple_earn/getFlexibleProductPosition.js
new file mode 100644
index 0000000..01321a0
--- /dev/null
+++ b/examples/spot/simple_earn/getFlexibleProductPosition.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getFlexibleProductPosition()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getFlexibleRedemptionRecord.js b/examples/spot/simple_earn/getFlexibleRedemptionRecord.js
new file mode 100644
index 0000000..30fd3e8
--- /dev/null
+++ b/examples/spot/simple_earn/getFlexibleRedemptionRecord.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getFlexibleRedemptionRecord()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getFlexibleRewardsRecord.js b/examples/spot/simple_earn/getFlexibleRewardsRecord.js
new file mode 100644
index 0000000..7e22335
--- /dev/null
+++ b/examples/spot/simple_earn/getFlexibleRewardsRecord.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getFlexibleRewardsRecord('REALTIME')
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getFlexibleSubscriptionPreview.js b/examples/spot/simple_earn/getFlexibleSubscriptionPreview.js
new file mode 100644
index 0000000..c1b031b
--- /dev/null
+++ b/examples/spot/simple_earn/getFlexibleSubscriptionPreview.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getFlexibleSubscriptionPreview('BTC001', 1.0)
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getFlexibleSubscriptionRecord.js b/examples/spot/simple_earn/getFlexibleSubscriptionRecord.js
new file mode 100644
index 0000000..4a50351
--- /dev/null
+++ b/examples/spot/simple_earn/getFlexibleSubscriptionRecord.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getFlexibleSubscriptionRecord()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getLockedPersonalLeftQuota.js b/examples/spot/simple_earn/getLockedPersonalLeftQuota.js
new file mode 100644
index 0000000..424da8e
--- /dev/null
+++ b/examples/spot/simple_earn/getLockedPersonalLeftQuota.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getLockedPersonalLeftQuota('Bnb*120')
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getLockedProductList.js b/examples/spot/simple_earn/getLockedProductList.js
new file mode 100644
index 0000000..beef1dd
--- /dev/null
+++ b/examples/spot/simple_earn/getLockedProductList.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getLockedProductList()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getLockedProductPosition.js b/examples/spot/simple_earn/getLockedProductPosition.js
new file mode 100644
index 0000000..48738aa
--- /dev/null
+++ b/examples/spot/simple_earn/getLockedProductPosition.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getLockedProductPosition()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getLockedRedemptionRecord.js b/examples/spot/simple_earn/getLockedRedemptionRecord.js
new file mode 100644
index 0000000..deecaa0
--- /dev/null
+++ b/examples/spot/simple_earn/getLockedRedemptionRecord.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getLockedRedemptionRecord()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getLockedRewardsRecord.js b/examples/spot/simple_earn/getLockedRewardsRecord.js
new file mode 100644
index 0000000..97b106e
--- /dev/null
+++ b/examples/spot/simple_earn/getLockedRewardsRecord.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getLockedRewardsRecord()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getLockedSubscriptionPreview.js b/examples/spot/simple_earn/getLockedSubscriptionPreview.js
new file mode 100644
index 0000000..3f698e2
--- /dev/null
+++ b/examples/spot/simple_earn/getLockedSubscriptionPreview.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getLockedSubscriptionPreview('Bnb*120', 1.0)
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getLockedSubscriptionRecord.js b/examples/spot/simple_earn/getLockedSubscriptionRecord.js
new file mode 100644
index 0000000..904ed21
--- /dev/null
+++ b/examples/spot/simple_earn/getLockedSubscriptionRecord.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getLockedSubscriptionRecord()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getRateHistory.js b/examples/spot/simple_earn/getRateHistory.js
new file mode 100644
index 0000000..43dd896
--- /dev/null
+++ b/examples/spot/simple_earn/getRateHistory.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getRateHistory('BTC001')
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/getSimpleAccount.js b/examples/spot/simple_earn/getSimpleAccount.js
new file mode 100644
index 0000000..54cc775
--- /dev/null
+++ b/examples/spot/simple_earn/getSimpleAccount.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.getSimpleAccount()
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/redeemFlexibleProduct.js b/examples/spot/simple_earn/redeemFlexibleProduct.js
new file mode 100644
index 0000000..796d9c5
--- /dev/null
+++ b/examples/spot/simple_earn/redeemFlexibleProduct.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.redeemFlexibleProduct('BTC001')
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/redeemLockedProduct.js b/examples/spot/simple_earn/redeemLockedProduct.js
new file mode 100644
index 0000000..817f7f7
--- /dev/null
+++ b/examples/spot/simple_earn/redeemLockedProduct.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.redeemLockedProduct('1234')
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/setFlexibleAutoSubscribe.js b/examples/spot/simple_earn/setFlexibleAutoSubscribe.js
new file mode 100644
index 0000000..f6855e8
--- /dev/null
+++ b/examples/spot/simple_earn/setFlexibleAutoSubscribe.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.setFlexibleAutoSubscribe('1234', true)
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/setLockedAutoSubscribe.js b/examples/spot/simple_earn/setLockedAutoSubscribe.js
new file mode 100644
index 0000000..2032d1b
--- /dev/null
+++ b/examples/spot/simple_earn/setLockedAutoSubscribe.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.setLockedAutoSubscribe('1234', true)
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/subscribeFlexibleProduct.js b/examples/spot/simple_earn/subscribeFlexibleProduct.js
new file mode 100644
index 0000000..22021ce
--- /dev/null
+++ b/examples/spot/simple_earn/subscribeFlexibleProduct.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.subscribeFlexibleProduct('BTC001', 0.01)
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/examples/spot/simple_earn/subscribeLockedProduct.js b/examples/spot/simple_earn/subscribeLockedProduct.js
new file mode 100644
index 0000000..e394652
--- /dev/null
+++ b/examples/spot/simple_earn/subscribeLockedProduct.js
@@ -0,0 +1,9 @@
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.subscribeLockedProduct('Bnb*120', 1.0)
+ .then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/src/modules/restful/simpleEarn.js b/src/modules/restful/simpleEarn.js
index 3e057f7..454ed1f 100644
--- a/src/modules/restful/simpleEarn.js
+++ b/src/modules/restful/simpleEarn.js
@@ -57,11 +57,11 @@ const SimpleEarn = superclass => class extends superclass {
*
* POST /sapi/v1/simple-earn/flexible/subscribe
*
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-simple-earn-locked-product-list-user_data}
+ * {@link https://binance-docs.github.io/apidocs/spot/en/#subscribe-flexible-product-trade}
*
* @param {string} productId
* @param {number} amount
- * @param {object} options
+ * @param {object} [options]
* @param {boolean} [options.autoSubscribe]
* @param {string} [options.sourceAccount]
* @param {number} [options.recvWindow]
@@ -83,20 +83,20 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#subscribe-locked-product-trade}
*
- * @param {string} productId
+ * @param {string} projectId
* @param {number} amount
- * @param {object} options
+ * @param {object} [options]
* @param {boolean} [options.autoSubscribe]
* @param {string} [options.sourceAccount]
* @param {number} [options.recvWindow]
*
*/
- subscribeLockedProduct (productId, amount, options = {}) {
- validateRequiredParameters({ productId, amount })
+ subscribeLockedProduct (projectId, amount, options = {}) {
+ validateRequiredParameters({ projectId, amount })
return this.signRequest(
'POST',
'/sapi/v1/simple-earn/locked/subscribe',
- Object.assign(options, { productId, amount })
+ Object.assign(options, { projectId, amount })
)
}
@@ -108,7 +108,7 @@ const SimpleEarn = superclass => class extends superclass {
* {@link https://binance-docs.github.io/apidocs/spot/en/#redeem-flexible-product-trade}
*
* @param {string} productId
- * @param {object} options
+ * @param {object} [options]
* @param {boolean} [options.redeemAll] // true or false, default to false
* @param {number} [options.amount] // if redeemAll is false, amount is mandatory
* @param {string} [options.destAccount]
@@ -131,17 +131,17 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#redeem-locked-product-trade}
*
- * @param {string} productId
- * @param {object} options
+ * @param {string} positionId
+ * @param {object} [options]
* @param {number} [options.recvWindow]
*
*/
- redeemLockedProduct (productId, options = {}) {
- validateRequiredParameters({ productId })
+ redeemLockedProduct (positionId, options = {}) {
+ validateRequiredParameters({ positionId })
return this.signRequest(
'POST',
'/sapi/v1/simple-earn/locked/redeem',
- Object.assign(options, { productId })
+ Object.assign(options, { positionId })
)
}
@@ -152,8 +152,7 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-position-user_data}
*
- *
- * @param {object} options
+ * @param {object} [options]
* @param {string} [options.asset]
* @param {string} [options.productId]
* @param {number} [options.current]
@@ -176,10 +175,10 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-locked-product-position-user_data}
*
- *
- * @param {object} options
+ * @param {object} [options]
* @param {string} [options.asset]
- * @param {string} [options.productId]
+ * @param {string} [options.positionId]
+ * @param {string} [options.projectId]
* @param {number} [options.current]
* @param {number} [options.size]
* @param {number} [options.recvWindow]
@@ -198,9 +197,9 @@ const SimpleEarn = superclass => class extends superclass {
*
* GET /sapi/v1/simple-earn/account
*
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-simple-account-user_data}
+ * {@link https://binance-docs.github.io/apidocs/spot/en/#simple-account-user_data}
*
- * @param {object} options
+ * @param {object} [options]
* @param {number} [options.recvWindow]
*
*/
@@ -219,7 +218,7 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-flexible-subscription-record-user_data}
*
- * @param {object} options
+ * @param {object} [options]
* @param {string} [options.productId]
* @param {string} [options.purchaseId]
* @param {string} [options.asset]
@@ -245,7 +244,7 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-locked-subscription-record-user_data}
*
- * @param {object} options
+ * @param {object} [options]
* @param {string} [options.purchaseId]
* @param {string} [options.asset]
* @param {number} [options.startTime]
@@ -270,7 +269,7 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-flexible-redemption-record-user_data}
*
- * @param {object} options
+ * @param {object} [options]
* @param {string} [options.productId]
* @param {string} [options.redeemId]
* @param {string} [options.asset]
@@ -296,7 +295,8 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-locked-redemption-record-user_data}
*
- * @param {object} options
+ * @param {object} [options]
+ * @param {string} [options.positionId]
* @param {string} [options.redeemId]
* @param {string} [options.asset]
* @param {number} [options.startTime]
@@ -321,8 +321,8 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-flexible-rewards-history-user_data}
*
- * @param {object} options
* @param {string} type
+ * @param {object} [options]
* @param {string} [options.productId]
* @param {string} [options.asset]
* @param {number} [options.startTime]
@@ -348,7 +348,7 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-locked-rewards-history-user_data}
*
- * @param {object} options
+ * @param {object} [options]
* @param {string} [options.positionId]
* @param {string} [options.asset]
* @param {number} [options.startTime]
@@ -395,18 +395,18 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#set-locked-auto-subscribe-user_data}
*
- * @param {string} productId
+ * @param {string} positionId
* @param {boolean} autoSubscribe
* @param {object} [options]
* @param {number} [options.recvWindow]
*
*/
- setLockedAutoSubscribe (productId, autoSubscribe, options = {}) {
- validateRequiredParameters({ productId, autoSubscribe })
+ setLockedAutoSubscribe (positionId, autoSubscribe, options = {}) {
+ validateRequiredParameters({ positionId, autoSubscribe })
return this.signRequest(
'POST',
'/sapi/v1/simple-earn/locked/setAutoSubscribe',
- Object.assign(options, { productId, autoSubscribe })
+ Object.assign(options, { positionId, autoSubscribe })
)
}
@@ -418,6 +418,7 @@ const SimpleEarn = superclass => class extends superclass {
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-flexible-personal-left-quota-user_data}
*
* @param {string} productId
+ * @param {object} [options]
* @param {number} [options.recvWindow]
*
*/
@@ -437,16 +438,17 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-locked-personal-left-quota-user_data}
*
- * @param {string} productId
+ * @param {string} projectId
+ * @param {object} [options]
* @param {number} [options.recvWindow]
*
*/
- getLockedPersonalLeftQuota (productId, options = {}) {
- validateRequiredParameters({ productId })
+ getLockedPersonalLeftQuota (projectId, options = {}) {
+ validateRequiredParameters({ projectId })
return this.signRequest(
'GET',
'/sapi/v1/simple-earn/locked/personalLeftQuota',
- Object.assign(options, { productId })
+ Object.assign(options, { projectId })
)
}
@@ -479,18 +481,19 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-locked-subscription-preview-user_data}
*
- * @param {string} productId
+ * @param {string} projectId
* @param {number} amount
* @param {object} [options]
+ * @param {boolean} [options.autoSubscribe]
* @param {number} [options.recvWindow]
*
*/
- getLockedSubscriptionPreview (productId, amount, options = {}) {
- validateRequiredParameters({ productId, amount })
+ getLockedSubscriptionPreview (projectId, amount, options = {}) {
+ validateRequiredParameters({ projectId, amount })
return this.signRequest(
'GET',
'/sapi/v1/simple-earn/locked/subscriptionPreview',
- Object.assign(options, { productId, amount })
+ Object.assign(options, { projectId, amount })
)
}
@@ -502,6 +505,7 @@ const SimpleEarn = superclass => class extends superclass {
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-rate-history-user_data}
*
* @param {string} productId
+ * @param {object} [options]
* @param {number} [options.startTime]
* @param {number} [options.endTime]
* @param {number} [options.current]
@@ -525,7 +529,8 @@ const SimpleEarn = superclass => class extends superclass {
*
* {@link https://binance-docs.github.io/apidocs/spot/en/#get-collateral-record-user_data}
*
- * @param {string} productId
+ * @param {object} [options]
+ * @param {string} [options.productId]
* @param {number} [options.startTime]
* @param {number} [options.endTime]
* @param {number} [options.current]
@@ -533,13 +538,13 @@ const SimpleEarn = superclass => class extends superclass {
* @param {number} [options.recvWindow]
*
*/
- getCollateralRecord (productId, options = {}) {
- validateRequiredParameters({ productId })
+ getCollateralRecord (options = {}) {
return this.signRequest(
'GET',
'/sapi/v1/simple-earn/flexible/history/collateralRecord',
- Object.assign(options, { productId })
+ options
)
}
}
+
module.exports = SimpleEarn