Skip to content

Commit

Permalink
#noticket exchange-rates missing method impl
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasov-menasoft committed Feb 18, 2020
1 parent 2a6fe22 commit c493f9e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cryptoapis.io",
"version": "4.2.2",
"version": "4.2.3",
"description": "Crypto APIs SDK",
"main": "src/index.js",
"scripts": {
Expand Down
44 changes: 40 additions & 4 deletions src/rest-apis/crypto-market-data/exchange-rates.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ExchangeRates extends BaseAuth {
* Get All Current Rates
*
* @async
* @desc
* @desc Get the current exchange rate between requested asset and all other assets.
*
* @param {string} baseAssetId - Our identifier (UID) of the base asset. (_id attribute from assets endpoint).
* @param {object} [queryParams] - Additional query parameters.
Expand All @@ -45,12 +45,48 @@ class ExchangeRates extends BaseAuth {
return this.request.get('/exchange-rates/' + baseAssetId, combinedQueryParams);
}

getSpecificRateInSpecificExchange() {
/**
* Get Specific Rate in a specific Exchange
*
* @async
* @desc Get exchange rates between pair of requested assets pointing at a specific or current time in a specific Exchange.
*
* @param {string} exchangeId - Our exchange identifier.
* @param {string} baseAssetId - Our identifier (UID) of the base asset. (_id attribute from assets endpoint).
* @param {string} quoteAssetId - Our identifier (UID) of the quote asset. (_id attribute from assets endpoint).
* @param {object} [queryParams] - Additional query parameters.
*
* @returns {*}
*/
getSpecificRateInSpecificExchange(exchangeId, baseAssetId, quoteAssetId, queryParams = {}) {
const combinedQueryParams = {
timestamp: null, // Time (in UNIX Timestamp) of the market data used to calculate exchange rate. Optional. Default value is current time.
...queryParams,
};

return this.request.get('/exchange-rates/exchange/' + exchangeId + '/' + baseAssetId + '/' + quoteAssetId, combinedQueryParams);
}

getAllCurrentRatesInSpecificExchange() {

/**
* Get All Current Rates in a specific Exchange
*
* @async
* @desc Get the current exchange rate between requested asset and all other assets in a specific Exchange.
*
* @param {string} exchangeId - Our exchange identifier.
* @param {string} baseAssetId - Our identifier (UID) of the base asset. (_id attribute from assets endpoint).
* @param {object} [queryParams] - Additional query parameters.
*
* @returns {*}
*/
getAllCurrentRatesInSpecificExchange(exchangeId, baseAssetId, queryParams = {}) {
const combinedQueryParams = {
timestamp: null, // Time (in UNIX Timestamp) of the market data used to calculate exchange rate. Optional. Default value is current time.
skip: 0, // The offset of items to start from. Useful for paginations. (e.g. skip=100 would show results from 101 item to 150).
limit: 50, // Amount of items to return (optional, default value is 50).
...queryParams,
};
return this.request.get('/exchange-rates/exchange/' + exchangeId + '/' + baseAssetId, combinedQueryParams);
}

}
Expand Down

0 comments on commit c493f9e

Please sign in to comment.