Merge pull request #1734 from Luis-Fernando-Molina/develop

Contribution: Desktop App: Posts being saved at User's Repos
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-09-12 05:31:39 -04:00
commit 55ff37c296
42 files changed
+960 -247

No files matched your search

+1
View File
@@ -1,6 +1,7 @@
Data-Storage
Log-Files
My-Workspaces
My-Social-Trading-Data
debug.log
.DS_Store
*.db
+4 -2
View File
@@ -4,14 +4,16 @@
"**/Documentation": true,
"**/Log-Files": true,
"**/node_modules": true,
"**/Deprecated-Code": true
"**/Deprecated-Code": true,
"**/My-Social-Trading-Data": true,
},
"search.exclude": {
"**/Data-Storage": true,
"**/Documentation": true,
"**/Log-Files": true,
"**/node_modules": true,
"**/Deprecated-Code": true
"**/Deprecated-Code": true,
"**/My-Social-Trading-Data": true
},
"search.maintainFileSearchCache": true
}
+224 -10
View File
@@ -17,6 +17,7 @@ function newWebApp() {
setupRootObject(SA, 'SA')
await UI.projects.socialTrading.modules.webSocketsClient.initialize()
setupHomePage()
setupEventHandlers()
} catch (err) {
console.log('[ERROR] initialize -> err.stack = ' + err.stack)
}
@@ -100,11 +101,11 @@ function newWebApp() {
Test Query User Profiles.
*/
queryMessage = {
queryType: SA.projects.socialTrading.globals.queryTypes.USER_PROFILES,
emitterUserProfileId: undefined,
initialIndex: 'Last',
amountRequested: 10,
direction: 'Past'
queryType: SA.projects.socialTrading.globals.queryTypes.UNFOLLOWED_USER_PROFILES,
emitterUserProfileId: undefined,
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_FIRST,
amountRequested: 3,
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP
}
query = {
@@ -120,12 +121,9 @@ function newWebApp() {
async function showProfiles(profiles) {
console.log(profiles)
document.getElementById('context-cell')
for (let i = 0; i < profiles.length; i++) {
let profile = profiles[i]
console.log(profile)
}
addWhoToFollowTable(profiles)
}
/*
@@ -133,6 +131,222 @@ function newWebApp() {
*/
function onError(errorMessage) {
console.log('[ERROR] Query not executed. ' + errorMessage)
console.log('[ERROR] query = ' + JSON.stringify(query))
}
}
function setupEventHandlers() {
/*
Add events to process button clicks , and mouseWheel.
*/
document.addEventListener("click", onClick)
document.addEventListener('mousewheel', onMouseWheel, false)
async function onClick(event) {
if (event.target && event.target.nodeName === "BUTTON") {
switch (event.target.name) {
case 'New Post': {
let textArea = document.getElementById("new-post-text-area")
await sendNewPostEvent(
textArea.value
)
.then(updateTextArea)
.catch(onError)
function updateTextArea() {
textArea.value = ""
}
break
}
case 'Follow Profile': {
await sendTargetUserProfileEvent(
event.target.userProfileId,
SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE
)
.then(updateButton)
.catch(onError)
function updateButton() {
let span = document.getElementById('profile-to-follow-span-' + event.target.userProfileId)
let button = document.getElementById('profile-to-follow-button-' + event.target.userProfileId)
span.setAttribute("class", "profile-to-unfollow-span")
button.setAttribute("class", "profile-to-unfollow-button")
button.name = 'Unfollow Profile'
}
break
}
case 'Unfollow Profile': {
await sendTargetUserProfileEvent(
event.target.userProfileId,
SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE
)
.then(updateButton)
.catch(onError)
function updateButton() {
let span = document.getElementById('profile-to-follow-span-' + event.target.userProfileId)
let button = document.getElementById('profile-to-follow-button-' + event.target.userProfileId)
span.setAttribute("class", "profile-to-follow-span")
button.setAttribute("class", "profile-to-follow-button")
button.name = 'Follow Profile'
}
break
}
}
}
/*
Error Handling
*/
function onError(errorMessage) {
console.log('[ERROR] Click event failed. ' + errorMessage)
}
}
function onMouseWheel(event) {
let scrollDiv = document.getElementById("scroll-div")
scrollDiv.scrollTop = scrollDiv.scrollTop + event.deltaY
}
}
function addWhoToFollowTable(profiles) {
let contextCell = document.getElementById('who-to-follow-cell')
let table = document.createElement("table")
let tblBody = document.createElement("tbody")
for (let i = 0; i < profiles.length; i++) {
let profile = profiles[i]
let row = document.createElement("tr")
let cell = document.createElement("td")
addProfileToFollowTable(cell, profile)
row.appendChild(cell)
tblBody.appendChild(row)
}
table.appendChild(tblBody)
contextCell.appendChild(table)
table.setAttribute("class", "who-to-follow-table")
}
function addProfileToFollowTable(htmlElement, profile) {
let table = document.createElement("table")
let tblBody = document.createElement("tbody")
let row = document.createElement("tr")
{
let cell = document.createElement("td")
let cellText = document.createTextNode('Profile Picture')
cell.appendChild(cellText)
row.appendChild(cell)
}
{
let cell = document.createElement("td")
let cellText = document.createTextNode(profile.userProfileHandle)
cell.appendChild(cellText)
row.appendChild(cell)
}
{
let cell = document.createElement("td")
let span = document.createElement("span")
let button = document.createElement("button")
let text = document.createTextNode('Follow')
span.setAttribute("id", "profile-to-follow-span-" + profile.userProfileId)
button.setAttribute("id", "profile-to-follow-button-" + profile.userProfileId)
button.name = 'Follow Profile'
button.userProfileId = profile.userProfileId
span.setAttribute("class", "profile-to-follow-span")
button.setAttribute("class", "profile-to-follow-button")
button.appendChild(text)
span.appendChild(button)
cell.appendChild(span)
row.appendChild(cell)
}
tblBody.appendChild(row)
table.appendChild(tblBody)
htmlElement.appendChild(table)
table.setAttribute("class", "profile-to-follow-table")
}
async function sendTargetUserProfileEvent(
userProfileId,
eventType
) {
return new Promise((resolve, reject) => { asyncCall(resolve, reject) })
async function asyncCall(resolve, reject) {
let eventMessage
let event
eventMessage = {
eventType: eventType,
eventId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
targetUserProfileId: userProfileId,
timestamp: new Date()
}
event = {
requestType: 'Event',
eventMessage: JSON.stringify(eventMessage)
}
await UI.projects.socialTrading.modules.webSocketsClient.sendMessage(
JSON.stringify(event)
)
.then(resolve)
.catch(onError)
function onError(errorMessage) {
console.log('[ERROR] Event not executed. ' + errorMessage)
console.log('[ERROR] event = ' + JSON.stringify(event))
reject(errorMessage)
}
}
}
async function sendNewPostEvent(
postText
) {
return new Promise((resolve, reject) => { asyncCall(resolve, reject) })
async function asyncCall(resolve, reject) {
let eventMessage
let event
eventMessage = {
eventType: SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST,
eventId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
text: postText,
timestamp: new Date()
}
event = {
requestType: 'Event',
eventMessage: JSON.stringify(eventMessage)
}
await UI.projects.socialTrading.modules.webSocketsClient.sendMessage(
JSON.stringify(event)
)
.then(resolve)
.catch(onError)
function onError(errorMessage) {
console.log('[ERROR] Event not executed. ' + errorMessage)
console.log('[ERROR] event = ' + JSON.stringify(event))
reject(errorMessage)
}
}
}
}
+69 -4
View File
@@ -22,6 +22,11 @@
font-style: normal;
}
.body{
overflow-y: hidden;
overflow-x: hidden;
}
.scroll-div {
position:absolute;
overflow-y: scroll;
@@ -33,10 +38,24 @@
width: 100%;
color: #000;
border-color: blue;
background-color: #ffffff;
background-color: transparent;
border-width: 0px;
}
.static-div {
position: fixed;
top:0px;
left:18%;
width: 100%;
height: 100%;
padding: 0;
margin: 0;
color: #000;
background:transparent;
border-width: 0px;
border-collapse: collapse;
}
.content-div {
position:relative;
vertical-align: top;
@@ -45,6 +64,16 @@
left: 31.2%;
color: #000;
border-color: blue;
background-color:transparent;
border-width: 1px;
}
.post-placeholder {
vertical-align: top;
height: 50px;
width: 100%;
color: #000;
border-color: blue;
background-color: transparent;
border-width: 0px;
}
@@ -59,10 +88,17 @@
border-width: 0px;
}
.new-post-div {
vertical-align: top;
height: 300px;
width: 100%;
color: #000;
border-color: blue;
background-color: transparent;
border-width: 0px;
}
.page-table {
pointer-events: none;
position:fixed;
position: absolute;
top:0px;
left:18%;
width: 64%;
@@ -241,4 +277,33 @@
color: #000;
border-width: 0px;
border-collapse: collapse;
}
.profile-to-follow-table {
position:relative;
width: 100%;
height: 30%;
padding: 0;
margin: 0;
color: #000;
border-width: 0px;
border-collapse: collapse;
}
.profile-to-follow-span {
float: right;
}
.profile-to-follow-button {
float: right;
background-color: green;
}
.profile-to-unfollow-span {
float: right;
}
.profile-to-unfollow-button {
float: right;
background-color: red;
}
+111 -93
View File
@@ -28,23 +28,122 @@
}
function onResize() {
try {
if (page === undefined) { return }
if (page.eventHandler === undefined) { return }
if (DISABLE_BROWSER_RESIZE_EVENT === true) { return }
page.eventHandler.raiseEvent('Browser Resized')
} catch (err) {
console.log('Error Resizing. ' + err.stack)
}
}
</script>
</head>
<body id="body" onload="loadApp()" onresize="onResize()">
<div class="scroll-div">
<body id="body" onload="loadApp()" onresize="onResize()" class="body">
<div id="scroll-div" class="scroll-div">
<div id="static-div" class="static-div">
<table id="page-table" class="page-table">
<tr>
<td class="left-column">
<table class="left-table">
<tr>
<td class="logo-cell">LOGO</td>
</tr>
<tr>
<td class="menu-cell">
<table class="menu-table">
<tr>
<td class="menu-item-cell">Home</td>
</tr>
<tr>
<td class="menu-item-cell">Explore</td>
</tr>
<tr>
<td class="menu-item-cell">Notifications</td>
</tr>
<tr>
<td class="menu-item-cell">Messages</td>
</tr>
<tr>
<td class="menu-item-cell">Bookmarks</td>
</tr>
<tr>
<td class="menu-item-cell">Lists</td>
</tr>
<tr>
<td class="menu-item-cell">Profile</td>
</tr>
<tr>
<td class="menu-item-cell">More</td>
</tr>
<tr>
<td class="menu-item-cell">Post</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="profile-cell">PROFILE</td>
</tr>
</table>
</td>
<td class="middle-column">
<table class="middle-table">
<tr>
<td class="content-title-cell">CONTENT TITLE</td>
</tr>
<tr>
<td class="content-cell">
</td>
</tr>
</table>
</td>
<td class="right-column">
<table class="right-table">
<tr>
<td class="search-cell">SEARCH</td>
</tr>
<tr>
<td class="context-cell">
<table class="context-table">
<tr>
<td>Who to follow</td>
</tr>
<tr>
<td id="who-to-follow-cell">
</td>
</tr>
<tr>
<td>Show more</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>>
<div class="content-div">
<div class="post-div">
POST 1
<div class="post-placeholder">
Placeholder
</div>
<div class="new-post-div">
<table>
<tr>
<td>Profile Pic</td>
<td>
<table>
<tr>
<td>
<textarea id="new-post-text-area">Type your post here...</textarea>
</td>
</tr>
<tr>
<td>Permissions</td>
</tr>
<tr>
<td>Tool Bar <button name="New Post">POST</button></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="post-div">
POST 2
@@ -60,87 +159,6 @@
</div>
</div>
</div>
<table id="page-table" class="page-table">
<tr>
<td class="left-column">
<table class="left-table">
<tr>
<td class="logo-cell">LOGO</td>
</tr>
<tr>
<td class="menu-cell">
<table class="menu-table">
<tr>
<td class="menu-item-cell">Home</td>
</tr>
<tr>
<td class="menu-item-cell">Explore</td>
</tr>
<tr>
<td class="menu-item-cell">Notifications</td>
</tr>
<tr>
<td class="menu-item-cell">Messages</td>
</tr>
<tr>
<td class="menu-item-cell">Bookmarks</td>
</tr>
<tr>
<td class="menu-item-cell">Lists</td>
</tr>
<tr>
<td class="menu-item-cell">Profile</td>
</tr>
<tr>
<td class="menu-item-cell">More</td>
</tr>
<tr>
<td class="menu-item-cell">Post</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="profile-cell">PROFILE</td>
</tr>
</table>
</td>
<td class="middle-column">
<table class="middle-table">
<tr>
<td class="content-title-cell">CONTENT TITLE</td>
</tr>
<tr>
<td class="content-cell">
</td>
</tr>
</table>
</td>
<td class="right-column">
<table class="right-table">
<tr>
<td class="search-cell">SEARCH</td>
</tr>
<tr>
<td class="context-cell">
<table id="who-to-follow-table" class="who-to-follow-table">
<tr>
<td class="menu-item-cell">User Profile 1</td>
</tr>
<tr>
<td class="menu-item-cell">User Profile 2</td>
</tr>
<tr>
<td class="menu-item-cell">User Profile 3</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
@@ -2,7 +2,9 @@ exports.newFoundationsUtilitiesFilesAndDirectories = function () {
let thisObject = {
getDirectories: getDirectories,
getAllFilesInDirectoryAndSubdirectories: getAllFilesInDirectoryAndSubdirectories
getAllFilesInDirectoryAndSubdirectories: getAllFilesInDirectoryAndSubdirectories,
pathFromDate: pathFromDate,
mkDirByPathSync: mkDirByPathSync
}
return thisObject
@@ -51,4 +53,49 @@ exports.newFoundationsUtilitiesFilesAndDirectories = function () {
return files.reduce((a, f) => a.concat(f), []);
}
}
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 to create folders of missing folders at any path. */
function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
const path = require('path')
targetDir = targetDir.substring(0, targetDir.lastIndexOf('/') + 1);
const sep = '/';
const initDir = path.isAbsolute(targetDir) ? sep : '';
const baseDir = isRelativeToScript ? __dirname : '.';
return targetDir.split(sep).reduce((parentDir, childDir) => {
const curDir = path.resolve(baseDir, parentDir, childDir);
try {
const fs = require('fs')
fs.mkdirSync(curDir);
} catch (err) {
if (err.code === 'EEXIST') { // curDir already exists!
return curDir;
}
// To avoid `EISDIR` error on Mac and `EACCES`-->`ENOENT` and `EPERM` on Windows.
if (err.code === 'ENOENT') { // Throw the original parentDir error on curDir `ENOENT` failure.
throw new Error(`EACCES: permission denied, mkdir '${parentDir}'`);
}
const caughtErr = ['EACCES', 'EPERM', 'EISDIR'].indexOf(err.code) > -1;
if (!caughtErr || caughtErr && curDir === path.resolve(targetDir)) {
throw err; // Throw if it's just the last created dir.
}
}
return curDir;
}, initDir);
}
}
@@ -1,7 +1,8 @@
exports.newFoundationsUtilitiesMiscellaneousFunctions = function () {
let thisObject = {
genereteUniqueId: genereteUniqueId
genereteUniqueId: genereteUniqueId,
pad: pad
}
return thisObject
@@ -12,4 +13,9 @@ exports.newFoundationsUtilitiesMiscellaneousFunctions = function () {
return v.toString(16)
})
}
function pad(str, max) {
str = str.toString();
return str.length < max ? pad("0" + str, max) : str;
}
}
@@ -922,8 +922,8 @@ exports.newFoundationsBotModulesFetchingProcess = function (processIndex) {
file.month = file.date.getUTCMonth() + 1
file.day = file.date.getUTCDate()
let dateForPath = file.year + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2)
/* We will need to save this at the Status Report */
contextVariables.lastFile = file.date
@@ -270,8 +270,8 @@
/* Telling the world we are alive and doing well */
let currentDateString =
processDate.getUTCFullYear() + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2);
SA.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '-' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2);
let currentDate = new Date(processDate)
let percentage = TS.projects.foundations.utilities.dateTimeFunctions.getPercentage(fromDate, currentDate, lastDate)
TS.projects.foundations.functionLibraries.processFunctions.processHeartBeat(processIndex, currentDateString, percentage)
@@ -322,8 +322,8 @@
try {
let dateForPath =
previousDay.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(previousDay.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(previousDay.getUTCDate(), 2);
SA.projects.foundations.utilities.miscellaneousFunctions.pad(previousDay.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(previousDay.getUTCDate(), 2);
let fileName = "Data.json"
let filePathRoot =
'Project/' +
@@ -368,8 +368,8 @@
try {
let dateForPath =
processDate.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2);
SA.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2);
let fileName = "Data.json"
let filePathRoot =
'Project/' +
@@ -584,8 +584,8 @@
let dateForPath =
processDate.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2);
SA.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2);
let fileName = 'Data.json';
let filePath =
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT +
@@ -654,8 +654,8 @@
let dateForPath =
processDate.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2);
SA.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2);
let fileName = 'Data.json';
let filePath =
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT +
@@ -406,7 +406,7 @@
}
/* Telling the world we are alive and doing well */
let currentDateString = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCDate(), 2);
let currentDateString = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCDate(), 2);
let currentDate = new Date(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME)
TS.projects.foundations.functionLibraries.processFunctions.processHeartBeat(
processIndex,
@@ -232,8 +232,8 @@
/* Telling the world we are alive and doing well */
let currentDateString =
contextVariables.datetimeLastProducedFile.getUTCFullYear() + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '-' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
let currentDate = new Date(contextVariables.datetimeLastProducedFile)
let percentage = TS.projects.foundations.utilities.dateTimeFunctions.getPercentage(fromDate, currentDate, lastDate)
TS.projects.foundations.functionLibraries.processFunctions.processHeartBeat(processIndex, currentDateString, percentage)
@@ -272,8 +272,8 @@
function nextCandleFile() {
let dateForPath =
contextVariables.datetimeLastProducedFile.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
let fileName = "Data.json"
let filePathRoot =
@@ -396,7 +396,7 @@
function nextVolumeFile() {
try {
let dateForPath = contextVariables.datetimeLastProducedFile.getUTCFullYear() + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2);
let dateForPath = contextVariables.datetimeLastProducedFile.getUTCFullYear() + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2);
let fileName = "Data.json"
let filePathRoot =
'Project/' +
@@ -540,8 +540,8 @@
let fileName = 'Data.json';
let dateForPath =
contextVariables.datetimeLastProducedFile.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
let filePath =
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT +
"/Output/" +
@@ -588,8 +588,8 @@
let fileName = 'Data.json';
let dateForPath =
contextVariables.datetimeLastProducedFile.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
let filePath =
TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT +
"/Output/" +
@@ -412,8 +412,8 @@
/* Telling the world we are alive and doing well */
let currentDateString =
contextVariables.datetimeLastProducedFile.getUTCFullYear() + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2);
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '-' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2);
let currentDate = new Date(contextVariables.datetimeLastProducedFile)
let percentage = TS.projects.foundations.utilities.dateTimeFunctions.getPercentage(fromDate, currentDate, lastDate)
TS.projects.foundations.functionLibraries.processFunctions.processHeartBeat(processIndex, currentDateString, percentage)
@@ -509,7 +509,7 @@
nextCandleFile();
function nextCandleFile() {
let dateForPath = contextVariables.datetimeLastProducedFile.getUTCFullYear() + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2);
let dateForPath = contextVariables.datetimeLastProducedFile.getUTCFullYear() + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2);
let fileName = "Data.json"
let filePathRoot =
@@ -635,8 +635,8 @@
let dateForPath =
contextVariables.datetimeLastProducedFile.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2);
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2);
let fileName = "Data.json"
let filePathRoot =
@@ -160,8 +160,8 @@ exports.newFoundationsBotModulesFromOneMinToMultiTimeFrameDaily = function (proc
file.month = file.date.getUTCMonth() + 1
file.day = file.date.getUTCDate()
let dateForPath = file.year + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.month, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(file.day, 2)
let fileName = 'Data.json'
let filePath = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT +
@@ -275,8 +275,8 @@
/* Telling the world we are alive and doing well */
let currentDateString = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.getUTCFullYear() + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.getUTCMonth() + 1, 2) + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.getUTCMonth() + 1, 2) + '-' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.getUTCDate(), 2)
let currentDate = new Date(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME)
let percentage = TS.projects.foundations.utilities.dateTimeFunctions.getPercentage(fromDate, currentDate, lastDate)
TS.projects.foundations.functionLibraries.processFunctions.processHeartBeat(processIndex, currentDateString, percentage)
@@ -360,8 +360,8 @@
function getPreviousFile() {
let dateForPath = previousDay.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(previousDay.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(previousDay.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(previousDay.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(previousDay.getUTCDate(), 2)
let filePath
if (dependency.referenceParent.config.codeName === "Multi-Time-Frame-Daily") {
filePath = dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + timeFrameLabel + "/" + dateForPath;
@@ -412,8 +412,8 @@
function getCurrentFile() {
let dateForPath = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).DAILY_FILES_PROCESS_DATETIME.getUTCDate(), 2)
let filePath
if (dependency.referenceParent.config.codeName === "Multi-Time-Frame-Daily") {
filePath = dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + timeFrameLabel + "/" + dateForPath;
@@ -224,7 +224,7 @@
}
/* Telling the world we are alive and doing well */
let currentDateString = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCDate(), 2)
let currentDateString = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME.getUTCDate(), 2)
let currentDate = new Date(TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_DATETIME)
TS.projects.foundations.functionLibraries.processFunctions.processHeartBeat(
processIndex,
@@ -317,7 +317,7 @@ exports.newFoundationsBotModulesLearningSimulation = function (processIndex) {
let fromDate = new Date(sessionParameters.timeRange.config.initialDatetime)
let lastDate = new Date(sessionParameters.timeRange.config.finalDatetime)
let currentDateString = heartBeatDate.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
let currentDateString = heartBeatDate.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
let currentDate = new Date(heartBeatDate)
let percentage = TS.projects.foundations.utilities.dateTimeFunctions.getPercentage(fromDate, currentDate, lastDate)
/*
@@ -327,7 +327,7 @@ exports.newFoundationsBotModulesLearningSimulation = function (processIndex) {
if (heartBeatDate.valueOf() !== previousHeartBeatDate) {
previousHeartBeatDate = heartBeatDate.valueOf()
let processingDate = heartBeatDate.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
let processingDate = heartBeatDate.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
'[INFO] runSimulation -> loop -> Simulation ' + TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_KEY + ' Loop # ' + learningEngine.learningCurrent.learningEpisode.candle.index.value + ' @ ' + processingDate)
@@ -258,8 +258,8 @@
let fileName = "Data.json"
let datetime = new Date(lastFile.valueOf())
let dateForPath = datetime.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(datetime.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(datetime.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(datetime.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(datetime.getUTCDate(), 2)
let filePath = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT + "/Output/" + OHLCVS_FOLDER_NAME + '/' + dateForPath;
let fullFileName = filePath + '/' + fileName
fileStorage.getTextFile(fullFileName, onFileReceived)
@@ -368,7 +368,7 @@
/* Reporting we are doing well */
function heartBeat(noNewInternalLoop) {
let processingDate = new Date(since)
processingDate = processingDate.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCDate(), 2);
processingDate = processingDate.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCDate(), 2);
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> getOHLCVs -> Fetching OHLCVs @ " + processingDate + "-> exchange = " + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.name + " -> symbol = " + symbol + " -> since = " + since + " -> limit = " + limit)
let heartBeatText = "Fetching " + rawDataArray.length.toFixed(0) + " OHLCVs from " + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.name + " " + symbol + " @ " + processingDate
@@ -476,7 +476,7 @@
}
let processingDate = new Date(earliestMarketSince)
processingDate = processingDate.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCDate(), 2);
processingDate = processingDate.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCDate(), 2);
TS.projects.foundations.functionLibraries.processFunctions.processHeartBeat(processIndex, "Invalid or No Start Date. Finding Market Start @ " + processingDate, 0)
}
}
@@ -509,7 +509,7 @@
}
let processingDate = new Date(since)
processingDate = processingDate.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCDate(), 2);
processingDate = processingDate.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCDate(), 2);
TS.projects.foundations.functionLibraries.processFunctions.processHeartBeat(processIndex, "No Data Found. Fast-Forwarding to Next Data @ " + processingDate, 0)
}
}
@@ -945,8 +945,8 @@
let processingDate = new Date(candle.begin)
processingDate =
processingDate.getUTCFullYear() + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCMonth() + 1, 2) + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCDate(), 2);
SA.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCMonth() + 1, 2) + '-' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(processingDate.getUTCDate(), 2);
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> saveOHLCVs -> Before Fetch -> Saving OHLCVs @ " + processingDate + " -> ohlcvArrayIndex = " + ohlcvArrayIndex + " -> total = " + rawDataArray.length)
@@ -1048,8 +1048,8 @@
function getFilePath(timestamp, folderName) {
let datetime = new Date(timestamp)
let dateForPath = datetime.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(datetime.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(datetime.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(datetime.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(datetime.getUTCDate(), 2)
let filePath = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT + "/Output/" + folderName + '/' + dateForPath;
return filePath
}
@@ -308,7 +308,7 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
let fromDate = new Date(sessionParameters.timeRange.config.initialDatetime)
let lastDate = new Date(sessionParameters.timeRange.config.finalDatetime)
let currentDateString = heartBeatDate.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
let currentDateString = heartBeatDate.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
let currentDate = new Date(heartBeatDate)
let percentage = TS.projects.foundations.utilities.dateTimeFunctions.getPercentage(fromDate, currentDate, lastDate)
/*
@@ -318,7 +318,7 @@ exports.newFoundationsBotModulesTradingSimulation = function (processIndex) {
if (heartBeatDate.valueOf() !== previousHeartBeatDate) {
previousHeartBeatDate = heartBeatDate.valueOf()
let processingDate = heartBeatDate.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
let processingDate = heartBeatDate.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(heartBeatDate.getUTCDate(), 2)
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
'[INFO] runSimulation -> loop -> Simulation ' + TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_KEY + ' Loop # ' + tradingEngine.tradingCurrent.tradingEpisode.candle.index.value + ' @ ' + processingDate)
@@ -241,7 +241,7 @@ exports.newFoundationsFunctionLibrariesDataDependenciesFunctions = function () {
processDate
) {
/* Telling the world we are alive and doing well and which date we are processing right now. */
let processingDateString = processDate.getUTCFullYear() + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '-' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2)
let processingDateString = processDate.getUTCFullYear() + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCMonth() + 1, 2) + '-' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(processDate.getUTCDate(), 2)
TS.projects.foundations.functionLibraries.processFunctions.processHeartBeat(processIndex, processingDateString, undefined, "Running...")
/*
@@ -327,7 +327,7 @@ exports.newFoundationsFunctionLibrariesDataDependenciesFunctions = function () {
async function getDataFileFromDate(dataFileDate) {
let dateForPath = dataFileDate.getUTCFullYear() + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(dataFileDate.getUTCMonth() + 1, 2) + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(dataFileDate.getUTCDate(), 2)
let dateForPath = dataFileDate.getUTCFullYear() + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(dataFileDate.getUTCMonth() + 1, 2) + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(dataFileDate.getUTCDate(), 2)
let filePath = dependency.referenceParent.parentNode.config.codeName + '/' + dependency.referenceParent.config.codeName + "/" + timeFrameLabel + "/" + dateForPath
let fileName = "Data.json"
@@ -329,8 +329,8 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
/* Telling the world we are alive and doing well */
let currentDateString =
contextVariables.datetimeLastProducedFile.getUTCFullYear() + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '-' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '-' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
let currentDate = new Date(contextVariables.datetimeLastProducedFile)
let percentage = TS.projects.foundations.utilities.dateTimeFunctions.getPercentage(fromDate, currentDate, lastDate)
TS.projects.foundations.functionLibraries.processFunctions.processHeartBeat(processIndex, currentDateString, percentage)
@@ -360,8 +360,8 @@ exports.newFoundationsFunctionLibrariesFromOneMinToMultiTimeFrameFunctions = fun
const ONE_MIN_DATASET_TYPE = "One-Min"
let dateForPath = contextVariables.datetimeLastProducedFile.getUTCFullYear() + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' +
TS.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCMonth() + 1, 2) + '/' +
SA.projects.foundations.utilities.miscellaneousFunctions.pad(contextVariables.datetimeLastProducedFile.getUTCDate(), 2)
let fileName = "Data.json"
@@ -117,7 +117,7 @@ exports.newFoundationsFunctionLibrariesOutputManagementFunctions = function () {
if (dataset.config.type === 'Daily Files') {
let dateForPath = tradingProcessDate.getUTCFullYear() + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCMonth() + 1, 2) + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCDate(), 2);
let dateForPath = tradingProcessDate.getUTCFullYear() + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCMonth() + 1, 2) + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCDate(), 2);
let fileName = 'Data.json'
let filePath = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT + '/Output/' + TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_FOLDER_NAME + '/' + dataset.parentNode.config.codeName + '/' + dataset.config.codeName + '/' + timeFrameLabel + "/" + dateForPath
@@ -181,7 +181,7 @@ exports.newFoundationsFunctionLibrariesOutputManagementFunctions = function () {
if (dataset.config.type === 'Daily Files') {
let dateForPath = tradingProcessDate.getUTCFullYear() + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCMonth() + 1, 2) + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCDate(), 2);
let dateForPath = tradingProcessDate.getUTCFullYear() + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCMonth() + 1, 2) + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(tradingProcessDate.getUTCDate(), 2);
let fileName = 'Data.json'
let filePath = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).FILE_PATH_ROOT + '/Output/' + TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_FOLDER_NAME + '/' + dataset.parentNode.config.codeName + '/' + dataset.config.codeName + '/' + timeFrameLabel + "/" + dateForPath
@@ -563,7 +563,7 @@
let dateForPath = ''
if (processingDailyFiles === true) {
dateForPath = "/" + currentDay.getUTCFullYear() + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(currentDay.getUTCMonth() + 1, 2) + '/' + TS.projects.foundations.utilities.miscellaneousFunctions.pad(currentDay.getUTCDate(), 2);
dateForPath = "/" + currentDay.getUTCFullYear() + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(currentDay.getUTCMonth() + 1, 2) + '/' + SA.projects.foundations.utilities.miscellaneousFunctions.pad(currentDay.getUTCDate(), 2);
}
let filePathRoot = 'Project/' + contextSummary.project + "/" + contextSummary.mineType + "/" + contextSummary.dataMine + "/" + contextSummary.bot + '/' + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.config.codeName + "/" + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName + "-" + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.quotedAsset.referenceParent.config.codeName
@@ -244,7 +244,7 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
logger.write(MODULE_NAME, '[INFO] FileStorage -> createTextFile -> fileLocation: ' + fileLocation)
/* If necesary a folder or folders are created before writing the file to disk. */
TS.projects.foundations.utilities.miscellaneousFunctions.mkDirByPathSync(fileLocation)
SA.projects.foundations.utilities.filesAndDirectories.mkDirByPathSync(fileLocation)
/*
Here we write the file with a temporary name so as to avoid dirty read from other processes.
@@ -2,9 +2,7 @@ exports.newFoundationsUtilitiesMiscellaneousFunctions = function () {
let thisObject = {
truncateToThisPrecision: truncateToThisPrecision,
pad: pad,
asyncGetDatasetFile: asyncGetDatasetFile,
mkDirByPathSync: mkDirByPathSync
asyncGetDatasetFile: asyncGetDatasetFile
}
return thisObject
@@ -13,11 +11,6 @@ exports.newFoundationsUtilitiesMiscellaneousFunctions = function () {
return parseFloat(floatNumber.toFixed(precision))
}
function pad(str, max) {
str = str.toString();
return str.length < max ? pad("0" + str, max) : str;
}
async function asyncGetDatasetFile(datasetModule, filePath, fileName) {
/*
This function helps a caller to use await syntax while the called
@@ -39,38 +32,4 @@ exports.newFoundationsUtilitiesMiscellaneousFunctions = function () {
return promise
}
/* Function to create folders of missing folders at any path. */
function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
const path = require('path')
targetDir = targetDir.substring(0, targetDir.lastIndexOf('/') + 1);
const sep = '/';
const initDir = path.isAbsolute(targetDir) ? sep : '';
const baseDir = isRelativeToScript ? __dirname : '.';
return targetDir.split(sep).reduce((parentDir, childDir) => {
const curDir = path.resolve(baseDir, parentDir, childDir);
try {
const fs = require('fs')
fs.mkdirSync(curDir);
} catch (err) {
if (err.code === 'EEXIST') { // curDir already exists!
return curDir;
}
// To avoid `EISDIR` error on Mac and `EACCES`-->`ENOENT` and `EPERM` on Windows.
if (err.code === 'ENOENT') { // Throw the original parentDir error on curDir `ENOENT` failure.
throw new Error(`EACCES: permission denied, mkdir '${parentDir}'`);
}
const caughtErr = ['EACCES', 'EPERM', 'EISDIR'].indexOf(err.code) > -1;
if (!caughtErr || caughtErr && curDir === path.resolve(targetDir)) {
throw err; // Throw if it's just the last created dir.
}
}
return curDir;
}, initDir);
}
}
+6
View File
@@ -1339,6 +1339,12 @@
"functionName": "newSocialTradingModulesQueriesUserProfiles",
"fileName": "Queries/UserProfiles.js"
},
{
"name": "Unfollowed User Profiles",
"propertyName": "queriesUnfollowedUserProfiles",
"functionName": "newSocialTradingModulesQueriesUnfollowedUserProfiles",
"fileName": "Queries/UnfollowedUserProfiles.js"
},
{
"name": "Bot Profile Stats",
"propertyName": "queriesBotProfileStats",
@@ -65,6 +65,40 @@ exports.newSocialTradingModulesWebAppInterface = function newSocialTradingModule
}
return JSON.stringify(response)
}
if (
eventMessage.eventType === SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST ||
eventMessage.eventType === SA.projects.socialTrading.globals.eventTypes.REPLY_TO_USER_POST ||
eventMessage.eventType === SA.projects.socialTrading.globals.eventTypes.REPOST_USER_POST
) {
/*
We need to save the post at the User's storage and remove the text from the message
going to the Network Node.
*/
let commitMessage
switch (eventMessage.eventType) {
case SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST: {
commitMessage = "New Post"
break
}
case SA.projects.socialTrading.globals.eventTypes.REPLY_TO_USER_POST: {
commitMessage = "Reply to User Post"
break
}
case SA.projects.socialTrading.globals.eventTypes.REPOST_USER_POST: {
commitMessage = "Repost User Post"
break
}
}
/*
The post text is eliminated, since it is now at the user's storage,
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.emitterUserProfileId = DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID
messageHeader.eventMessage = JSON.stringify(eventMessage)
@@ -84,4 +118,35 @@ exports.newSocialTradingModulesWebAppInterface = function newSocialTradingModule
}
}
}
async function savePostAtStorage(text, commitMessage, timestamp) {
const { createHash } = await import('crypto')
const hash = createHash('sha256')
let post = {
timestamp: timestamp,
text: text
}
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)
SA.projects.foundations.utilities.filesAndDirectories.mkDirByPathSync(filePath + '/')
SA.nodeModules.fs.writeFileSync(filePath + '/' + fileName, fileContent)
const options = {
baseDir: process.cwd() + '/My-Social-Trading-Data',
binary: 'git',
maxConcurrentProcesses: 6,
}
const git = SA.nodeModules.simpleGit(options)
await git.add('./*')
await git.commit(commitMessage)
await git.push('origin')
return fileHash
}
}
@@ -64,11 +64,25 @@ exports.newDesktopModulesWebSocketsInterface = function newDesktopModulesWebSock
return
}
let response = await webAppInterface.messageReceived(messageHeader.payload)
webApp.socket.send(JSON.stringify(response))
await webAppInterface.messageReceived(messageHeader.payload)
.then(sendResponseToWebApp)
.catch(onError)
function sendResponseToWebApp(response) {
webApp.socket.send(JSON.stringify(response))
}
function onError(errorMessage) {
console.log('[ERROR] Web Sockets Interface -> onMenssage -> errorMessage = ' + errorMessage)
let response = {
result: 'Error',
message: errorMessage
}
webApp.socket.send(JSON.stringify(response))
}
} catch (err) {
console.log('[ERROR] Web Sockets Interface -> setUpWebSocketServer -> err.stack = ' + err.stack)
console.log('[ERROR] Web Sockets Interface -> onMenssage -> err.stack = ' + err.stack)
}
}
}
@@ -103,6 +103,16 @@ exports.newSocialTradingModulesClientInterface = function newSocialTradingModule
return response
}
/*
We will not accept events that don't have an eventId.
*/
if (eventReceived.eventId === undefined) {
let response = {
result: 'Error',
message: 'eventId Not Provided.'
}
return response
}
/*
We will not accept events that have already been processed.
*/
@@ -139,8 +139,6 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
emitterUserProfile.addPost(
thisObject.emitterUserProfileId,
thisObject.targetUserProfileId,
thisObject.emitterBotProfileId,
thisObject.targetBotProfileId,
thisObject.emitterPostHash,
thisObject.targetPostHash,
thisObject.eventType - 10,
@@ -35,7 +35,7 @@ exports.newSocialTradingModulesQueriesProfileFollowers = function newSocialTradi
let response = []
switch (thisObject.direction) {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP: {
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
@@ -43,7 +43,7 @@ exports.newSocialTradingModulesQueriesProfileFollowers = function newSocialTradi
}
break
}
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_DOWN: {
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
@@ -35,7 +35,7 @@ exports.newSocialTradingModulesQueriesProfileFollowing = function newSocialTradi
let response = []
switch (thisObject.direction) {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP: {
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
@@ -43,7 +43,7 @@ exports.newSocialTradingModulesQueriesProfileFollowing = function newSocialTradi
}
break
}
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_DOWN: {
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
@@ -0,0 +1,104 @@
exports.newSocialTradingModulesQueriesUnfollowedUserProfiles = function newSocialTradingModulesQueriesUnfollowedUserProfiles() {
/*
This query returns a list of user profiles ordered
by Ranking. It filters out all the profiles that
are already followed by the Emitter User Profile.
*/
let thisObject = {
emitterUserProfile: undefined,
profiles: undefined,
initialIndex: undefined,
amountRequested: undefined,
direction: undefined,
execute: execute,
initialize: initialize,
finalize: finalize
}
return thisObject
function finalize() {
thisObject.profiles = undefined
thisObject.emitterUserProfile = undefined
}
function initialize(queryReceived) {
thisObject.emitterUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.emitterUserProfileId)
if (thisObject.emitterUserProfile === undefined) {
throw ('Emitter User Profile Not Found.')
}
thisObject.profiles = Array.from(
NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID,
x => x[1]
)
thisObject.profiles.sort((a, b) => (a["ranking"] > b["ranking"]) ? 1 : -1)
NT.projects.socialTrading.utilities.queriesValidations.arrayValidations(queryReceived, thisObject, thisObject.profiles)
}
function execute() {
let response = []
switch (thisObject.direction) {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP: {
let i = thisObject.initialIndex
let foundCount = 0
while (
foundCount < thisObject.amountRequested &&
i < thisObject.profiles.length
) {
let profile = thisObject.profiles[i]
if (
thisObject.emitterUserProfile.following.get(profile.userProfileId) === undefined &&
thisObject.emitterUserProfile.userProfileId !== profile.userProfileId
) {
addToResponse(profile)
foundCount++
}
i++
}
break
}
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_DOWN: {
let i = thisObject.initialIndex
let foundCount = 0
while (
foundCount < thisObject.amountRequested &&
i >= 0
) {
let profile = thisObject.profiles[i]
if (
thisObject.emitterUserProfile.following.get(profile.userProfileId) === undefined &&
thisObject.emitterUserProfile.userProfileId !== profile.userProfileId
) {
addToResponse(profile)
foundCount++
}
i--
}
break
}
}
return response
function addToResponse(profile) {
let postResponse = {
"userProfileId": profile.userProfileId,
"userProfileHandle": profile.userProfileHandle,
"blockchainAccount": profile.blockchainAccount,
"ranking": profile.ranking,
"followingCount": profile.following.size,
"followersCount": profile.followers.size,
"postsCount": profile.posts.size,
"botsCount": profile.bots.size,
"emitterEventsCount": profile.emitterEventsCount,
"targetEventsCount": profile.targetEventsCount
}
response.push(postResponse)
}
}
}
@@ -5,7 +5,7 @@ exports.newSocialTradingModulesQueriesUserProfiles = function newSocialTradingMo
and provide them with alternative of who to follow.
*/
let thisObject = {
array: undefined,
profiles: undefined,
initialIndex: undefined,
amountRequested: undefined,
direction: undefined,
@@ -17,18 +17,18 @@ exports.newSocialTradingModulesQueriesUserProfiles = function newSocialTradingMo
return thisObject
function finalize() {
thisObject.array = undefined
thisObject.profiles = undefined
}
function initialize(queryReceived) {
thisObject.array = Array.from(
thisObject.profiles = Array.from(
NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID,
x => x[1]
)
thisObject.array.sort((a, b) => (a["ranking"] > b["ranking"]) ? 1 : -1)
thisObject.profiles.sort((a, b) => (a["ranking"] > b["ranking"]) ? 1 : -1)
NT.projects.socialTrading.utilities.queriesValidations.arrayValidations(queryReceived, thisObject, thisObject.array)
NT.projects.socialTrading.utilities.queriesValidations.arrayValidations(queryReceived, thisObject, thisObject.profiles)
}
@@ -37,19 +37,19 @@ exports.newSocialTradingModulesQueriesUserProfiles = function newSocialTradingMo
let response = []
switch (thisObject.direction) {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP: {
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
addToResponse(arrayItem)
let profile = thisObject.profiles[i]
if (profile === undefined) { break }
addToResponse(profile)
}
break
}
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_DOWN: {
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
addToResponse(arrayItem)
let profile = thisObject.profiles[i]
if (profile === undefined) { break }
addToResponse(profile)
}
break
}
@@ -34,6 +34,12 @@ exports.newSocialTradingModulesQuery = function newSocialTradingModulesQuery() {
break
}
case SA.projects.socialTrading.globals.queryTypes.UNFOLLOWED_USER_PROFILES: {
thisObject.query = NT.projects.socialTrading.modules.queriesUnfollowedUserProfiles.newSocialTradingModulesQueriesUnfollowedUserProfiles()
thisObject.query.initialize(queryReceived)
break
}
case SA.projects.socialTrading.globals.queryTypes.USER_PROFILE_STATS: {
thisObject.query = NT.projects.socialTrading.modules.queriesUserProfileStats.newSocialTradingModulesQueriesUserProfileStats()
thisObject.query.initialize(queryReceived)
@@ -91,7 +91,12 @@ exports.newSocialTradingUtilitiesQueriesValidations = function newSocialTradingU
throw ('Direction Undefined.')
}
if (queryReceived.direction !== SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE && queryReceived.direction !== SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST) {
if (
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_DOWN
) {
throw ('Direction Not Supported.')
}
@@ -6,7 +6,9 @@ exports.newSocialTradingGlobalsQueryConstants = function () {
MIN_AMOUNT_REQUESTED: 1,
MAX_AMOUNT_REQUESTED: 100,
DIRECTION_FUTURE: 'Future',
DIRECTION_PAST: 'Past'
DIRECTION_PAST: 'Past',
DIRECTION_UP: 'Up',
DIRECTION_Down: 'Down'
}
return thisObject
@@ -2,13 +2,14 @@ exports.newSocialTradingGlobalsQueryTypes = function () {
let thisObject = {
USER_PROFILES: 0,
USER_PROFILE_STATS: 1,
BOT_PROFILE_STATS: 2,
PROFILE_POSTS: 3,
PROFILE_FOLLOWERS: 4,
PROFILE_FOLLOWING: 5,
POST_REPLIES: 6,
EVENTS: 7
UNFOLLOWED_USER_PROFILES: 1,
USER_PROFILE_STATS: 2,
BOT_PROFILE_STATS: 3,
PROFILE_POSTS: 4,
PROFILE_FOLLOWERS: 5,
PROFILE_FOLLOWING: 6,
POST_REPLIES: 7,
EVENTS: 8
}
return thisObject
@@ -120,7 +120,7 @@ exports.newTensorFlowBotModulesTensorFlowLibrary = function (processIndex) {
async function saveModel() {
let fileLocation = getModelPath();
/* If necesary a folder or folders are created before writing the file to disk: */
TS.projects.foundations.utilities.miscellaneousFunctions.mkDirByPathSync(fileLocation);
SA.projects.foundations.utilities.filesAndDirectories.mkDirByPathSync(fileLocation);
const savedModel = await tensorFlowModelsManager.model.save('file://' + fileLocation);
}
+4 -2
View File
@@ -4,14 +4,16 @@
"**/Documentation": true,
"**/Log-Files": true,
"**/node_modules": true,
"**/Deprecated-Code": true
"**/Deprecated-Code": true,
"**/My-Social-Trading-Data": true,
},
"search.exclude": {
"**/Data-Storage": true,
"**/Documentation": true,
"**/Log-Files": true,
"**/node_modules": true,
"**/Deprecated-Code": true
"**/Deprecated-Code": true,
"**/My-Social-Trading-Data": true
},
"search.maintainFileSearchCache": true
}
+3 -1
View File
@@ -44,7 +44,9 @@ SA.nodeModules = {
web3: require('web3'),
ws: require('ws'),
open: require('open'),
http: require('http')
http: require('http'),
octokit: require("@octokit/rest"),
simpleGit: require('simple-git')
}
/*
+184
View File
@@ -220,6 +220,145 @@
"@ethersproject/strings": "^5.4.0"
}
},
"@kwsites/file-exists": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz",
"integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==",
"requires": {
"debug": "^4.1.1"
},
"dependencies": {
"debug": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"@kwsites/promise-deferred": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz",
"integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw=="
},
"@octokit/auth-token": {
"version": "2.4.5",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz",
"integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==",
"requires": {
"@octokit/types": "^6.0.3"
}
},
"@octokit/core": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.5.1.tgz",
"integrity": "sha512-omncwpLVxMP+GLpLPgeGJBF6IWJFjXDS5flY5VbppePYX9XehevbDykRH9PdCdvqt9TS5AOTiDide7h0qrkHjw==",
"requires": {
"@octokit/auth-token": "^2.4.4",
"@octokit/graphql": "^4.5.8",
"@octokit/request": "^5.6.0",
"@octokit/request-error": "^2.0.5",
"@octokit/types": "^6.0.3",
"before-after-hook": "^2.2.0",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/endpoint": {
"version": "6.0.12",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz",
"integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==",
"requires": {
"@octokit/types": "^6.0.3",
"is-plain-object": "^5.0.0",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/graphql": {
"version": "4.8.0",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz",
"integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==",
"requires": {
"@octokit/request": "^5.6.0",
"@octokit/types": "^6.0.3",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/openapi-types": {
"version": "10.1.1",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.1.1.tgz",
"integrity": "sha512-ygp/6r25Ezb1CJuVMnFfOsScEtPF0zosdTJDZ7mZ+I8IULl7DP1BS5ZvPRwglcarGPXOvS5sHdR0bjnVDDfQdQ=="
},
"@octokit/plugin-paginate-rest": {
"version": "2.16.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.0.tgz",
"integrity": "sha512-8YYzALPMvEZ35kgy5pdYvQ22Roz+BIuEaedO575GwE2vb/ACDqQn0xQrTJR4tnZCJn7pi8+AWPVjrFDaERIyXQ==",
"requires": {
"@octokit/types": "^6.26.0"
}
},
"@octokit/plugin-request-log": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz",
"integrity": "sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA=="
},
"@octokit/plugin-rest-endpoint-methods": {
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.10.1.tgz",
"integrity": "sha512-Rf1iMl40I0dIxjh1g32qZ6Ym/uT8QWZMm2vYGG5Vi8SX1MwZvbuxEGXYgmzTUWSD3PYWSLilE2+4L8kmdLGTMg==",
"requires": {
"@octokit/types": "^6.27.0",
"deprecation": "^2.3.1"
}
},
"@octokit/request": {
"version": "5.6.1",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.1.tgz",
"integrity": "sha512-Ls2cfs1OfXaOKzkcxnqw5MR6drMA/zWX/LIS/p8Yjdz7QKTPQLMsB3R+OvoxE6XnXeXEE2X7xe4G4l4X0gRiKQ==",
"requires": {
"@octokit/endpoint": "^6.0.1",
"@octokit/request-error": "^2.1.0",
"@octokit/types": "^6.16.1",
"is-plain-object": "^5.0.0",
"node-fetch": "^2.6.1",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/request-error": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz",
"integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==",
"requires": {
"@octokit/types": "^6.0.3",
"deprecation": "^2.0.0",
"once": "^1.4.0"
}
},
"@octokit/rest": {
"version": "18.10.0",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.10.0.tgz",
"integrity": "sha512-esHR5OKy38bccL/sajHqZudZCvmv4yjovMJzyXlphaUo7xykmtOdILGJ3aAm0mFHmMLmPFmDMJXf39cAjNJsrw==",
"requires": {
"@octokit/core": "^3.5.1",
"@octokit/plugin-paginate-rest": "^2.16.0",
"@octokit/plugin-request-log": "^1.0.4",
"@octokit/plugin-rest-endpoint-methods": "^5.9.0"
}
},
"@octokit/types": {
"version": "6.27.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.27.0.tgz",
"integrity": "sha512-ha27f8DToxXBPEJdzHCCuqpw7AgKfjhWGdNf3yIlBAhAsaexBXTfWw36zNSsncALXGvJq4EjLy1p3Wz45Aqb4A==",
"requires": {
"@octokit/openapi-types": "^10.1.0"
}
},
"@sindresorhus/is": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
@@ -357,6 +496,11 @@
"tweetnacl": "^0.14.3"
}
},
"before-after-hook": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz",
"integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ=="
},
"bignumber.js": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz",
@@ -807,6 +951,11 @@
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
},
"des.js": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz",
@@ -1561,6 +1710,11 @@
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
"integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4="
},
"is-plain-object": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
},
"is-regex": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
@@ -2335,6 +2489,31 @@
"simple-concat": "^1.0.0"
}
},
"simple-git": {
"version": "2.45.1",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-2.45.1.tgz",
"integrity": "sha512-NmEoThiLTJxl26WNtZxtJTue18ReTcSrf3so5vJG/O8KY9uMxH+yAhXV/DElBJyOYZrrBbVsH8JOFxgENdc9Xg==",
"requires": {
"@kwsites/file-exists": "^1.1.1",
"@kwsites/promise-deferred": "^1.1.1",
"debug": "^4.3.1"
},
"dependencies": {
"debug": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"sshpk": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
@@ -2570,6 +2749,11 @@
"which-boxed-primitive": "^1.0.2"
}
},
"universal-user-agent": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
},
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
+2
View File
@@ -1,8 +1,10 @@
{
"dependencies": {
"@octokit/rest": "^18.10.0",
"http": "0.0.1-security",
"node-fetch": "^2.6.1",
"open": "^8.2.1",
"simple-git": "^2.45.1",
"web3": "^1.5.2",
"ws": "^8.2.1"
}