Merge branch 'Superalgos:develop' into develop

This commit is contained in:
B Harrell authored and GitHub committed 2021-09-19 11:07:09 -05:00
commit a29ca106b1
61 files changed
+35281 -24403

No files matched your search

+1
View File
@@ -2,6 +2,7 @@ Data-Storage
Log-Files
My-Workspaces
My-Social-Trading-Data
My-Network-Nodes-Data
debug.log
.DS_Store
*.db
+41 -11
View File
@@ -121,17 +121,47 @@ function newWebApp() {
}
function addToContentDiv(events) {
try {
let contentDiv = document.getElementById('content-div')
let contentDiv = document.getElementById('content-div')
/*
Delete al current content.
*/
while (contentDiv.childNodes.length > 4) {
let childToRemove = contentDiv.childNodes[contentDiv.childNodes.length - 1]
contentDiv.removeChild(childToRemove)
}
/*
Render the timeline.
*/
for (let i = 0; i < events.length; i++) {
let event = events[i]
for (let i = 0; i < events.length; i++) {
let event = events[i]
let postDiv = document.createElement("div")
postDiv.setAttribute("class", "post-div")
let textNode
let postDiv = document.createElement("div")
postDiv.setAttribute("class", "post-div")
let textNode = document.createTextNode('POST #' + i)
postDiv.appendChild(textNode)
contentDiv.appendChild(postDiv)
switch (event.eventType) {
case SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST: {
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " POSTED " + event.postText)
break
}
case SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE: {
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " FOLLOWED " + event.targetUserProfile.userProfileHandle)
break
}
case SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE: {
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " UNFOLLOWED " + event.targetUserProfile.userProfileHandle)
break
}
}
postDiv.appendChild(textNode)
contentDiv.appendChild(postDiv)
}
}
catch (err) {
console.log('[ERROR] err.stack = ' + err.stack)
}
}
}
@@ -319,7 +349,7 @@ function newWebApp() {
eventType: eventType,
eventId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
targetUserProfileId: userProfileId,
timestamp: new Date()
timestamp: (new Date()).valueOf()
}
event = {
@@ -354,8 +384,8 @@ function newWebApp() {
eventMessage = {
eventType: SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST,
eventId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
text: postText,
timestamp: new Date()
postText: postText,
timestamp: (new Date()).valueOf()
}
event = {
+3 -3
View File
@@ -119,11 +119,11 @@
</tr>
</table>
</div>>
<div class="content-div">
<div class="post-placeholder">
<div id="content-div" class="content-div">
<div id="post-placeholder" class="post-placeholder">
Placeholder
</div>
<div class="new-post-div">
<div id="new-post-div" class="new-post-div">
<table>
<tr>
<td>Profile Pic</td>
+2 -1
View File
@@ -48,7 +48,8 @@ exports.newDesktopRoot = function newDesktopRoot() {
open: require('open'),
http: require('http'),
octokit: require("@octokit/rest"),
simpleGit: require('simple-git')
simpleGit: require('simple-git'),
nodeFetch: require('node-fetch')
}
/*
+7 -7
View File
@@ -1,24 +1,24 @@
exports.newNetworkNode = function newNetworkNode() {
let thisObject = {
socialGraphService: undefined,
storage: undefined,
run: run
}
return thisObject
function run() {
async function run() {
/*
Let's start the Network Interfaces
*/
NT.webSocketsInterface = NT.projects.network.modules.webSocketsInterface.newNetworkModulesWebSocketsInterface()
NT.webSocketsInterface.initialize()
start()
async function start() {
let socialGraphService = NT.projects.socialTrading.modules.socialGraph.newSocialGraph()
await socialGraphService.initialize()
}
thisObject.socialGraphService = NT.projects.socialTrading.modules.socialGraph.newNetworkModulesSocialGraph()
await thisObject.socialGraphService.initialize()
thisObject.storage = NT.projects.socialTrading.modules.storage.newSocialTradingModulesStorage()
thisObject.storage.initialize()
}
}
+4 -1
View File
@@ -41,9 +41,12 @@ exports.newNetworkRoot = function newNetworkRoot() {
*/
SA.nodeModules = {
fs: require('fs'),
path: require('path'),
util: require('util'),
nodeFetch: require('node-fetch'),
web3: require('web3'),
ws: require('ws')
ws: require('ws'),
simpleGit: require('simple-git')
}
/*
+18 -13
View File
@@ -43,7 +43,7 @@ exports.newHttpInterface = function newHttpInterface() {
case 'WEB3':
{
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
@@ -131,7 +131,7 @@ exports.newHttpInterface = function newHttpInterface() {
break
case 'CCXT':
{
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
@@ -242,7 +242,7 @@ exports.newHttpInterface = function newHttpInterface() {
break
}
case 'New-Message': {
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
function processRequest(messageReceived) {
let timestamp = (new Date()).valueOf()
@@ -291,7 +291,7 @@ exports.newHttpInterface = function newHttpInterface() {
{
switch (requestPath[2]) { // switch by command
case 'Save-Node-Schema': {
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
@@ -322,7 +322,7 @@ exports.newHttpInterface = function newHttpInterface() {
}
case 'Save-Concept-Schema': {
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
@@ -353,7 +353,7 @@ exports.newHttpInterface = function newHttpInterface() {
}
case 'Save-Topic-Schema': {
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
@@ -384,7 +384,7 @@ exports.newHttpInterface = function newHttpInterface() {
}
case 'Save-Tutorial-Schema': {
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
@@ -415,7 +415,7 @@ exports.newHttpInterface = function newHttpInterface() {
}
case 'Save-Review-Schema': {
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
@@ -446,7 +446,7 @@ exports.newHttpInterface = function newHttpInterface() {
}
case 'Save-Book-Schema': {
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
@@ -991,7 +991,7 @@ exports.newHttpInterface = function newHttpInterface() {
related to the Governance System are implemented here and routed
to the backend Servers that can process them.
*/
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
@@ -1412,7 +1412,7 @@ exports.newHttpInterface = function newHttpInterface() {
break
case 'SavePlugin':
{
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
try {
@@ -1546,7 +1546,7 @@ exports.newHttpInterface = function newHttpInterface() {
break
case 'SaveWorkspace':
{
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
async function processRequest(body) {
@@ -1702,7 +1702,12 @@ exports.newHttpInterface = function newHttpInterface() {
}
}
} catch (err) {
console.log(err.stack)
if (err.stack !== undefined) {
console.log(err.stack)
}
if (err.message !== undefined) {
console.log('[ERROR] onHttpRequest -> err.message = ' + err.message)
}
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+23175 -23467
View File
File diff suppressed because it is too large. Load diff
@@ -4,6 +4,7 @@ exports.newFoundationsUtilitiesFilesAndDirectories = function () {
getDirectories: getDirectories,
getAllFilesInDirectoryAndSubdirectories: getAllFilesInDirectoryAndSubdirectories,
pathFromDate: pathFromDate,
pathFromDatetime: pathFromDatetime,
mkDirByPathSync: mkDirByPathSync
}
@@ -55,15 +56,35 @@ exports.newFoundationsUtilitiesFilesAndDirectories = function () {
}
function pathFromDate(timestamp) {
let file = { date: new Date(timestamp) }
file.year = file.date.getUTCFullYear()
file.month = file.date.getUTCMonth() + 1
file.day = file.date.getUTCDate()
return file.year + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2)
}
function pathFromDatetime(timestamp) {
let file = { date: new Date(timestamp) }
file.year = file.date.getUTCFullYear()
file.month = file.date.getUTCMonth() + 1
file.day = file.date.getUTCDate()
file.hour = file.date.getUTCHours()
file.minute = file.date.getMinutes()
return file.year + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.hour, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.minute, 2)
}
/* Function to create folders of missing folders at any path. */
function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
const path = SA.nodeModules.path
@@ -6,7 +6,7 @@ exports.newFoundationsUtilitiesHttpRequests = function () {
return thisObject
function getRequestBody(httpRequest, callback) { // Gets the de body from a POST httpRequest to the web server
function getRequestBody(httpRequest, httpResponse, callback) { // Gets the de body from a POST httpRequest to the web server
try {
let body = ''
@@ -26,10 +26,12 @@ exports.newFoundationsUtilitiesHttpRequests = function () {
httpRequest.on('error', function (err) {
console.log('[ERROR] getBody -> err.stack = ' + err.stack)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
throw('Not possible to get HTTP Body.')
})
} catch (err) {
console.log('[ERROR] getBody -> err.stack = ' + err.stack)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
throw('Not possible to get HTTP Body.')
}
}
}
@@ -41,6 +41,12 @@
"dontShowAtFullscreen": true,
"actionFunction": "uiObject.configEditor.activate"
},
{
"action": "Add UI Object",
"label": "Add Social Bots",
"relatedUiObject": "Social Bots",
"actionFunction": "payload.executeAction"
},
{
"action": "Add Missing Children",
"label": "Add Missing Children",
@@ -41,6 +41,12 @@
"dontShowAtFullscreen": true,
"actionFunction": "uiObject.configEditor.activate"
},
{
"action": "Add UI Object",
"label": "Add Social Bots",
"relatedUiObject": "Social Bots",
"actionFunction": "payload.executeAction"
},
{
"action": "Add Missing Children",
"label": "Add Missing Children",
@@ -41,6 +41,12 @@
"dontShowAtFullscreen": true,
"actionFunction": "uiObject.configEditor.activate"
},
{
"action": "Add UI Object",
"label": "Add Social Bots",
"relatedUiObject": "Social Bots",
"actionFunction": "payload.executeAction"
},
{
"action": "Add Missing Children",
"label": "Add Missing Children",
@@ -41,6 +41,12 @@
"dontShowAtFullscreen": true,
"actionFunction": "uiObject.configEditor.activate"
},
{
"action": "Add UI Object",
"label": "Add Social Bots",
"relatedUiObject": "Social Bots",
"actionFunction": "payload.executeAction"
},
{
"action": "Add Missing Children",
"label": "Add Missing Children",
@@ -141,7 +141,7 @@
},
{
"style": "Javascript",
"text": "parameterValue = \nMath.trunc((new Date()).valueOf() / \nTS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * \nTS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS",
"text": "parameterValue = \nMath.trunc((new Date()).valueOf() / \nSA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * \nSA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS",
"updated": 1622477009814
},
{
@@ -151,7 +151,7 @@
},
{
"style": "Javascript",
"text": "parameterValue = Math.trunc((new Date()).valueOf() / \nTS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * \nTS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS + \nTS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1",
"text": "parameterValue = Math.trunc((new Date()).valueOf() / \nSA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * \nSA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS + \nSA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1",
"updated": 1622477088684
},
{
@@ -462,11 +462,11 @@ exports.newFoundationsBotModulesFetchingProcess = function (processIndex) {
break
}
case '@BeginCurrentMinute': {
parameterValue = Math.trunc((new Date()).valueOf() / TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS
parameterValue = Math.trunc((new Date()).valueOf() / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS
break
}
case '@EndCurrentMinute': {
parameterValue = Math.trunc((new Date()).valueOf() / TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1
parameterValue = Math.trunc((new Date()).valueOf() / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1
break
}
}
@@ -94,7 +94,7 @@
thisReport.beginingOfMarket.days + " " +
thisReport.beginingOfMarket.hours + ":" +
thisReport.beginingOfMarket.minutes +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
/* Second, we get the report from Exchange Raw Data, to know when the marted ends. */
statusReport = statusDependenciesModule.reportsByMainUtility.get('Market Ending Point')
@@ -158,15 +158,15 @@
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
contextVariables.lastBandFile = new Date(
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
contextVariables.lastBandFile = new Date(
contextVariables.lastBandFile.valueOf() +
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
buildBands();
return;
@@ -199,16 +199,16 @@
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
contextVariables.lastBandFile = new Date(
contextVariables.lastBandFile.valueOf() +
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
beginingOfMarket = new Date(
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> getContextVariables -> thisReport.lastFile === undefined")
@@ -237,7 +237,7 @@
try {
let n;
processDate = new Date(contextVariables.lastBandFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop.
processDate = new Date(contextVariables.lastBandFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well when we advance time at the begining of the loop.
let fromDate = new Date(processDate.valueOf())
let lastDate = TS.projects.foundations.utilities.dateTimeFunctions.removeTime(new Date())
@@ -249,8 +249,8 @@
function advanceTime() {
try {
processDate = new Date(processDate.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
previousDay = new Date(processDate.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
processDate = new Date(processDate.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
previousDay = new Date(processDate.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> buildBands -> advanceTime -> processDate = " + processDate)
@@ -784,7 +784,7 @@
try {
let dataRange = {
begin: pBegin.valueOf(),
end: pEnd.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
end: pEnd.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
}
let fileContent = JSON.stringify(dataRange);
@@ -89,7 +89,7 @@
thisReport.beginingOfMarket.days + " " +
thisReport.beginingOfMarket.hours + ":" +
thisReport.beginingOfMarket.minutes +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
/* Second, we get the report from Exchange Raw Data, to know when the marted ends. */
statusReport = statusDependenciesModule.reportsByMainUtility.get('Market Ending Point')
@@ -125,7 +125,7 @@
thisReport.lastFile.year + "-" +
thisReport.lastFile.month + "-" +
thisReport.lastFile.days + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
/* Finally we get our own Status Report. */
statusReport = statusDependenciesModule.reportsByMainUtility.get('Self Reference')
@@ -150,15 +150,15 @@
beginingOfMarket = new Date(thisReport.beginingOfMarket)
if (beginingOfMarket.valueOf() !== contextVariables.datetimeBeginingOfMarketFile.valueOf()) { // Reset Mechanism for Begining of the Market
beginingOfMarket = new Date(contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" + (contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" + contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" + TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
beginingOfMarket = new Date(contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" + (contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" + contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" + SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeLastProducedFile.valueOf() -
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
buildCandles()
return
@@ -171,7 +171,7 @@
For that reason we go back one day, the partial information is discarded
and added again with whatever new info is available.
*/
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
buildCandles()
return
@@ -180,13 +180,13 @@
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
buildCandles()
return
@@ -216,7 +216,7 @@
advanceTime()
function advanceTime() {
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> buildCandles -> advanceTime -> New processing time @ " + contextVariables.datetimeLastProducedFile.getUTCFullYear() + "/" + (contextVariables.datetimeLastProducedFile.getUTCMonth() + 1) + "/" + contextVariables.datetimeLastProducedFile.getUTCDate() + ".")
@@ -665,7 +665,7 @@
try {
let dataRange = {
begin: pBegin.valueOf(),
end: pEnd.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
end: pEnd.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
}
let fileContent = JSON.stringify(dataRange);
@@ -107,7 +107,7 @@
thisReport.beginingOfMarket.days + " " +
thisReport.beginingOfMarket.hours + ":" +
thisReport.beginingOfMarket.minutes +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
/* Second, we get the report from Exchange Raw Data, to know when the marted ends. */
statusReport = statusDependenciesModule.reportsByMainUtility.get('Market Ending Point')
@@ -143,7 +143,7 @@
thisReport.lastFile.year + "-" +
thisReport.lastFile.month + "-" +
thisReport.lastFile.days + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
/* Finally we get our own Status Report. */
statusReport = statusDependenciesModule.reportsByMainUtility.get('Self Reference')
@@ -174,15 +174,15 @@
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeLastProducedFile.valueOf() -
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
buildCandles()
return
@@ -196,7 +196,7 @@
For that reason we go back one day, the partial information is discarded and
added again with whatever new info is available.
*/
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
findPreviousContent()
return
@@ -205,15 +205,15 @@
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeLastProducedFile.valueOf() -
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS); // Go back one day to start well.
buildCandles()
return
@@ -394,7 +394,7 @@
date and then adding again all the elements found right now at that date and then
from there into the future.
*/
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS);
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> buildCandles -> advanceTime -> New processing time @ " + contextVariables.datetimeLastProducedFile.getUTCFullYear() + "/" + (contextVariables.datetimeLastProducedFile.getUTCMonth() + 1) + "/" + contextVariables.datetimeLastProducedFile.getUTCDate() + ".")
@@ -104,7 +104,7 @@
thisReport.beginingOfMarket.days + " " +
thisReport.beginingOfMarket.hours + ":" +
thisReport.beginingOfMarket.minutes +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS
SA.projects.foundations.globals.timeConstants.GMT_SECONDS
)
} else { // This is the standard way.
contextVariables.dateBeginOfMarket = new Date(thisReport.beginingOfMarket)
@@ -198,7 +198,7 @@
contextVariables.dateBeginOfMarket.getUTCFullYear() + "-" +
(contextVariables.dateBeginOfMarket.getUTCMonth() + 1) + "-" +
contextVariables.dateBeginOfMarket.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS
SA.projects.foundations.globals.timeConstants.GMT_SECONDS
)
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
@@ -242,7 +242,7 @@
let botNeverRan = true;
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME =
new Date(contextVariables.lastFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well when we advance time at the begining of the loop.
new Date(contextVariables.lastFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well when we advance time at the begining of the loop.
let fromDate = new Date(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.valueOf())
let lastDate = TS.projects.foundations.utilities.dateTimeFunctions.removeTime(new Date())
@@ -251,9 +251,9 @@
function advanceTime() {
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME =
new Date(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.valueOf() +
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
previousDay = new Date(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.valueOf() -
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> processTimeFrames -> advanceTime -> TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME = " +
@@ -541,7 +541,7 @@
function writeDataRange(pBegin, pEnd, productCodeName, callBack) {
let dataRange = {
begin: pBegin.valueOf(),
end: pEnd.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
end: pEnd.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
};
let fileContent = JSON.stringify(dataRange)
let fileName = '/Data.Range.json';
@@ -241,7 +241,7 @@
type: 'Time Range',
config: {
initialDatetime: (new Date()).valueOf(),
finalDatetime: (new Date()).valueOf() + TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
finalDatetime: (new Date()).valueOf() + SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
}
}
} else {
@@ -292,8 +292,8 @@
/* Session Type Forced Values */
let today = (new Date()).valueOf()
let aYearAgo = today - TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
let aYearFromNow = today + TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
let aYearAgo = today - SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
let aYearFromNow = today + SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
switch (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.type) {
case 'Back Learning Session': {
useDefaultDatetimes(aYearAgo, today)
@@ -101,7 +101,7 @@ exports.newFoundationsBotModulesLearningEpisode = function (processIndex) {
learningEngine.learningCurrent.learningEpisode.learningEpisodeStatistics.days.value =
learningEngine.learningCurrent.learningEpisode.learningEpisodeCounters.periods.value *
sessionParameters.timeFrame.config.value /
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
}
function cycleBasedStatistics() {
@@ -312,7 +312,7 @@ exports.newFoundationsBotModulesLearningSimulation = function (processIndex) {
if (sessionParameters.heartbeats.config.date === true || sessionParameters.heartbeats.config.candleIndex === true) {
/* We will produce a simulation level heartbeat in order to inform the user this is running. */
heartBeatDate = new Date(Math.trunc(learningEngine.learningCurrent.learningEpisode.candle.begin.value / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
heartBeatDate = new Date(Math.trunc(learningEngine.learningCurrent.learningEpisode.candle.begin.value / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
let fromDate = new Date(sessionParameters.timeRange.config.initialDatetime)
let lastDate = new Date(sessionParameters.timeRange.config.finalDatetime)
@@ -502,7 +502,7 @@ exports.newFoundationsBotModulesLearningSimulation = function (processIndex) {
the day, we will advance current process day one day. By doing so, during the next execution, the
simulation will receive the candles and indicators files of the next day.
*/
let candlesPerDay = TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
let candlesPerDay = SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
if (
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES &&
learningEngine.learningCurrent.learningEpisode.candle.index.value + 1 + 1 === candlesPerDay
@@ -516,7 +516,7 @@ exports.newFoundationsBotModulesLearningSimulation = function (processIndex) {
*/
learningEngine.learningCurrent.learningEpisode.candle.index.value = 0
learningEngine.learningCurrent.learningEpisode.processDate.value =
learningEngine.learningCurrent.learningEpisode.processDate.value + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
learningEngine.learningCurrent.learningEpisode.processDate.value + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
return false
}
@@ -217,8 +217,8 @@
thisReport = statusDependencies.statusReports.get(reportKey)
if (thisReport.file.beginingOfMarket !== undefined) { // This means this is not the first time this process has run.
beginingOfMarket = new Date(thisReport.file.beginingOfMarket.year + "-" + thisReport.file.beginingOfMarket.month + "-" + thisReport.file.beginingOfMarket.days + " " + thisReport.file.beginingOfMarket.hours + ":" + thisReport.file.beginingOfMarket.minutes + TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
lastFile = new Date(thisReport.file.lastFile.year + "-" + thisReport.file.lastFile.month + "-" + thisReport.file.lastFile.days + " " + thisReport.file.lastFile.hours + ":" + thisReport.file.lastFile.minutes + TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
beginingOfMarket = new Date(thisReport.file.beginingOfMarket.year + "-" + thisReport.file.beginingOfMarket.month + "-" + thisReport.file.beginingOfMarket.days + " " + thisReport.file.beginingOfMarket.hours + ":" + thisReport.file.beginingOfMarket.minutes + SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
lastFile = new Date(thisReport.file.lastFile.year + "-" + thisReport.file.lastFile.month + "-" + thisReport.file.lastFile.days + " " + thisReport.file.lastFile.hours + ":" + thisReport.file.lastFile.minutes + SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
lastId = thisReport.file.lastId
lastCandleOfTheDay = thisReport.file.lastCandleOfTheDay
} else { // This means this is the first time this process has run.
@@ -449,7 +449,7 @@
await exchange.fetchOHLCV(symbol, '1d', earliestMarketSince, searchSize, params)
if (earlyOHLCVs.length === searchSize && previousMarketSince !== earlyOHLCVs[0][0]) { // If array is full, and the date returned isn't the same then we are still working in valid data, search further back
earliestMarketSince = (earlyOHLCVs[0][0] - (TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS * searchSize))
earliestMarketSince = (earlyOHLCVs[0][0] - (SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS * searchSize))
previousMarketSince = earlyOHLCVs[0][0]
} else if (earlyOHLCVs.length === searchSize && previousMarketSince === earlyOHLCVs[0][0]) { // If array is full, but the first OHLCV date is the same as last time then we've found our Market Start
@@ -463,7 +463,7 @@
return earlyOHLCVs[0][0]
} else if ((earlyOHLCVs.length === 0 && searchSize !== 1)) { // If array is empty, we've gone too far, half the search size and retry
earliestMarketSince = (earliestMarketSince + (TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS * searchSize))
earliestMarketSince = (earliestMarketSince + (SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS * searchSize))
if (searchSize > 1) {
searchSize = Math.floor(searchSize / 2)
}
@@ -504,7 +504,7 @@
await exchange.fetchOHLCV(symbol, '1m', since, limit, params)
if (nextValidOHLCVs.length === 0) {
since = (since + (TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * limit))
since = (since + (SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * limit))
} else {
foundDate = true
@@ -549,7 +549,7 @@
let OHLCV = OHLCVs[0]
initialProcessTimestamp = OHLCV[0] // 'timestamp'
beginingOfMarket = new Date(Math.trunc(OHLCV[0] / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // 'timestamp'
beginingOfMarket = new Date(Math.trunc(OHLCV[0] / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // 'timestamp'
fromDate = new Date(beginingOfMarket.valueOf())
firstTimeThisProcessRun = false
}
@@ -627,11 +627,11 @@
let startOfFetchTrades = since
let endOfFetchTrades
if (lastFile === undefined) {
endOfFetchTrades = (Math.trunc(since / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
endOfFetchTrades = (Math.trunc(since / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
} else {
endOfFetchTrades = lastFile.valueOf()
}
endOfFetchTrades += TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
endOfFetchTrades += SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
while (TS.projects.foundations.globals.taskVariables.IS_TASK_STOPPING !== true) {
var trades = await exchange.fetchTrades(symbol, startOfFetchTrades, limit, params)
if (trades.length > 0) {
@@ -680,7 +680,7 @@
let heartBeatCounter = 0
let savingProcedureFinished = false
let endOfTheOHLCVArrayReached = false
let currentDay = Math.trunc((initialProcessTimestamp - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
let currentDay = Math.trunc((initialProcessTimestamp - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
let lastCandle = {
begin: 0,
@@ -742,8 +742,8 @@
hold at least the last know value.
*/
let candle = {
begin: currentDay * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay,
end: currentDay * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1,
begin: currentDay * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay,
end: currentDay * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1,
open: lastCandle.close,
close: lastCandle.close,
min: lastCandle.close,
@@ -751,8 +751,8 @@
}
let volume = {
begin: currentDay * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay,
end: currentDay * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1,
begin: currentDay * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay,
end: currentDay * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS * minuteOfTheDay + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS - 1,
buy: lastVolume.buy,
sell: lastVolume.sell
}
@@ -796,7 +796,7 @@
timestamp in order to calculate OHLCVMinute.
*/
let OHLCV = {
timestamp: (new Date()).valueOf() + TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS,
timestamp: (new Date()).valueOf() + SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS,
open: 0,
hight: 0,
low: 0,
@@ -824,7 +824,7 @@
}
}
let candleMinute = Math.trunc(candle.begin / TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
let candleMinute = Math.trunc(candle.begin / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
let OHLCVMinute
/*
Some exchanges return inconsistent data. It is not guaranteed
@@ -833,7 +833,7 @@
between timestamps will be the same. To fix this, we will do this.
*/
OHLCVMinute = Math.trunc(OHLCV.timestamp / TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
OHLCVMinute = Math.trunc(OHLCV.timestamp / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
/*
If the minute of the record item received from the exchange is
@@ -873,7 +873,7 @@
}
/* Recalculate this to see if we need to break the loop*/
OHLCVMinute = Math.trunc(OHLCV.timestamp / TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
OHLCVMinute = Math.trunc(OHLCV.timestamp / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
}
/*
@@ -981,14 +981,14 @@
let fileName = 'Data.json'
filesToCreate++
fileStorage.createTextFile(getFilePath(day * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, CANDLES_FOLDER_NAME) + '/' + fileName, candlesFileContent + '\n', onFileCreated);
fileStorage.createTextFile(getFilePath(day * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, CANDLES_FOLDER_NAME) + '/' + fileName, candlesFileContent + '\n', onFileCreated);
filesToCreate++
fileStorage.createTextFile(getFilePath(day * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, VOLUMES_FOLDER_NAME) + '/' + fileName, volumesFileContent + '\n', onFileCreated);
fileStorage.createTextFile(getFilePath(day * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, VOLUMES_FOLDER_NAME) + '/' + fileName, volumesFileContent + '\n', onFileCreated);
if (ohlcvsFileContent !== undefined) {
filesToCreate++
fileStorage.createTextFile(getFilePath(day * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, OHLCVS_FOLDER_NAME) + '/' + fileName, ohlcvsFileContent + '\n', onFileCreated);
fileStorage.createTextFile(getFilePath(day * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS, OHLCVS_FOLDER_NAME) + '/' + fileName, ohlcvsFileContent + '\n', onFileCreated);
mustLoadRawData = true
} else {
mustLoadRawData = false
@@ -1010,11 +1010,11 @@
let dataLength = rawDataArray.length
if (dataLength > 0) {
// first get the start of the day after this day we are checking
let timestamp = (day * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) +
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
let timestamp = (day * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) +
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
if (rawDataArray[dataLength - 1][0] < timestamp) {
// there is no data for the next day, so now trim this day's data to remove anything before it
timestamp -= TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
timestamp -= SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
let dataIndex = 0
while (dataIndex < dataLength - 1) {
if (rawDataArray[dataIndex][0] < timestamp) { // this data is from a previous day
@@ -1043,7 +1043,7 @@
return;
}
filesCreated++
lastFile = new Date((currentDay * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS))
lastFile = new Date((currentDay * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS))
if (filesCreated === filesToCreate) {
controlLoop()
}
@@ -307,9 +307,10 @@ exports.newFoundationsBotModulesSnapshots = function(processIndex) {
let baseClose = tradingEngine.tradingCurrent.strategyOpenStage.stageBaseAsset.sizeFilled.value - tradingEngine.tradingCurrent.strategyOpenStage.stageBaseAsset.feesPaid.value
let quoteOpen = tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.sizeFilled.value - tradingEngine.tradingCurrent.strategyOpenStage.stageQuotedAsset.feesPaid.value
let quoteClose = tradingEngine.tradingCurrent.strategyCloseStage.stageQuotedAsset.sizeFilled.value - tradingEngine.tradingCurrent.strategyCloseStage.stageQuotedAsset.feesPaid.value
let qouteProfit = ((quoteClose / quoteOpen * 100) - 100)
let baseProfit = ((baseClose / baseOpen * 100) - 100)
let closeHeaders = ['Trade Number', 'Open Datetime', 'Close Datetime', 'Strategy Name', 'Trigger On Situation', 'Take Position Situation', 'Open Position in Base Asset', 'Close Position in Base Asset', 'Open Position in Quoted Asset', 'Close Position in Quoted Asset', 'Result In Base Asset', 'Result In Quoted Asset', 'ROI in Base Asset', '% Profit / Loss in Base Asset', 'ROI in Quoted Asset', '% Profit / Loss in Quoted Asset', 'Exit Type']
let closeHeaders = ['Trade Number', 'Open Datetime', 'Close Datetime', 'Strategy Name', 'Trigger On Situation', 'Take Position Situation', 'Open Position in Base Asset', 'Close Position in Base Asset', 'Open Position in Quoted Asset', 'Close Position in Quoted Asset', 'Result In Base Asset', 'Result In Quoted Asset', 'ROI in Base Asset', '% P/L Base Asset', 'P/L Type Base Asset', 'ROI in Quoted Asset', '% P/L Quoted Asset', 'P/L Type Quoted Asset', 'Exit Type']
closeValues = [
tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.positions.value, // Position Number
(new Date(openDatetime)).toISOString(), // Open Datetime
@@ -324,9 +325,12 @@ exports.newFoundationsBotModulesSnapshots = function(processIndex) {
tradingEngine.tradingCurrent.position.positionBaseAsset.hitFail.value, // Result in Base Asset
tradingEngine.tradingCurrent.position.positionQuotedAsset.hitFail.value, // Result in Base Asset
tradingEngine.tradingCurrent.position.positionBaseAsset.ROI.value, // ROI in Base Asset <- not sure this works as intended
((baseClose / baseOpen * 100) - 100) + '%', // % profit / loss in base Asset
baseProfit + '%', // % profit / loss in base Asset
baseProfit === 0 ? 'Even' : (baseProfit > 0 ? "Profit" : "Loss"),
tradingEngine.tradingCurrent.position.positionQuotedAsset.ROI.value, // ROI in Quoted Asset <- not sure this works as intended
((quoteClose / quoteOpen * 100) - 100) + '%', // % profit loss in quoted Asset
qouteProfit + '%', // % profit loss in quoted Asset
qouteProfit === 0 ? 'Even' : (qouteProfit > 0 ? "Profit" : "Loss"),
tradingEngine.tradingCurrent.position.exitType.value // Exit Type
]
@@ -113,7 +113,7 @@ exports.newFoundationsBotModulesTradingEpisode = function (processIndex) {
tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeStatistics.days.value =
tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.periods.value *
sessionParameters.timeFrame.config.value /
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
}
function cycleBasedStatistics() {
@@ -1286,7 +1286,7 @@ exports.newFoundationsBotModulesTradingOrders = function (processIndex) {
}
function updateStatistics(tradingEngineOrder) {
tradingEngineOrder.orderStatistics.days.value = tradingEngineOrder.orderCounters.periods.value * sessionParameters.timeFrame.config.value / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
tradingEngineOrder.orderStatistics.days.value = tradingEngineOrder.orderCounters.periods.value * sessionParameters.timeFrame.config.value / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
tradingEngineOrder.orderStatistics.days.value = TS.projects.foundations.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngineOrder.orderStatistics.days.value, 10)
}
@@ -513,7 +513,7 @@ exports.newFoundationsBotModulesTradingPosition = function (processIndex) {
/* Days Calculation */
tradingEngine.tradingCurrent.position.positionStatistics.days.value =
tradingEngine.tradingCurrent.position.positionCounters.periods.value *
sessionParameters.timeFrame.config.value / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
sessionParameters.timeFrame.config.value / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
tradingEngine.tradingCurrent.position.positionStatistics.days.value = TS.projects.foundations.utilities.miscellaneousFunctions.truncateToThisPrecision(tradingEngine.tradingCurrent.position.positionStatistics.days.value, 10)
}
@@ -303,7 +303,7 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
if (sessionParameters.heartbeats.config.date === true || sessionParameters.heartbeats.config.candleIndex === true) {
/* We will produce a simulation level heartbeat in order to inform the user this is running. */
heartBeatDate = new Date(Math.trunc(tradingEngine.tradingCurrent.tradingEpisode.candle.begin.value / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
heartBeatDate = new Date(Math.trunc(tradingEngine.tradingCurrent.tradingEpisode.candle.begin.value / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) * SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
let fromDate = new Date(sessionParameters.timeRange.config.initialDatetime)
let lastDate = new Date(sessionParameters.timeRange.config.finalDatetime)
@@ -493,7 +493,7 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
the day, we will advance current process day one day. By doing so, during the next execution, the
simulation will receive the candles and indicators files of the next day.
*/
let candlesPerDay = TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
let candlesPerDay = SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS / sessionParameters.timeFrame.config.value
if (
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).TRADING_PROCESSING_DAILY_FILES &&
tradingEngine.tradingCurrent.tradingEpisode.candle.index.value + 1 + 1 === candlesPerDay
@@ -507,7 +507,7 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
*/
tradingEngine.tradingCurrent.tradingEpisode.candle.index.value = 0
tradingEngine.tradingCurrent.tradingEpisode.processDate.value =
tradingEngine.tradingCurrent.tradingEpisode.processDate.value + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
tradingEngine.tradingCurrent.tradingEpisode.processDate.value + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
return false
}
@@ -249,7 +249,7 @@
type: 'Time Range',
config: {
initialDatetime: (new Date()).valueOf(),
finalDatetime: (new Date()).valueOf() + TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
finalDatetime: (new Date()).valueOf() + SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
}
}
} else {
@@ -300,8 +300,8 @@
/* Session Type Forced Values */
let today = (new Date()).valueOf()
let aYearAgo = today - TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
let aYearFromNow = today + TS.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
let aYearAgo = today - SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
let aYearFromNow = today + SA.projects.foundations.globals.timeConstants.ONE_YEAR_IN_MILISECONDS
switch (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.type) {
case 'Backtesting Session': {
useDefaultDatetimes(aYearAgo, today)
@@ -315,7 +315,7 @@ exports.newFoundationsFunctionLibrariesDataDependenciesFunctions = function () {
/*
We will need to fetch the data of the current day and the previous day, in order for .previous properties in conditions and formulas to work well.
*/
let previousDate = new Date(processDate.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
let previousDate = new Date(processDate.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
let currentDate = new Date(processDate.valueOf())
let previousFile = await getDataFileFromDate(previousDate)
@@ -215,15 +215,15 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeLastProducedFile.valueOf() -
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
callbackFirstRun()
return
@@ -236,7 +236,7 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
For that reason we go back one day, the partial information is discarded and
added again with whatever new info is available.
*/
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() - SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
callbackNotFirstRun()
return
@@ -249,15 +249,15 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeBeginingOfMarketFile.getUTCFullYear() + "-" +
(contextVariables.datetimeBeginingOfMarketFile.getUTCMonth() + 1) + "-" +
contextVariables.datetimeBeginingOfMarketFile.getUTCDate() + " " + "00:00" +
TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
contextVariables.datetimeLastProducedFile = new Date(
contextVariables.datetimeLastProducedFile.valueOf() -
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS) // Go back one day to start well.
callbackFirstRun()
return
@@ -298,7 +298,7 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
from there into the future.
*/
contextVariables.datetimeLastProducedFile = new Date(contextVariables.datetimeLastProducedFile.valueOf() +
TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] advanceTime -> New processing time @ " +
@@ -100,7 +100,7 @@ exports.newFoundationsFunctionLibrariesProcessFilesFunctions = function () {
}
function startFromBegining() {
contextVariables.lastFile = new Date(contextVariables.dateBeginOfMarket.getUTCFullYear() + "-" + (contextVariables.dateBeginOfMarket.getUTCMonth() + 1) + "-" + contextVariables.dateBeginOfMarket.getUTCDate() + " " + "00:00" + TS.projects.foundations.globals.timeConstants.GMT_SECONDS)
contextVariables.lastFile = new Date(contextVariables.dateBeginOfMarket.getUTCFullYear() + "-" + (contextVariables.dateBeginOfMarket.getUTCMonth() + 1) + "-" + contextVariables.dateBeginOfMarket.getUTCDate() + " " + "00:00" + SA.projects.foundations.globals.timeConstants.GMT_SECONDS)
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> getContextVariables -> startFromBegining -> contextVariables.lastFile = " + contextVariables.lastFile)
@@ -147,7 +147,7 @@ exports.newFoundationsFunctionLibrariesProcessFilesFunctions = function () {
async function writeDataRange(productCodeName) {
let dataRange = {
begin: contextVariables.dateBeginOfMarket.valueOf(),
end: processDate.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
end: processDate.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
}
let fileContent = JSON.stringify(dataRange)
@@ -219,7 +219,7 @@
let system = { // These are the available system variables to be used in User Code and Formulas
timeFrame: timeFrame,
ONE_DAY_IN_MILISECONDS: TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
ONE_DAY_IN_MILISECONDS: SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS
}
let variable = {} // This is the structure where the user will define its own variables that will be shared across different code blocks and formulas.
let results = []
@@ -312,8 +312,8 @@
let yesterday = {}
let system = { // These are the available system variables to be used in User Code and Formulas
timeFrame: timeFrame,
ONE_DAY_IN_MILISECONDS: TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS,
ONE_MIN_IN_MILISECONDS: TS.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS
ONE_DAY_IN_MILISECONDS: SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS,
ONE_MIN_IN_MILISECONDS: SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS
}
let variable = {} // This is the structure where the user will define its own variables that will be shared across different code blocks and formulas.
let results = []
@@ -407,7 +407,7 @@
if (processingDailyFiles) {
/* Initialization of Last Instance */
lastInstantOfTheDay = currentDay.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS - 1;
lastInstantOfTheDay = currentDay.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS - 1;
if (interExecutionMemory[productName] === undefined) {
/* The first time the intialization variables goes to the Inter Execution Memory. */
@@ -515,7 +515,7 @@
at the next day, in whole, even if it starts in the previous day.
*/
let lastInstantOdDay = currentDay.valueOf() + TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS - 1;
let lastInstantOdDay = currentDay.valueOf() + SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS - 1;
if (record.end < currentDay.valueOf() - 1) { continue; }
if (record.end === lastInstantOdDay) { continue; }
@@ -10,7 +10,7 @@ exports.newFoundationsUtilitiesDateTimeFunctions = function () {
function removeTime(datetime) {
let date = new Date(datetime)
return new Date(date.getUTCFullYear() + "-" + (date.getUTCMonth() + 1) + "-" + date.getUTCDate() + " " + "00:00" + TS.projects.foundations.globals.timeConstants.GMT_SECONDS);
return new Date(date.getUTCFullYear() + "-" + (date.getUTCMonth() + 1) + "-" + date.getUTCDate() + " " + "00:00" + SA.projects.foundations.globals.timeConstants.GMT_SECONDS);
}
function getPercentage(fromDate, currentDate, lastDate) {
@@ -26,8 +26,8 @@ exports.newFoundationsUtilitiesDateTimeFunctions = function () {
}
function areTheseDatesEqual(date1, date2) {
let day1Days = Math.trunc(date1.valueOf() / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
let day2Days = Math.trunc(date2.valueOf() / TS.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
let day1Days = Math.trunc(date1.valueOf() / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
let day2Days = Math.trunc(date2.valueOf() / SA.projects.foundations.globals.timeConstants.ONE_DAY_IN_MILISECONDS)
if (day1Days === day2Days) {
return true
@@ -0,0 +1,375 @@
{
"type": "User Profile",
"name": "jance1499",
"config": "{\n \"signature\": {\n \"message\": \"jance1499\",\n \"messageHash\": \"0x8f9624be5a61ae4aa463375c50ff92531760ab6bcd61dad3ce945fc9f112c629\",\n \"v\": \"0x1b\",\n \"r\": \"0xe8ecba407115f87579102c47ba1fd3c79376c04697e66688819b3f091e2f14d1\",\n \"s\": \"0x1a0a41a1e6e46f1a974c3afffe8190c9a6050941911c1974e4cedac6544a35b1\",\n \"signature\": \"0xe8ecba407115f87579102c47ba1fd3c79376c04697e66688819b3f091e2f14d11a0a41a1e6e46f1a974c3afffe8190c9a6050941911c1974e4cedac6544a35b11b\"\n },\n \"codeName\": \"jance1499\"\n}",
"project": "Governance",
"tokenPowerSwitch": {
"type": "Token Power Switch",
"name": "New Token Power Switch",
"config": "{}",
"project": "Governance",
"tokenPowerSwitch": [],
"onboardingPrograms": {
"type": "Onboarding Programs",
"name": "New Onboarding Programs",
"config": "{\n \"percentage\": 0\n }",
"project": "Governance",
"airdropProgram": {
"type": "Airdrop Program",
"name": "New Airdrop Program",
"config": "{}",
"project": "Governance",
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "da0e395b-9852-4ec7-add8-22e1a7832b04",
"savedPayload": {
"position": {
"x": 25059,
"y": 23445.577136594
},
"targetPosition": {
"x": 25209,
"y": 23705.384757729335
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "91299123-aac5-4044-bcca-f2015c3d4e3b",
"savedPayload": {
"position": {
"x": 25209,
"y": 23705.384757729335
},
"targetPosition": {
"x": 25359,
"y": 23965.192378864667
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"githubProgram": {
"type": "Github Program",
"name": "New Github Program",
"config": "{}",
"project": "Governance",
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "63a3fbcd-7bc0-45a9-a6d8-3fb3c755bb2c",
"savedPayload": {
"position": {
"x": 25959,
"y": 23965.192378864667
},
"targetPosition": {
"x": 25659,
"y": 23965.192378864667
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "9584f864-d6a5-4810-a3d3-9d0856351e58",
"savedPayload": {
"position": {
"x": 25659,
"y": 23965.192378864667
},
"targetPosition": {
"x": 25359,
"y": 23965.192378864667
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "23443c56-5780-4fca-9f32-325b1f0d22ce",
"savedPayload": {
"position": {
"x": 25359,
"y": 23965.192378864667
},
"targetPosition": {
"x": 25209,
"y": 24225
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"communityBuildingPrograms": {
"type": "Community Building Programs",
"name": "New Community Building Programs",
"config": "{}",
"project": "Governance",
"referralProgram": {
"type": "Referral Program",
"name": "New Referral Program",
"config": "{}",
"project": "Governance",
"userReferrers": [
{
"type": "User Referrer",
"name": "Julian-Molina",
"config": "{}",
"project": "Governance",
"id": "e71243ce-e00f-4dcd-986d-9cc9723b6b79",
"savedPayload": {
"position": {
"x": 25768.807621135333,
"y": 24594.615242270665
},
"targetPosition": {
"x": 25509,
"y": 24744.615242270665
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "User Profile",
"name": "Julian-Molina",
"id": "1fd95e41-4b22-48d5-be3a-904c37afcb11"
},
"referenceParentCombinedNodePath": [
[
"Julian-Molina",
"User Profile",
"Governance",
"1fd95e41-4b22-48d5-be3a-904c37afcb11"
]
]
}
}
],
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "187fe73d-d9f7-4daa-9e19-c85947b5e8b3",
"savedPayload": {
"position": {
"x": 25659,
"y": 25004.422863406
},
"targetPosition": {
"x": 25509,
"y": 24744.615242270665
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"tokensBonus": {
"type": "Tokens Bonus",
"name": "New Tokens Bonus",
"project": "Governance",
"id": "62897efe-bedf-4ab9-9664-adb82d16fc33",
"savedPayload": {
"position": {
"x": 25249.192378864667,
"y": 24894.615242270665
},
"targetPosition": {
"x": 25509,
"y": 24744.615242270665
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "e29dca4f-e915-4cad-9ff8-9b8ed835bba2",
"savedPayload": {
"position": {
"x": 25509,
"y": 24744.615242270665
},
"targetPosition": {
"x": 25359,
"y": 24484.807621135333
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "7fdfcdcd-9a9f-4169-8202-f7a176a406d2",
"savedPayload": {
"position": {
"x": 25359,
"y": 24484.807621135333
},
"targetPosition": {
"x": 25209,
"y": 24225
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "322aa23b-d954-4bba-beaa-54c222ed213a",
"savedPayload": {
"position": {
"x": 25209,
"y": 24225
},
"targetPosition": {
"x": 24909,
"y": 24225
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"tokensMined": {
"type": "Tokens Mined",
"name": "New Tokens Mined",
"project": "Governance",
"id": "b61139f9-f0d5-45be-8c79-4c071026e291",
"savedPayload": {
"position": {
"x": 24609,
"y": 24225
},
"targetPosition": {
"x": 24909,
"y": 24225
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "da72551d-9568-4bf2-bff3-c214b86da538",
"savedPayload": {
"position": {
"x": 24909,
"y": 24225
},
"targetPosition": {
"x": 24909,
"y": 24225
},
"floatingObject": {
"isPinned": true,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
@@ -0,0 +1,373 @@
{
"type": "User Profile",
"name": "mantlik",
"config": "{\n \"signature\": {\n \"message\": \"mantlik\",\n \"messageHash\": \"0x55729b238407ab5afe6c4710b8017e84aaf5dc81cd8ba2f0d8d8b697556e2c96\",\n \"v\": \"0x1b\",\n \"r\": \"0xd80d8852f59d06c54d76505dbfb399bf91daca6c6c1523280648464a3601b23d\",\n \"s\": \"0x0669fd9ece2e7eae3fd2e47f5c9e98032183759de330a2e4e9dce28230608827\",\n \"signature\": \"0xd80d8852f59d06c54d76505dbfb399bf91daca6c6c1523280648464a3601b23d0669fd9ece2e7eae3fd2e47f5c9e98032183759de330a2e4e9dce282306088271b\"\n }\n}",
"project": "Governance",
"tokenPowerSwitch": {
"type": "Token Power Switch",
"name": "New Token Power Switch",
"config": "{}",
"project": "Governance",
"tokenPowerSwitch": [],
"onboardingPrograms": {
"type": "Onboarding Programs",
"name": "New Onboarding Programs",
"config": "{\n \"percentage\": 0\n }",
"project": "Governance",
"airdropProgram": {
"type": "Airdrop Program",
"name": "New Airdrop Program",
"config": "{}",
"project": "Governance",
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "89654aee-85c4-4834-9dc5-5e566a18905d",
"savedPayload": {
"position": {
"x": 13714,
"y": 9746.077136594007
},
"targetPosition": {
"x": 13864,
"y": 10005.884757729338
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "e7d10f37-2de0-4541-9cb1-55c844fde286",
"savedPayload": {
"position": {
"x": 13864,
"y": 10005.884757729338
},
"targetPosition": {
"x": 14014,
"y": 10265.692378864669
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"githubProgram": {
"type": "Github Program",
"name": "New Github Program",
"config": "{}",
"project": "Governance",
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "9ddb7c05-de3e-41d8-808f-8796bc477f55",
"savedPayload": {
"position": {
"x": 14614,
"y": 10265.692378864669
},
"targetPosition": {
"x": 14314,
"y": 10265.692378864669
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "f509fc54-d407-429c-8678-054c17912d57",
"savedPayload": {
"position": {
"x": 14314,
"y": 10265.692378864669
},
"targetPosition": {
"x": 14014,
"y": 10265.692378864669
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "acf12238-1c52-405c-a7ee-26c0de2759c9",
"savedPayload": {
"position": {
"x": 14014,
"y": 10265.692378864669
},
"targetPosition": {
"x": 13864,
"y": 10525.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"communityBuildingPrograms": {
"type": "Community Building Programs",
"name": "New Community Building Programs",
"config": "{}",
"project": "Governance",
"referralProgram": {
"type": "Referral Program",
"name": "New Referral Program",
"config": "{}",
"project": "Governance",
"userReferrers": [
{
"type": "User Referrer",
"name": "Julian-Molina",
"config": "{}",
"project": "Governance",
"id": "eb5e1179-8ca8-4408-8817-129d8a71d525",
"savedPayload": {
"position": {
"x": 14423.807621135331,
"y": 10895.115242270662
},
"targetPosition": {
"x": 14164,
"y": 11045.115242270662
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
},
"referenceParent": {
"type": "User Profile",
"name": "Julian-Molina",
"id": "1fd95e41-4b22-48d5-be3a-904c37afcb11"
},
"referenceParentCombinedNodePath": [
[
"Julian-Molina",
"User Profile"
]
]
}
}
],
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "5b50d9ed-8e9f-4d30-8427-6c4e5010fa72",
"savedPayload": {
"position": {
"x": 14314,
"y": 11304.922863405993
},
"targetPosition": {
"x": 14164,
"y": 11045.115242270662
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"tokensBonus": {
"type": "Tokens Bonus",
"name": "New Tokens Bonus",
"project": "Governance",
"id": "30881e34-a280-46f3-bc25-96901608221a",
"savedPayload": {
"position": {
"x": 13904.192378864669,
"y": 11195.115242270662
},
"targetPosition": {
"x": 14164,
"y": 11045.115242270662
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "924f6479-2cb5-4423-a7ab-d7a22125375f",
"savedPayload": {
"position": {
"x": 14164,
"y": 11045.115242270662
},
"targetPosition": {
"x": 14014,
"y": 10785.307621135331
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "892e9ca5-5bf2-449f-8097-e5935273a67b",
"savedPayload": {
"position": {
"x": 14014,
"y": 10785.307621135331
},
"targetPosition": {
"x": 13864,
"y": 10525.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "1e1feb76-e37b-41d1-9dd8-133164cb6f3c",
"savedPayload": {
"position": {
"x": 13864,
"y": 10525.5
},
"targetPosition": {
"x": 13564,
"y": 10525.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"tokensMined": {
"type": "Tokens Mined",
"name": "New Tokens Mined",
"project": "Governance",
"id": "383c5c35-d7a4-44b4-9a0b-0a99cef2bffd",
"savedPayload": {
"position": {
"x": 13264,
"y": 10525.5
},
"targetPosition": {
"x": 13564,
"y": 10525.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "5e3566b2-041a-452d-8134-087d80f60b82",
"savedPayload": {
"position": {
"x": 13564,
"y": 10525.5
},
"targetPosition": {
"x": 13564,
"y": 10525.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
@@ -0,0 +1,307 @@
{
"type": "User Profile",
"name": "thaissmolina75",
"config": "{\"signature\":{\"message\":\"thaissmolina75\",\"messageHash\":\"0xea9dba957e7349de58c216419575965cde797b0ccd766dc552030eb345bf8655\",\"v\":\"0x1c\",\"r\":\"0x670205a3bf6a83ed30b3d8b4505f5187684a3bfeef4e592e5c2d7858c39dae63\",\"s\":\"0x04c58e35050c8b5b57bf5a7e98c63427d1e4e1533431014a430c99861af32004\",\"signature\":\"0x670205a3bf6a83ed30b3d8b4505f5187684a3bfeef4e592e5c2d7858c39dae6304c58e35050c8b5b57bf5a7e98c63427d1e4e1533431014a430c99861af320041c\"},\"codeName\":\"thaissmolina75\"}",
"project": "Governance",
"tokenPowerSwitch": {
"type": "Token Power Switch",
"name": "New Token Power Switch",
"config": "{}",
"project": "Governance",
"tokenPowerSwitch": [],
"onboardingPrograms": {
"type": "Onboarding Programs",
"name": "New Onboarding Programs",
"config": "{\n \"percentage\": 0\n }",
"project": "Governance",
"airdropProgram": {
"type": "Airdrop Program",
"name": "New Airdrop Program",
"config": "{}",
"project": "Governance",
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "9bd3bb6c-ebd5-4a75-84bf-c3cd36694d8c",
"savedPayload": {
"position": {
"x": 14012,
"y": 9880.077136594007
},
"targetPosition": {
"x": 13862,
"y": 10139.884757729338
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "3aa7fc47-5cd6-4621-9463-c7c7166f4f3f",
"savedPayload": {
"position": {
"x": 13862,
"y": 10139.884757729338
},
"targetPosition": {
"x": 13712,
"y": 10399.692378864669
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "c6fed7c5-3b7b-4c9e-ac1f-a947f15e3f23",
"savedPayload": {
"position": {
"x": 13712,
"y": 10399.692378864669
},
"targetPosition": {
"x": 13562,
"y": 10659.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"communityBuildingPrograms": {
"type": "Community Building Programs",
"name": "New Community Building Programs",
"config": "{}",
"project": "Governance",
"referralProgram": {
"type": "Referral Program",
"name": "New Referral Program",
"config": "{}",
"project": "Governance",
"userReferrers": [
{
"type": "User Referrer",
"name": "",
"config": "{}",
"project": "Governance",
"id": "614a3303-edcf-4d5a-b7b5-a9a357095a80",
"savedPayload": {
"position": {
"x": 14121.807621135331,
"y": 11029.115242270662
},
"targetPosition": {
"x": 13862,
"y": 11179.115242270662
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"tokensAwarded": {
"type": "Tokens Awarded",
"name": "New Tokens Awarded",
"project": "Governance",
"id": "9e190ebe-4571-4efa-9063-d56479ef7210",
"savedPayload": {
"position": {
"x": 14012,
"y": 11438.922863405993
},
"targetPosition": {
"x": 13862,
"y": 11179.115242270662
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"tokensBonus": {
"type": "Tokens Bonus",
"name": "New Tokens Bonus",
"project": "Governance",
"id": "44de116a-d281-4e3d-82fb-90beb7a3fb05",
"savedPayload": {
"position": {
"x": 13602.192378864669,
"y": 11329.115242270662
},
"targetPosition": {
"x": 13862,
"y": 11179.115242270662
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "a1271a5f-df64-4478-82ee-0536e7630d95",
"savedPayload": {
"position": {
"x": 13862,
"y": 11179.115242270662
},
"targetPosition": {
"x": 13712,
"y": 10919.307621135331
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "12e1c5dc-8efa-496f-beac-db816ca7f6fb",
"savedPayload": {
"position": {
"x": 13712,
"y": 10919.307621135331
},
"targetPosition": {
"x": 13562,
"y": 10659.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "bc52611a-43d8-4c15-9b3c-bc09d3912ab2",
"savedPayload": {
"position": {
"x": 13562,
"y": 10659.5
},
"targetPosition": {
"x": 13262,
"y": 10659.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"tokensMined": {
"type": "Tokens Mined",
"name": "New Tokens Mined",
"project": "Governance",
"id": "7cad707f-e862-405f-81e2-62dca37952ec",
"savedPayload": {
"position": {
"x": 12962,
"y": 10659.5
},
"targetPosition": {
"x": 13262,
"y": 10659.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
"id": "45c60ab4-3c57-4692-9764-2cd073128e16",
"savedPayload": {
"position": {
"x": 9090.90909090909,
"y": 21251
},
"targetPosition": {
"x": 9090.90909090909,
"y": 21251
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": true,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
@@ -2,7 +2,14 @@
"type": "Governance Project",
"definition": {
"text": "The Governance Project is the section of the Superalgos Platform that enables the distributed governance of the Superalgos Project.",
"updated": 1630067351210
"updated": 1630067351210,
"translations": [
{
"language": "ES",
"text": "The Governance Project es la sección de la plataforma Superalgos que posibilita la gobernanza distribuida del Superalgos Project.",
"updated": 1631672276415
}
]
},
"paragraphs": [
{
@@ -9,7 +9,8 @@
{
"language": "ES",
"text": "Utilice esta guía si alguna vez desea cargar un User Profile en cualquiera de los Governance Workspaces.",
"updated": 1630895973316
"updated": 1630895973316,
"style": "Definition"
}
]
},
@@ -17,16 +18,37 @@
{
"style": "Text",
"text": "Let's say you wish to declare your referrer in the Referral Program, or maybe you wish to support the Contribution Claims of a fellow developer. ",
"updated": 1630681643918
"updated": 1630681643918,
"translations": [
{
"language": "ES",
"text": "Supongamos que deseas declarar tu referente en el Referral Program, o tal vez desees apoyar el Contribution Claims de un compañero desarrollador.",
"updated": 1632025791877
}
]
},
{
"style": "Callout",
"text": "In either case, you will need to load the User Profile of the person in question so that you may establish the appropriate references."
"text": "In either case, you will need to load the User Profile of the person in question so that you may establish the appropriate references.",
"translations": [
{
"language": "ES",
"text": "En cualquier caso, deberás cargar el User Profile de la persona en cuestión para que pueda establecer las referencias adecuadas.",
"updated": 1632025827657
}
]
},
{
"style": "Note",
"text": "Or maybe you wish to load your own User Profile in one of the Other Governance Workspaces. It's the same process after all!",
"updated": 1630677919945
"updated": 1630677919945,
"translations": [
{
"language": "ES",
"text": "O tal vez quieras cargar tu propio User Profile en uno de los Other Governance Workspaces. ¡Es el mismo proceso después de todo!",
"updated": 1632025920310
}
]
},
{
"style": "Title",
@@ -4,7 +4,14 @@
"type": "Governance Programs",
"definition": {
"text": "The Community may participate in multiple Governance Programs, each designed to fulfill a specific goal. Programs are grouped in the following domains: Onboarding Programs, Community Building Programs, Votes and Claims Programs, and Financial Programs.",
"updated": 1630425525513
"updated": 1630425525513,
"translations": [
{
"language": "ES",
"text": "The Community puede participar en múltiples Governance Programs, cada uno diseñado para cumplir un objetivo específico. Los programas se agrupan en los siguientes dominios: Onboarding Programs, Community Building Programs, Votes and Claims Programs, y Financial Programs.",
"updated": 1631678191412
}
]
},
"paragraphs": [
{
@@ -38,8 +38,8 @@
"translations": [
{
"language": "ES",
"text": "Esto funciona en un ciclo. Cuanto más contribuyas, más fichas ganarás, ¡más dirá que tienes!",
"updated": 1630873348182,
"text": "Esto funciona en un ciclo. Cuanto más contribuyas, más fichas ganarás, ¡más dirá quien más tiene!",
"updated": 1631671942707,
"style": "Note"
}
]
@@ -48,7 +48,14 @@
{
"style": "Important",
"text": "We will use this node to build your User Profile. Later on, you will delete this node to erase all the sensitive information you may enter along with the information the constructor will generate. But no need to worry at this point! I'll let you know when to delete it!",
"updated": 1631547429975
"updated": 1631547429975,
"translations": [
{
"language": "ES",
"text": "Usaremos este nodo para construir tu User Profile. Más adelante, eliminarás este nodo para borrar toda la información sensible que pueda ingresar junto con la información que generará el constructor. ¡Pero no hay necesidad de preocuparse en este momento! ¡Te avisaré cuándo eliminarlo!",
"updated": 1632011343101
}
]
}
]
}
@@ -44,8 +44,8 @@
"translations": [
{
"language": "ES",
"text": "Para vincular una dirección que ya posees, escribe el mnemónico de doce palabras asociado con tu dirección en la propiedad mnemónico. De lo contrario, deja la propiedad en blanco y el sistema creará una nueva.",
"updated": 1630888231106,
"text": "Escribe tu mnemónico de doce palabras en la propiedad mnemotécnica. ¡Deja la propiedad en blanco para generar una nueva dirección! Eliminarás esta información confidencial más adelante, no saldrá de tu computadora y no se guardará en el disco.",
"updated": 1632012849405,
"style": "Text"
}
]
@@ -12,8 +12,8 @@
"translations": [
{
"language": "ES",
"text": "Ahora que tienes un nuevo User Profile, hablemos un poco más sobre esa clave privada.",
"updated": 1630889083782,
"text": "Necesitas la copia de seguridad de la clave privada para luego importar tu dirección de gobierno en una billetera criptográfica.",
"updated": 1632014909086,
"style": "Definition"
}
]
@@ -26,8 +26,8 @@
"translations": [
{
"language": "ES",
"text": "Necesitas la clave privada para agregar tu dirección de gobierno a una billetera criptográfica. Superalgos lo genera localmente en tu computadora. Esto significa que no hay nadie más que tenga acceso o conocimiento de su clave, siempre que su máquina sea segura.",
"updated": 1630889987656,
"text": "Superalgos genera la clave privada localmente. Nadie más en el mundo tiene acceso o conocimiento de tu clave, siempre que su máquina sea segura.",
"updated": 1632014575112,
"style": "Text"
}
]
@@ -39,8 +39,8 @@
"translations": [
{
"language": "ES",
"text": " ¡Debes hacer una copia de seguridad de tu clave privada!",
"updated": 1630890021587,
"text": "Algunas personas imprimen varias copias de la clave privada para almacenarla en diferentes lugares. Recuerda la mayoría de los casos de criptomonedas perdidas involucran personas que pierden claves, ¡no hackeos!",
"updated": 1632014671513,
"style": "Warning"
}
]
@@ -51,8 +51,8 @@
"translations": [
{
"language": "ES",
"text": "Al vincular una dirección anterior, no necesitarás guardar la clave privada, pero debes hacer una copia de seguridad del contenido del constructor por seguridad.",
"updated": 1630890278006,
"text": "Al vincular una dirección anterior, no necesitarás guardar la clave privada, pero debes hacer un Backup del contenido del constructor.",
"updated": 1632016270585,
"style": "Note"
}
]
@@ -26,8 +26,8 @@
"translations": [
{
"language": "ES",
"text": "¡Por eso te pedimos que ayudes de esta manera! Al completar esas tres tareas, está ayudando de manera efectiva a más desarrolladores a encontrar Superalgos, lo cual es una ganancia para todos, ya que mientras más desarrolladores, más rápido avanza el proyecto.",
"updated": 1630892425121,
"text": "¡Por eso les pedimos que ayuden de esta manera! Al completar esas tres tareas, está ayudando de manera efectiva a más desarrolladores a encontrar Superalgos.",
"updated": 1632016358401,
"style": "Note"
}
]
@@ -74,7 +74,14 @@
{
"style": "List",
"text": "This may not be immediately reflected in the system, as Github limits the number of queries the system makes. Don't worry, you will get your tokens anyway.",
"updated": 1631548891216
"updated": 1631548891216,
"translations": [
{
"language": "ES",
"text": "Es posible que no se refleje de inmediato. Github limita la cantidad de consultas que realiza el sistema. Obtendrás tus tokens de todos modos.",
"updated": 1632024032825
}
]
}
]
}
@@ -39,8 +39,8 @@
"translations": [
{
"language": "ES",
"text": "Declarar tus referencias es la mejor manera de agradecer a las personas que pueden haber escrito ese artículo o tweet, producido ese video, mantenido el sitio web o le han contado sobre Superalgos.",
"updated": 1630895822840,
"text": "Declarar tus referencias es la mejor manera de agradecer a las personas que pueden haber escrito ese artículo o tweet, producido ese video, mantenido el sitio web etc....",
"updated": 1632024727440,
"style": "Success"
}
]
@@ -52,8 +52,8 @@
"translations": [
{
"language": "ES",
"text": "Para declarar un referente, debe establecer una referencia del nodo User Referrer a el User Profile de tu referente! ¿Su referente tiene un User Profile?",
"updated": 1630895923926,
"text": "Para declarar una referencia, debes establecerla desde el nodo User Referrer al User Profile de tu referencia. ¡El nombre del User Profile también es un código de referencia!",
"updated": 1632025274614,
"style": "Note"
}
]
@@ -8,40 +8,96 @@
"name": "copy-type",
"project": "Foundations"
},
"updated": 1630927021542
"updated": 1630927021542,
"translations": [
{
"language": "ES",
"text": "¡Esto es importante para cuando salgas a promocionar Superalgos! ¡Asegúrate de que la gente sepa cómo encontrarte!",
"updated": 1632025337077
}
]
},
"paragraphs": [
{
"style": "Success",
"text": "Let me say it again! Let people know your User Profile name so that they may easily find you!",
"updated": 1630927535381
"updated": 1630927535381,
"translations": [
{
"language": "ES",
"text": "¡Deja que las personas sepan tu nombre de User Profile para que puedan encontrarte fácilmente!",
"updated": 1632025446729
}
]
},
{
"style": "Text",
"text": "What if no specific person referred you to Superalgos? Well... you found us somehow, right? These are a few common scenarios and the profile that referred you:",
"updated": 1630927760340
"updated": 1630927760340,
"translations": [
{
"language": "ES",
"text": "¿Qué pasa si ninguna persona te refirió a Superalgos? Nos encontraste de alguna manera, ¿verdad? Estos son algunos escenarios comunes y el perfil que lo refirió:",
"updated": 1632025548369
}
]
},
{
"style": "List",
"text": "The Superalgos.org Website: Julian-Molina",
"updated": 1630927577105
"updated": 1630927577105,
"translations": [
{
"language": "ES",
"text": "El sitio web de Superalgos.org: Julian-Molina",
"updated": 1632025569175
}
]
},
{
"style": "List",
"text": "The Github.com Repo: Luis-Fernando-Molina"
"text": "The Github.com Repo: Luis-Fernando-Molina",
"translations": [
{
"language": "ES",
"text": "El repositorio de Github.com: Luis-Fernando-Molina",
"updated": 1632025589933
}
]
},
{
"style": "List",
"text": "Most YouTube Videos: Julian-Molina"
"text": "Most YouTube Videos: Julian-Molina",
"translations": [
{
"language": "ES",
"text": "La mayoría de los videos de YouTube: Julian-Molina",
"updated": 1632025607190
}
]
},
{
"style": "List",
"text": "Blog Articles: Some by Julian-Molina, Luis-Fernando-Molina,... please check the author!",
"updated": 1630927812445
"updated": 1630927812445,
"translations": [
{
"language": "ES",
"text": "Artículos de Blog: Some by Julian-Molina, Luis-Fernando-Molina,... Por favor, comprueba el autor!",
"updated": 1632025647858
}
]
},
{
"style": "List",
"text": "Official Social Media Posts: Julian-Molina"
"text": "Official Social Media Posts: Julian-Molina",
"translations": [
{
"language": "ES",
"text": "Redes sociales: Julian-Molina",
"updated": 1632025677568
}
]
}
]
}
}
+14 -6
View File
@@ -340,12 +340,6 @@
"functionName": "newFoundationsGlobalsStandardResponses",
"fileName": "StandardResponses.js"
},
{
"name": "Time Constants",
"propertyName": "timeConstants",
"functionName": "newFoundationsGlobalsTimeConstants",
"fileName": "TimeConstants.js"
},
{
"name": "Process Variables",
"propertyName": "processVariables",
@@ -883,6 +877,14 @@
]
},
"SA": {
"globals":[
{
"name": "Time Constants",
"propertyName": "timeConstants",
"functionName": "newFoundationsGlobalsTimeConstants",
"fileName": "TimeConstants.js"
}
],
"utilities": [
{
"name": "Plugins",
@@ -1440,6 +1442,12 @@
"propertyName": "peerInterface",
"functionName": "newSocialTradingModulesPeerInterface",
"fileName": "PeerInterface.js"
},
{
"name": "Storage",
"propertyName": "storage",
"functionName": "newSocialTradingModulesStorage",
"fileName": "Storage.js"
}
],
"utilities": [
@@ -47,15 +47,34 @@ exports.newSocialTradingModulesWebAppInterface = function newSocialTradingModule
queryMessage.emitterUserProfileId = DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID
messageHeader.queryMessage = JSON.stringify(queryMessage)
console.log((new Date()).toISOString(), '- Web App Interface', '- Query Message Received', JSON.stringify(queryMessage))
let response
let response = {
result: 'Ok',
message: 'Web App Interface Query Processed.',
data: await DK.running.webSocketsClient.sendMessage(JSON.stringify(messageHeader))
// console.log((new Date()).toISOString(), '- Web App Interface', '- Query Message Received', JSON.stringify(queryMessage))
if (queryMessage.queryType !== SA.projects.socialTrading.globals.queryTypes.EVENTS) {
response = {
result: 'Ok',
message: 'Web App Interface Query Processed.',
data: await DK.running.webSocketsClient.sendMessage(JSON.stringify(messageHeader))
}
} else {
let events = await DK.running.webSocketsClient.sendMessage(JSON.stringify(messageHeader))
for (let i = 0; i < events.length; i++) {
let event = events[i]
if (event.eventType === SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST) {
event.postText = await getPostText(event.emitterUserProfile.userProfileHandle, event.emitterPost.emitterPostHash, event.timestamp)
}
}
response = {
result: 'Ok',
message: 'Web App Interface Query Processed.',
data: events
}
}
console.log((new Date()).toISOString(), '- Web App Interface', '- Query Respose Sent', JSON.stringify(response))
// console.log((new Date()).toISOString(), '- Web App Interface', '- Query Respose Sent', JSON.stringify(response))
return response
}
@@ -100,8 +119,8 @@ exports.newSocialTradingModulesWebAppInterface = function newSocialTradingModule
and a hash of the content was generated, and that is what is going to
the Network Node.
*/
eventMessage.emitterPostHash = await savePostAtStorage(eventMessage.text, commitMessage, eventMessage.timestamp)
eventMessage.text = undefined
eventMessage.emitterPostHash = await savePostAtStorage(eventMessage.postText, commitMessage, eventMessage.timestamp)
eventMessage.postText = undefined
}
eventMessage.emitterUserProfileId = DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID
@@ -124,19 +143,18 @@ exports.newSocialTradingModulesWebAppInterface = function newSocialTradingModule
}
}
async function savePostAtStorage(text, commitMessage, timestamp) {
async function savePostAtStorage(postText, commitMessage, timestamp) {
const { createHash } = await import('crypto')
const hash = createHash('sha256')
let post = {
timestamp: timestamp,
text: text
postText: postText
}
const fileContent = JSON.stringify(post, undefined, 4)
const fileHash = hash.update(fileContent).digest('hex')
const fileName = fileHash + ".json"
let filePath = './My-Social-Trading-Data/User-Posts/' + SA.projects.foundations.utilities.filesAndDirectories.pathFromDate(timestamp)
const filePath = './My-Social-Trading-Data/User-Posts/' + SA.projects.foundations.utilities.filesAndDirectories.pathFromDate(timestamp)
SA.projects.foundations.utilities.filesAndDirectories.mkDirByPathSync(filePath + '/')
SA.nodeModules.fs.writeFileSync(filePath + '/' + fileName, fileContent)
@@ -154,4 +172,39 @@ exports.newSocialTradingModulesWebAppInterface = function newSocialTradingModule
return fileHash
}
async function getPostText(userProfileHandle, postHash, timestamp) {
let promise = new Promise((resolve, reject) => {
//https://raw.githubusercontent.com/Luis-Fernando-Molina/My-Social-Trading-Data/main/User-Posts/2021/09/17/0608070d8d2aab12e63cf3aa871918a04e237edff4fc0f886d158311811cf7c9.json
const userProfileHandle = "Luis-Fernando-Molina" /// TODO Delete this line
const fileName = postHash + ".json"
const filePath = 'My-Social-Trading-Data/main/User-Posts/' + SA.projects.foundations.utilities.filesAndDirectories.pathFromDate(timestamp)
const fetch = SA.nodeModules.nodeFetch
let url = 'https://raw.githubusercontent.com/' + userProfileHandle + '/' + filePath + '/' + fileName
fetch(url)
.then((response) => {
if (response.status != 200) {
reject('Github.com responded with status ' + response.status)
return
}
response.text().then(body => {
post = JSON.parse(body)
resolve(post.postText)
})
})
.catch(err => {
resolve('Post Text could not be fetched. ' + err.message)
})
}
)
return promise
}
}
@@ -130,6 +130,7 @@ exports.newSocialTradingModulesClientInterface = function newSocialTradingModule
let event = NT.projects.socialTrading.modules.event.newSocialTradingModulesEvent()
event.initialize(eventReceived)
NT.projects.socialTrading.globals.memory.maps.EVENTS.set(eventReceived.eventId, event)
NT.projects.socialTrading.globals.memory.arrays.EVENTS.push(event)
let response = {
result: 'Ok',
@@ -207,7 +208,7 @@ exports.newSocialTradingModulesClientInterface = function newSocialTradingModule
let query = NT.projects.socialTrading.modules.query.newSocialTradingModulesQuery()
query.initialize(queryReceived)
console.log((new Date()).toISOString(), '- Client Interface', '- Query Message Received', queryMessage)
// console.log((new Date()).toISOString(), '- Client Interface', '- Query Message Received', queryMessage)
let response = {
result: 'Ok',
@@ -215,7 +216,7 @@ exports.newSocialTradingModulesClientInterface = function newSocialTradingModule
data: query.execute()
}
console.log((new Date()).toISOString(), '- Client Interface', '- Query Respose Sent', JSON.stringify(response))
// console.log((new Date()).toISOString(), '- Client Interface', '- Query Respose Sent', JSON.stringify(response))
return response
@@ -59,17 +59,17 @@ exports.newSocialTradingModulesQueriesEvents = function newSocialTradingModulesQ
Any of the above happening, means that indeed it is related.
*/
let emitterUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.emitterUserProfileId)
let emitterBotProfile = emitterUserProfile.bots.get(eventReceived.emitterBotProfileId)
let emitterPost = emitterUserProfile.posts.get(eventReceived.emitterPostHash)
let emitterUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(event.emitterUserProfileId)
let emitterBotProfile = emitterUserProfile.bots.get(event.emitterBotProfileId)
let emitterPost = emitterUserProfile.posts.get(event.emitterPostHash)
let targetUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.targetUserProfileId)
let targetUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(event.targetUserProfileId)
let targetBotProfile
let targetPost
if (targetUserProfile !== undefined) {
targetBotProfile = targetUserProfile.bots.get(eventReceived.targetBotProfileId)
targetPost = targetUserProfile.posts.get(eventReceived.targetPostHash)
targetBotProfile = targetUserProfile.bots.get(event.targetBotProfileId)
targetPost = targetUserProfile.posts.get(event.targetPostHash)
}
/*
Test #1 : The Emitter or Target profile must be the same as the Context Profile.
@@ -51,6 +51,8 @@ exports.newSocialTradingModulesSocialGraphPost = function newSocialTradingModule
REACTION_CARE: 6
}
thisObject.replies = new Map()
thisObject.reactions = new Map()
thisObject.reactions.set(REACTION_TYPES.REACTION_LIKE, 0)
thisObject.reactions.set(REACTION_TYPES.REACTION_LOVE, 0)
@@ -1,4 +1,4 @@
exports.newSocialGraph = function newSocialGraph() {
exports.newNetworkModulesSocialGraph = function newNetworkModulesSocialGraph() {
/*
This module represents the Social Graph Service that
this deals with the Social Graph this node mantains.
@@ -0,0 +1,154 @@
exports.newSocialTradingModulesStorage = function newSocialTradingModulesStorage() {
/*
This module represents the Network Node Physical Storage.
It is used to save the in-memory events and also to load
them when the node is starting.
*/
let thisObject = {
initialize: initialize,
finalize: finalize
}
let indexLastSavedEvent = -1
return thisObject
function finalize() {
}
function initialize() {
loadEventsFromStorage()
setInterval(saveEventsAtStorage, 60000)
}
async function loadEventsFromStorage() {
SA.projects.foundations.utilities.filesAndDirectories.getAllFilesInDirectoryAndSubdirectories('./My-Network-Nodes-Data/Nodes/Node-1/', onFiles)
function onFiles(fileList) {
for (let i = 0; i < fileList.length; i++) {
let filePath = './My-Network-Nodes-Data/Nodes/Node-1/' + fileList[i]
for (let k = 0; k < 5; k++) {
filePath = filePath.replace('\\', '/')
}
let fileContent = SA.nodeModules.fs.readFileSync(filePath)
let eventsList = JSON.parse(fileContent)
for (let j = 0; j < eventsList.length; j++) {
let storedEvent = eventsList[j]
try {
let event = NT.projects.socialTrading.modules.event.newSocialTradingModulesEvent()
event.initialize(storedEvent)
NT.projects.socialTrading.globals.memory.maps.EVENTS.set(storedEvent.eventId, event)
NT.projects.socialTrading.globals.memory.arrays.EVENTS.push(event)
indexLastSavedEvent = NT.projects.socialTrading.globals.memory.arrays.EVENTS.length - 1
} catch (err) {
if (err.stack !== undefined) {
console.log('[ERROR] Client Interface -> err.stack = ' + err.stack)
}
let errorMessage = err.message
if (errorMessage === undefined) { errorMessage = err }
console.log ('Could not apply the event from storage. -> errorMessage = ' + errorMessage)
}
}
}
}
}
async function saveEventsAtStorage() {
let oneMore = true
let needToDoGit = false
while (oneMore === true) {
oneMore = saveOneMinuteOfEvents()
if (oneMore === true) {
needToDoGit = true
}
}
if (needToDoGit === true) {
doGit()
}
function saveOneMinuteOfEvents() {
/*
Here we will save all the events that were not saved before,
in one minute chunchs files.
*/
let eventsToSave = []
let minuteToSave
for (let i = indexLastSavedEvent + 1; i < NT.projects.socialTrading.globals.memory.arrays.EVENTS.length; i++) {
let event = NT.projects.socialTrading.globals.memory.arrays.EVENTS[i]
let currentMinute = Math.trunc((new Date()).valueOf() / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
let eventMinute = Math.trunc(event.timestamp / SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS)
if (minuteToSave === undefined) {
minuteToSave = eventMinute
}
/*
We will save events only of the last closed minute.
We will also pack events into one minute chunks only.
*/
if (
eventMinute < currentMinute &&
eventMinute === minuteToSave
) {
let eventToSave = {
eventId: event.eventId,
eventType: event.eventType,
emitterUserProfileId: event.emitterUserProfileId,
targetUserProfileId: event.targetUserProfileId,
emitterBotProfileId: event.emitterBotProfileId,
targetBotProfileId: event.targetBotProfileId,
emitterPostHash: event.emitterPostHash,
targetPostHash: event.targetPostHash,
timestamp: event.timestamp,
botAsset: event.botAsset,
botExchange: event.botExchange,
botEnabled: event.botEnabled
}
eventsToSave.push(eventToSave)
indexLastSavedEvent = i
}
}
if (eventsToSave.length === 0) { return false }
let timestamp = minuteToSave * SA.projects.foundations.globals.timeConstants.ONE_MIN_IN_MILISECONDS
const fileContent = JSON.stringify(eventsToSave, undefined, 4)
const fileName = "Events" + ".json"
let filePath = './My-Network-Nodes-Data/Nodes/Node-1/' + SA.projects.foundations.utilities.filesAndDirectories.pathFromDatetime(timestamp)
SA.projects.foundations.utilities.filesAndDirectories.mkDirByPathSync(filePath + '/')
SA.nodeModules.fs.writeFileSync(filePath + '/' + fileName, fileContent)
return true
}
async function doGit() {
const options = {
baseDir: process.cwd() + '/My-Network-Nodes-Data',
binary: 'git',
maxConcurrentProcesses: 6,
}
const commitMessage = 'New Events'
const git = SA.nodeModules.simpleGit(options)
await git.add('./*')
await git.commit(commitMessage)
await git.push('origin')
}
}
}
@@ -4,7 +4,7 @@ exports.newSocialTradingUtilitiesQueriesValidations = function newSocialTradingU
*/
let thisObject = {
profilesValidations: profilesValidations,
postValidations: postValidations,
postValidations: postValidations,
arrayValidations: arrayValidations
}
@@ -14,6 +14,13 @@ exports.newSocialTradingUtilitiesQueriesValidations = function newSocialTradingU
/*
Validate User Profile
*/
if (queryReceived.emitterUserProfileId !== undefined) {
thisObject.profile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.emitterUserProfileId)
if (thisObject.profile === undefined) {
throw ('Emitter User Profile Not Found.')
}
}
if (queryReceived.targetUserProfileId !== undefined) {
thisObject.profile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
if (thisObject.profile === undefined) {
@@ -92,11 +99,11 @@ exports.newSocialTradingUtilitiesQueriesValidations = function newSocialTradingU
}
if (
queryReceived.direction !== SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE &&
queryReceived.direction !== SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE &&
queryReceived.direction !== SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST &&
queryReceived.direction !== SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP &&
queryReceived.direction !== SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP &&
queryReceived.direction !== SA.projects.socialTrading.globals.queryConstants.DIRECTION_DOWN
) {
) {
throw ('Direction Not Supported.')
}
+1 -1
View File
@@ -55,5 +55,5 @@ run()
async function run() {
TS.app = require('./TaskServer/TaskServer.js').newTaskServer()
await TS.app.run()
console.log('Superalgos TaskSerer is Running!')
console.log('Superalgos TaskServer is Running!')
}