-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
527 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
# Change log | ||
|
||
## v0.1.2 - 2024-04-08 | ||
## v0.1.3 - 2024-06-28 | ||
### Added | ||
#### UM Futures | ||
- `GET /fapi/v1/rateLimit/order` | ||
- `POST /fapi/v1/feeBurn` | ||
- `GET /fapi/v1/feeBurn` | ||
- `GET /fapi/v2/ticker/price` | ||
- `GET /futures/data/delivery-price` | ||
|
||
### Changed | ||
- Updated dependencies. | ||
|
||
## v0.1.2 - 2024-04-08 | ||
### Changed | ||
- Update dependencies. | ||
- Resolve issue #3 | ||
- Updated dependencies. | ||
- Resolved issue #3 | ||
|
||
## v0.1.1 - 2023-10-20 | ||
- Update dependencies. | ||
- Updated dependencies. | ||
|
||
## v0.1.0 - 2023-10-13 | ||
- First release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const MissingParameterError = require('../../../src/error/missingParameterError') | ||
const { nockPostMock, UMFuturesClient } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#feeBurn', () => { | ||
const feeBurn = 'true' | ||
|
||
it('throw MissingParameterError when missing feeBurn', () => { | ||
expect(() => { | ||
UMFuturesClient.feeBurn() | ||
}).toThrow(MissingParameterError) | ||
}) | ||
|
||
it('should change user\'s BNB fee discount on every symbol', () => { | ||
nockPostMock(UMFuturesClient.baseURL)( | ||
`/fapi/v1/feeBurn?feeBurn=${feeBurn}` | ||
)(mockResponse) | ||
|
||
return UMFuturesClient.feeBurn(feeBurn).then( | ||
(response) => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
} | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { nockMock, UMFuturesClient } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getFeeBurn', () => { | ||
it('should return BNB burn status', () => { | ||
nockMock(UMFuturesClient.baseURL)(`/fapi/v1/feeBurn`)( | ||
mockResponse | ||
) | ||
|
||
return UMFuturesClient.getFeeBurn().then((response) => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { nockMock, UMFuturesClient } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getUserRateLimit', () => { | ||
it('should return user rate limit', () => { | ||
nockMock(UMFuturesClient.baseURL)(`/fapi/v1/rateLimit/order`)( | ||
mockResponse | ||
) | ||
|
||
return UMFuturesClient.getUserRateLimit().then((response) => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* global describe, it, expect */ | ||
const MissingParameterError = require('../../../src/error/missingParameterError') | ||
const { nockMock, UMFuturesClient } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#deliveryPrice', () => { | ||
describe('throw MissingParameterError', () => { | ||
it('missing pair', () => { | ||
expect(() => { | ||
UMFuturesClient.deliveryPrice() | ||
}).toThrow(MissingParameterError) | ||
}) | ||
}) | ||
|
||
it('should return quarterly contract settlement price', () => { | ||
const pair = 'BTCUSDT' | ||
nockMock(UMFuturesClient.baseURL)( | ||
`/futures/data/delivery-price?pair=${pair}` | ||
)(mockResponse) | ||
|
||
return UMFuturesClient.deliveryPrice(pair).then( | ||
(response) => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
} | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { nockMock, UMFuturesClient } = require('../../testUtils/testSetup') | ||
const { mockResponse } = require('../../testUtils/mockData') | ||
|
||
describe('#getPriceTickerV2', () => { | ||
it('should return price ticker data', () => { | ||
const symbol = 'BTCUSDT' | ||
nockMock(UMFuturesClient.baseURL)(`/fapi/v2/ticker/price?symbol=${symbol}`)( | ||
mockResponse | ||
) | ||
|
||
return UMFuturesClient.getPriceTickerV2(symbol).then((response) => { | ||
expect(response).toBeDefined() | ||
expect(response.data).toEqual(mockResponse) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { UMFutures } = require('../../../src') | ||
|
||
const apiKey = '' | ||
const apiSecret = '' | ||
const umFuturesClient = new UMFutures(apiKey, apiSecret, { | ||
baseURL: 'https://fapi.binance.com' | ||
}) | ||
|
||
umFuturesClient | ||
.feeBurn('true') | ||
.then((response) => console.log(response)) | ||
.catch(console.error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { UMFutures } = require('../../../src') | ||
|
||
const apiKey = '' | ||
const apiSecret = '' | ||
const umFuturesClient = new UMFutures(apiKey, apiSecret, { | ||
baseURL: 'https://fapi.binance.com' | ||
}) | ||
|
||
umFuturesClient | ||
.getFeeBurn() | ||
.then((response) => console.log(response)) | ||
.catch(console.error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { UMFutures } = require('../../../src') | ||
|
||
const apiKey = '' | ||
const apiSecret = '' | ||
const umFuturesClient = new UMFutures(apiKey, apiSecret, { | ||
baseURL: 'https://fapi.binance.com' | ||
}) | ||
|
||
umFuturesClient | ||
.getUserRateLimit() | ||
.then((response) => console.log(response)) | ||
.catch(console.error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const { UMFutures } = require('../../../src') | ||
|
||
const umFuturesClient = new UMFutures('', '', { | ||
baseURL: 'https://fapi.binance.com' | ||
}) | ||
|
||
umFuturesClient | ||
.deliveryPrice('BTCUSDT') | ||
.then((response) => console.log(response)) | ||
.catch(console.error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const { UMFutures } = require('../../../src') | ||
|
||
const umFuturesClient = new UMFutures('', '', { | ||
baseURL: 'https://fapi.binance.com' | ||
}) | ||
|
||
umFuturesClient | ||
.getPriceTickerV2('BTCUSDT') | ||
.then((response) => console.log(response)) | ||
.catch(console.error) |
Oops, something went wrong.