Skip to content

Commit

Permalink
Merge pull request #107 from ZIMkaRU/feature/add-weighted-averages
Browse files Browse the repository at this point in the history
Add weighted averages
  • Loading branch information
prdn authored Jul 3, 2023
2 parents ddd5062 + d6abc72 commit 9ac0807
Show file tree
Hide file tree
Showing 10 changed files with 669 additions and 673 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 5.3.0
- RESTv2: add getWeightedAverages method

# 5.2.0
- RESTv2: add payCurrencyConversionList method
- RESTv2: add payAddCurrencyConversion method
Expand Down
4 changes: 2 additions & 2 deletions docs/RESTv1.html

Large diffs are not rendered by default.

1,245 changes: 607 additions & 638 deletions docs/RESTv2.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/global.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/rest1.js.html

Large diffs are not rendered by default.

44 changes: 24 additions & 20 deletions docs/rest2.js.html

Large diffs are not rendered by default.

21 changes: 20 additions & 1 deletion lib/rest2.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ const {
TransactionFee,
AccountSummary,
AuthPermission,
CoreSettings
CoreSettings,
WeightedAverages
} = require('bfx-api-node-models')

const BASE_TIMEOUT = 15000
Expand Down Expand Up @@ -734,6 +735,24 @@ class RESTv2 {
}, cb, Trade)
}

/**
* @param {object} [params] - parameters
* @param {string} [params.symbol] - query symbol
* @param {number} [params.start] - query start
* @param {number} [params.end] - query end
* @param {number} [params.limit] - query limit
* @param {Function} [cb] - legacy callback
* @returns {Promise} p
*/
getWeightedAverages (params = {}, cb = null) {
const { symbol, start, end, limit } = params
const url = '/auth/r/trades/calc'

return this._makeAuthRequest(url, {
symbol, start, end, limit
}, cb, WeightedAverages)
}

/**
* @param {object} [params] - parameters
* @param {number} [params.start] - query start
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bfx-api-node-rest",
"version": "5.2.0",
"version": "5.3.0",
"description": "Official Bitfinex REST v1 & v2 API interfaces",
"engines": {
"node": ">=8.3.0"
Expand Down Expand Up @@ -45,7 +45,7 @@
"url": "https://github.com/bitfinexcom/bfx-api-node-rest/issues"
},
"devDependencies": {
"bfx-api-mock-srv": "^1.5.0",
"bfx-api-mock-srv": "^1.6.0",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"docdash": "^1.2.0",
Expand All @@ -59,7 +59,7 @@
"standard": "^17.0.0"
},
"dependencies": {
"bfx-api-node-models": "^1.7.1",
"bfx-api-node-models": "^1.8.0",
"bfx-api-node-util": "^1.0.10",
"debug": "4.1.1",
"dirty-chai": "^2.0.1",
Expand Down
1 change: 1 addition & 0 deletions test/lib/rest-2-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ describe('RESTv2 integration (mock server) tests', () => {
['payCurrencyList','pay_currency_list', [{}]],
['payInvoiceUpdate','pay_invoice_update', [{}]],
['payInvoiceCreatePos','pay_invoice_create_pos', [{}]],
['getWeightedAverages', 'weighted_averages.sym.start.end.limit', [{ symbol: 'sym', start: 'start', end: 'end', limit: 'limit' }]]
]

methods.forEach((m) => {
Expand Down

0 comments on commit 9ac0807

Please sign in to comment.