Autoformatter applied on all js files

This commit is contained in:
Luis Fernando Molina committed 2019-02-23 10:32:06 +01:00
1 parent 72c1017b20
commit c627aedcf6
59 files changed
+9087 -10892

No files matched your search

+117 -128
View File
@@ -1,166 +1,155 @@
function newExchangeAPI() {
function newExchangeAPI () {
const INFO_LOG = true
const LOG_FILE_CONTENT = true
const INFO_LOG = true;
const LOG_FILE_CONTENT = true;
const MODULE_NAME = 'CloudVM -> Exchange API'
const MODULE_NAME = "CloudVM -> Exchange API";
const SERVER_URL = window.canvasApp.urlPrefix + 'ExchangeAPI/'
const SERVER_URL = window.canvasApp.urlPrefix + "ExchangeAPI/";
let thisObject = {
initialize: initialize,
getTicker: getTicker,
getOpenPositions: getOpenPositions,
getExecutedTrades: getExecutedTrades,
putPosition: putPosition,
movePosition: movePosition,
getPublicTradeHistory: getPublicTradeHistory
};
let thisObject = {
initialize: initialize,
getTicker: getTicker,
getOpenPositions: getOpenPositions,
getExecutedTrades: getExecutedTrades,
putPosition: putPosition,
movePosition: movePosition,
getPublicTradeHistory: getPublicTradeHistory
}
return thisObject;
function initialize(callBackFunction) {
return thisObject
function initialize (callBackFunction) {
/* When this initialized is called from the Browser, there is no need to send it to the server since the server will
anyways initialize this library at each method call. */
callBackFunction(window.DEFAULT_OK_RESPONSE);
}
callBackFunction(window.DEFAULT_OK_RESPONSE)
}
function getTicker(pMarket, callBackFunction) {
function getTicker (pMarket, callBackFunction) {
let authToken = window.localStorage.getItem('access_token')
let authToken = window.localStorage.getItem('access_token');
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + "/"
+ "getTicker" + "/"
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + '/'
+ 'getTicker' + '/'
+ authToken
;
callServer(undefined, path + "/NO-LOG", onServerResponse);
callServer(undefined, path + '/NO-LOG', onServerResponse)
function onServerResponse(pServerResponse) {
let response = JSON.parse(pServerResponse);
if (response.result === window.DEFAULT_FAIL_RESPONSE.result)
callBackFunction(window.DEFAULT_FAIL_RESPONSE);
else
callBackFunction(window.DEFAULT_OK_RESPONSE, response);
}
}
function onServerResponse (pServerResponse) {
let response = JSON.parse(pServerResponse)
if (response.result === window.DEFAULT_FAIL_RESPONSE.result) {
callBackFunction(window.DEFAULT_FAIL_RESPONSE)
} else {
callBackFunction(window.DEFAULT_OK_RESPONSE, response)
}
}
}
function getOpenPositions(pMarket, callBackFunction) {
function getOpenPositions (pMarket, callBackFunction) {
let authToken = window.localStorage.getItem('access_token')
let authToken = window.localStorage.getItem('access_token');
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + "/"
+ "getOpenPositions" + "/"
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + '/'
+ 'getOpenPositions' + '/'
+ authToken
;
callServer(undefined, path + "/NO-LOG", onServerResponse);
callServer(undefined, path + '/NO-LOG', onServerResponse)
function onServerResponse(pServerResponse) {
let response = JSON.parse(pServerResponse);
if (response.result === window.DEFAULT_FAIL_RESPONSE.result)
callBackFunction(window.DEFAULT_FAIL_RESPONSE);
else
callBackFunction(window.DEFAULT_OK_RESPONSE, response);
}
}
function onServerResponse (pServerResponse) {
let response = JSON.parse(pServerResponse)
if (response.result === window.DEFAULT_FAIL_RESPONSE.result) {
callBackFunction(window.DEFAULT_FAIL_RESPONSE)
} else {
callBackFunction(window.DEFAULT_OK_RESPONSE, response)
}
}
}
function getExecutedTrades(pPositionId, callBackFunction) {
function getExecutedTrades (pPositionId, callBackFunction) {
let authToken = window.localStorage.getItem('access_token')
let authToken = window.localStorage.getItem('access_token');
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + "/"
+ "getExecutedTrades" + "/"
+ authToken + "/"
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + '/'
+ 'getExecutedTrades' + '/'
+ authToken + '/'
+ pPositionId
;
callServer(undefined, path + "/NO-LOG", onServerResponse);
callServer(undefined, path + '/NO-LOG', onServerResponse)
function onServerResponse(pServerResponse) {
let response = JSON.parse(pServerResponse);
if (response.result === window.DEFAULT_FAIL_RESPONSE.result)
callBackFunction(window.DEFAULT_FAIL_RESPONSE);
else
callBackFunction(window.DEFAULT_OK_RESPONSE, response);
}
}
function putPosition(pMarket, pType, pRate, pAmountA, pAmountB, callBackFunction) {
function onServerResponse (pServerResponse) {
let response = JSON.parse(pServerResponse)
if (response.result === window.DEFAULT_FAIL_RESPONSE.result) {
callBackFunction(window.DEFAULT_FAIL_RESPONSE)
} else {
callBackFunction(window.DEFAULT_OK_RESPONSE, response)
}
}
}
let authToken = window.localStorage.getItem('access_token');
function putPosition (pMarket, pType, pRate, pAmountA, pAmountB, callBackFunction) {
let authToken = window.localStorage.getItem('access_token')
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + "/"
+ "putPosition" + "/"
+ authToken + "/"
+ pType + "/"
+ pRate + "/"
+ pAmountA + "/"
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + '/'
+ 'putPosition' + '/'
+ authToken + '/'
+ pType + '/'
+ pRate + '/'
+ pAmountA + '/'
+ pAmountB
;
callServer(undefined, path + "/NO-LOG", onServerResponse);
callServer(undefined, path + '/NO-LOG', onServerResponse)
function onServerResponse(pServerResponse) {
let response = JSON.parse(pServerResponse);
if (response.result === window.DEFAULT_FAIL_RESPONSE.result)
callBackFunction(window.DEFAULT_FAIL_RESPONSE);
else
callBackFunction(window.DEFAULT_OK_RESPONSE, response);
}
}
function onServerResponse (pServerResponse) {
let response = JSON.parse(pServerResponse)
if (response.result === window.DEFAULT_FAIL_RESPONSE.result) {
callBackFunction(window.DEFAULT_FAIL_RESPONSE)
} else {
callBackFunction(window.DEFAULT_OK_RESPONSE, response)
}
}
}
function movePosition(pPositionId, pNewRate, pPositionAmountB, callBackFunction) {
function movePosition (pPositionId, pNewRate, pPositionAmountB, callBackFunction) {
let authToken = window.localStorage.getItem('access_token')
let authToken = window.localStorage.getItem('access_token');
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + "/"
+ "movePosition" + "/"
+ authToken + "/"
+ pPositionId + "/"
+ pNewRate + "/"
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + '/'
+ 'movePosition' + '/'
+ authToken + '/'
+ pPositionId + '/'
+ pNewRate + '/'
+ pPositionAmountB
;
callServer(undefined, path + "/NO-LOG", onServerResponse);
callServer(undefined, path + '/NO-LOG', onServerResponse)
function onServerResponse(pServerResponse) {
let response = JSON.parse(pServerResponse);
if (response.result === window.DEFAULT_FAIL_RESPONSE.result)
callBackFunction(window.DEFAULT_FAIL_RESPONSE);
else
callBackFunction(window.DEFAULT_OK_RESPONSE, response);
}
}
function onServerResponse (pServerResponse) {
let response = JSON.parse(pServerResponse)
if (response.result === window.DEFAULT_FAIL_RESPONSE.result) {
callBackFunction(window.DEFAULT_FAIL_RESPONSE)
} else {
callBackFunction(window.DEFAULT_OK_RESPONSE, response)
}
}
}
function getPublicTradeHistory(pMarket, startTime, endTime, callBackFunction) {
function getPublicTradeHistory (pMarket, startTime, endTime, callBackFunction) {
let authToken = window.localStorage.getItem('access_token')
let authToken = window.localStorage.getItem('access_token');
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + "/"
+ "getPublicTradeHistory" + "/"
+ authToken + "/"
+ startTime + "/"
let path = SERVER_URL
+ CURRENT_BOT_CODE_NAME + '/'
+ 'getPublicTradeHistory' + '/'
+ authToken + '/'
+ startTime + '/'
+ endTime
;
callServer(undefined, path + "/NO-LOG", onServerResponse);
callServer(undefined, path + '/NO-LOG', onServerResponse)
function onServerResponse(pServerResponse) {
let response = JSON.parse(pServerResponse);
if (response.result === window.DEFAULT_FAIL_RESPONSE.result)
callBackFunction(window.DEFAULT_FAIL_RESPONSE);
else
callBackFunction(window.DEFAULT_OK_RESPONSE, response);
}
}
}
function onServerResponse (pServerResponse) {
let response = JSON.parse(pServerResponse)
if (response.result === window.DEFAULT_FAIL_RESPONSE.result) {
callBackFunction(window.DEFAULT_FAIL_RESPONSE)
} else { callBackFunction(window.DEFAULT_OK_RESPONSE, response) }
}
}
}