Skip to content

Commit

Permalink
Release v0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
alplabin committed Jun 28, 2024
1 parent 14fe72a commit b5c8cca
Show file tree
Hide file tree
Showing 17 changed files with 527 additions and 364 deletions.
19 changes: 15 additions & 4 deletions CHANGELOG.md
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.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ The WebSocket URLs for the available futures environments are as follows:

- Testnet: wss://stream.binancefuture.com
- Main CM: wss://dstream.binancefuture.com
- Main UM: wss://fstream.binance.com
- Main UM: wss://fstream.binancefuture.com

### Websocket Streams

Expand All @@ -255,7 +255,7 @@ const callbacks = {
const umWebsocketStreamClient = new UMStream({
logger,
callbacks,
wsURL: "wss://fstream.binance.com",
wsURL: "wss://fstream.binancefuture.com",
});

// Subscribe to the allMarketMiniTickersStream stream
Expand Down
26 changes: 26 additions & 0 deletions __tests__/um/account/feeBurn.test.js
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)
}
)
})
})
15 changes: 15 additions & 0 deletions __tests__/um/account/getFeeBurn.test.js
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)
})
})
})
15 changes: 15 additions & 0 deletions __tests__/um/account/getUserRateLimit.test.js
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)
})
})
})
28 changes: 28 additions & 0 deletions __tests__/um/market/deliveryPrice.test.js
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)
}
)
})
})
16 changes: 16 additions & 0 deletions __tests__/um/market/getPriceTickerV2.test.js
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)
})
})
})
12 changes: 12 additions & 0 deletions examples/um_futures/account/feeBurn.js
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)
12 changes: 12 additions & 0 deletions examples/um_futures/account/getFeeBurn.js
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)
12 changes: 12 additions & 0 deletions examples/um_futures/account/getUserRateLimit.js
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)
10 changes: 10 additions & 0 deletions examples/um_futures/market/deliveryPrice.js
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)
10 changes: 10 additions & 0 deletions examples/um_futures/market/getPriceTickerV2.js
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)
Loading

0 comments on commit b5c8cca

Please sign in to comment.