diff --git a/CompetitionStorage.js b/CompetitionStorage.js index 644554e0b..4abace3fc 100644 --- a/CompetitionStorage.js +++ b/CompetitionStorage.js @@ -1,4 +1,4 @@ - + function newCompetitionStorage(pName) { const MODULE_NAME = "Competition Storage"; @@ -40,7 +40,8 @@ function newCompetitionStorage(pName) { for (let j = 0; j < pCompetition.participants.length; j++) { let devTeam = ecosystem.getTeam(pCompetition.participants[j].devTeam); - let bot = ecosystem.getBot(devTeam, pCompetition.participants[j].bot) + let bot = ecosystem.getBot(devTeam, pCompetition.participants[j].bot); + let pOperationsId = pCompetition.participants[j].pOperationsId; let product = ecosystem.getProduct(bot, "Competition Trading History"); if (INFO_LOG === true) { logger.write("[INFO] initialize -> key = " + devTeam.codeName + "-" + bot.codeName + "-" + product.codeName); } @@ -55,7 +56,7 @@ function newCompetitionStorage(pName) { if (INFO_LOG === true) { logger.write("[INFO] initialize -> File Sequence -> key = " + pHost.codeName + "-" + pCompetition.codeName + "-" + devTeam.codeName + "-" + bot.codeName + "-" + product.codeName); } let fileSequence = newFileSequence(); - fileSequence.initialize(devTeam, bot, product, thisSet, pExchange, pMarket, onFileSequenceReady); + fileSequence.initialize(devTeam, bot, product, thisSet, pExchange, pMarket, onFileSequenceReady, pOperationsId); fileSequences.push(fileSequence); dataSetsToLoad++; } diff --git a/Files/FileCloud.js b/Files/FileCloud.js index 4173eb528..b277f9ab8 100644 --- a/Files/FileCloud.js +++ b/Files/FileCloud.js @@ -9,7 +9,7 @@ function newFileCloud() { /* - This is the module in the system that actually connects to the cloud storage and grabs from there the needed files. + This is the module in the system that actually connects to the cloud storage and grabs from there the needed files. */ @@ -38,7 +38,7 @@ function newFileCloud() { } } - function getFile(pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction) { + function getFile(pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction, pOperationsId) { try { @@ -46,9 +46,14 @@ function newFileCloud() { const MAX_RETRIES = 3; - getFileRecursively(0, pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction) - function getFileRecursively(pRetryCounter, pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction) { + if (pOperationsId !== undefined ) { + getFileRecursively(0, pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction, pOperationsId) + } else { + getFileRecursively(0, pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction) + } + + function getFileRecursively(pRetryCounter, pDevTeam, pBot, pSet, pExchange, pMarket, pPeriodName, pDatetime, pSequence, pDataRange, callBackFunction, pOperationsId) { try { @@ -111,7 +116,11 @@ function newFileCloud() { if (pBot !== undefined) { - filePath = filePath.replace("@Bot", pBot.codeName); + if (pOperationsId !== undefined ) { + filePath = filePath.replace("@Bot", pBot.codeName + "-" + pOperationsId); + } else { + filePath = filePath.replace("@Bot", pBot.codeName); + } } if (pExchange !== undefined) { @@ -249,4 +258,4 @@ function newFileCloud() { callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE); } } -} \ No newline at end of file +} diff --git a/Files/FileSequence.js b/Files/FileSequence.js index 5028143d4..3cbc2b908 100644 --- a/Files/FileSequence.js +++ b/Files/FileSequence.js @@ -55,7 +55,7 @@ function newFileSequence() { } } - function initialize(pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, callBackFunction) { + function initialize(pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, callBackFunction, pOperationsId) { try { @@ -70,7 +70,7 @@ function newFileSequence() { } - intervalHandle = setInterval(updateFiles, _1_MINUTE_IN_MILISECONDS); + intervalHandle = setInterval(updateFiles, _1_MINUTE_IN_MILISECONDS); if (INFO_LOG === true) { logger.write("[INFO] initialize -> intervalHandle = " + intervalHandle); } @@ -85,7 +85,7 @@ function newFileSequence() { /* First we will get the sequence max number */ - fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, "Sequence", undefined, onSequenceFileReceived); + fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, "Sequence", undefined, onSequenceFileReceived, pOperationsId); function onSequenceFileReceived(err, file) { @@ -142,7 +142,7 @@ function newFileSequence() { for (let i = 0; i <= maxSequence; i++) { - fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, i, undefined, onFileReceived); + fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, i, undefined, onFileReceived, pOperationsId); function onFileReceived(err, file) { @@ -234,7 +234,7 @@ function newFileSequence() { if (INFO_LOG === true) { logger.write("[INFO] updateFiles -> bot = " + bot.codeName); } if (INFO_LOG === true) { logger.write("[INFO] updateFiles -> thisSet = " + thisSet.codeName); } - fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, "Sequence", undefined, onSequenceFileReceived); + fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, "Sequence", undefined, onSequenceFileReceived, pOperationsId); function onSequenceFileReceived(err, file) { @@ -287,7 +287,7 @@ function newFileSequence() { if (INFO_LOG === true) { logger.write("[INFO] updateFiles -> onSequenceFileReceived -> i = " + i); } - fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, i, undefined, onFileReceived); + fileCloud.getFile(devTeam, bot, thisSet, exchange, market, undefined, undefined, i, undefined, onFileReceived, pOperationsId); function onFileReceived(err, file) { @@ -382,4 +382,4 @@ function newFileSequence() { } -} \ No newline at end of file +} diff --git a/TopSpace/CurrentEvent.js b/TopSpace/CurrentEvent.js index f5ea0be57..3a7718d99 100644 --- a/TopSpace/CurrentEvent.js +++ b/TopSpace/CurrentEvent.js @@ -15,8 +15,8 @@ "codeName": "Weekend-Deathmatch", "description": "First AA Internal Competition. Bots will be trading during 3 days at the USDT/BTC market of Poloniex to see who can make the gratest return over investment (ROI).", "displayName": "AA Internal Challenge", - "startDatetime": "2018-11-05T16:00:00.000Z", - "finishDatetime": "2018-11-07T16:59:59.999Z", + "startDatetime": "2019-03-05T16:00:00.000Z", + "finishDatetime": "2019-02-07T16:59:59.999Z", "formula": "ROI", "plotter": { "codeName": "PlottersROI", @@ -24,7 +24,8 @@ "repo": "Plotters-ROI", "moduleName": "CombinedProfits" }, - "participants": [], + "participants": [ + ], "repo": "Weekend-Deathmatch", "configFile": "this.competition.config.json" }], @@ -47,6 +48,7 @@ function buildEcosystemEventsHack() { if (localStorage.getItem("ecosystemEventsHack") === null) { window.localStorage.setItem('ecosystemEventsHack', JSON.stringify(ecosystemBase)); + ecosystem.setEvent(ecosystemBase); dashboard.start(); } else { let hackedEcosystem = ecosystemBase; @@ -58,14 +60,16 @@ hackedEcosystem[0].competitions[0].finishDatetime = new Date(parsedEcosysTemp.endDatetime*1000).toISOString(); parsedEcosysTemp.participants.forEach(function(participant) { hackedEcosystem[0].competitions[0].participants.push({ - devTeam: participant.clone.team.name.replace(/\s+/g, '-').toLowerCase(), - bot: participant.clone.bot.name.replace(/\s+/g, '-').toLowerCase()+"-"+participant.clone.id, + devTeam: participant.clone.team.slug, + bot: participant.clone.bot.slug, + pOperationsId: participant.clone.id, release: "1.0.0" }); }); } window.localStorage.setItem('ecosystemEventsHack', JSON.stringify(hackedEcosystem)); + ecosystem.setEvent(hackedEcosystem); } } diff --git a/TopSpace/Login.js b/TopSpace/Login.js index ade493ff8..998b0ee7a 100644 --- a/TopSpace/Login.js +++ b/TopSpace/Login.js @@ -195,10 +195,10 @@ function newLogin() { clone{ id team{ - name + slug } bot{ - name + slug } } }