diff --git a/index.js b/index.js index f4fe45d..4ddb126 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,12 @@ function checkParams(input, period, interval, pointscount) { * @return {Promise} An array of arrays with date (timestamp) and values (number) properties */ async function callInvesting(pairId, period, interval, pointscount) { - const url = `https://api.investing.com/api/financialdata/${pairId}/historical/chart?period=${period}&interval=${interval}&pointscount=${pointscount}`; + const query = new URLSearchParams({ + period, + interval, + pointscount, + }); + const url = `https://api.investing.com/api/financialdata/${pairId}/historical/chart?${query}`; const response = await fetch(url, { headers: new Headers({