It looks like in the latest version URL encoding happens twice.
Why don't you try the following
function poloniex(command,options) {
// I assume that all the keys are in the "keys" spreadsheet. The key is in cell A1 and the secret in cell A2
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("keys");
var key = sheet.getRange("A1").getValue();
var secret = sheet.getRange("A2").getValue();
var nonce = 1495932972127042 + new Date().getTime();
var payload = options || {};
payload.nonce = nonce;
payload.command = command;
var uri = "https://poloniex.com/tradingApi";
var signature = Utilities.computeHmacSignature(Utilities.MacAlgorithm.HMAC_SHA_512, payloadEncoded, secret);
var stringSignature = "";
for (i = 0; i < signature.length; i++) {
var byte = signature;
if (byte < 0)
byte += 256;
var byteStr = byte.toString(16);
if (byteStr.length == 1) byteStr = '0'+byteStr;
stringSignature += byteStr;
}
var headers = {
"key": key,
"sign": stringSignature
}
var params = {
"method": "post",
"headers": headers,
"payload": payload
}
// To see the request that is send to Poloniex uncomment following lines.
// var req = getRequest(url, params)
// for(i in req) {
// Logger.log(i + ": " + req[i]);
// }
var response = UrlFetchApp.fetch(uri, params);
var dataAll = JSON.parse(response.getContentText());
process.stdout.write(params)
return JSON.stringify(dataAll)
}
poloniex("buy", {
currencyPair: "USDT_ZEC",
amount: 100,
rate: 0.01
});