diff --git a/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingOrders.js b/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingOrders.js index a821d7440..693af35df 100644 --- a/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingOrders.js +++ b/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingOrders.js @@ -17,7 +17,7 @@ exports.newAlgorithmicTradingBotModulesTradingOrders = function (processIndex) { let sessionParameters let exchangeAPIModuleObject = TS.projects.algorithmicTrading.botModules.exchangeAPI.newAlgorithmicTradingBotModulesExchangeAPI(processIndex) - let announcementsModuleObject = TS.projects.foundations.botModules.announcements.newFoundationsBotModulesAnnouncements(processIndex) + let announcementsModuleObject = TS.projects.socialBots.botModules.announcements.newSocialBotsBotModulesAnnouncements(processIndex) return thisObject diff --git a/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingStages.js b/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingStages.js index a1e1a0de1..180cd85bb 100644 --- a/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingStages.js +++ b/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/Low-Frequency-Trading/TradingStages.js @@ -24,7 +24,7 @@ exports.newAlgorithmicTradingBotModulesTradingStages = function (processIndex) { let tradingStrategyModuleObject = TS.projects.algorithmicTrading.botModules.tradingStrategy.newAlgorithmicTradingBotModulesTradingStrategy(processIndex) let tradingPositionModuleObject = TS.projects.algorithmicTrading.botModules.tradingPosition.newAlgorithmicTradingBotModulesTradingPosition(processIndex) let tradingExecutionModuleObject = TS.projects.algorithmicTrading.botModules.tradingExecution.newAlgorithmicTradingBotModulesTradingExecution(processIndex) - let announcementsModuleObject = TS.projects.foundations.botModules.announcements.newFoundationsBotModulesAnnouncements(processIndex) + let announcementsModuleObject = TS.projects.socialBots.botModules.announcements.newSocialBotsBotModulesAnnouncements(processIndex) let snapshotsModuleObject = TS.projects.algorithmicTrading.botModules.snapshots.newAlgorithmicTradingBotModulesSnapshots(processIndex) let tradingEpisodeModuleObject = TS.projects.algorithmicTrading.botModules.tradingEpisode.newAlgorithmicTradingBotModulesTradingEpisode(processIndex) diff --git a/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/TradingSession.js b/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/TradingSession.js index d9d3586ee..7fca5136c 100644 --- a/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/TradingSession.js +++ b/Projects/Algorithmic-Trading/TS/Bot-Modules/Trading-Bot/TradingSession.js @@ -7,7 +7,7 @@ } TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SOCIAL_BOTS_MODULE = - TS.projects.foundations.botModules.socialBots.newFoundationsBotModulesSocialBots(processIndex) + TS.projects.socialBots.botModules.socialBots.newSocialBotsBotModulesSocialBots(processIndex) return thisObject; diff --git a/Projects/Foundations/Schemas/App-Schema/back-learning-session.json b/Projects/Foundations/Schemas/App-Schema/back-learning-session.json index a2aa63be7..5c51f17a2 100644 --- a/Projects/Foundations/Schemas/App-Schema/back-learning-session.json +++ b/Projects/Foundations/Schemas/App-Schema/back-learning-session.json @@ -43,6 +43,13 @@ "dontShowAtFullscreen": true, "actionFunction": "uiObject.configEditor.activate" }, + { + "action": "Add UI Object", + "label": "Add Social Bots", + "relatedUiObject": "Social Bots", + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" + }, { "action": "Add Missing Children", "label": "Add Missing Children", @@ -96,7 +103,8 @@ { "name": "socialBots", "type": "node", - "childType": "Social Bots" + "childType": "Social Bots", + "project": "Social-Bots" } ], "propertyNameAtParent": "session" diff --git a/Projects/Foundations/Schemas/App-Schema/backtesting-session.json b/Projects/Foundations/Schemas/App-Schema/backtesting-session.json index f71d6bd28..c6f168a55 100644 --- a/Projects/Foundations/Schemas/App-Schema/backtesting-session.json +++ b/Projects/Foundations/Schemas/App-Schema/backtesting-session.json @@ -47,7 +47,8 @@ "action": "Add UI Object", "label": "Add Social Bots", "relatedUiObject": "Social Bots", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Add Missing Children", @@ -105,7 +106,8 @@ { "name": "socialBots", "type": "node", - "childType": "Social Bots" + "childType": "Social Bots", + "project": "Social-Bots" } ], "propertyNameAtParent": "session" diff --git a/Projects/Foundations/Schemas/App-Schema/cancel-order-event.json b/Projects/Foundations/Schemas/App-Schema/cancel-order-event.json index 84611a87c..105e60b90 100644 --- a/Projects/Foundations/Schemas/App-Schema/cancel-order-event.json +++ b/Projects/Foundations/Schemas/App-Schema/cancel-order-event.json @@ -11,7 +11,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -38,7 +39,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" } ], "propertyNameAtParent": "cancelOrderEvent" diff --git a/Projects/Foundations/Schemas/App-Schema/close-stage-event.json b/Projects/Foundations/Schemas/App-Schema/close-stage-event.json index 4e1009380..6608cda87 100644 --- a/Projects/Foundations/Schemas/App-Schema/close-stage-event.json +++ b/Projects/Foundations/Schemas/App-Schema/close-stage-event.json @@ -11,7 +11,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -38,7 +39,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" } ], "propertyNameAtParent": "closeStageEvent" diff --git a/Projects/Foundations/Schemas/App-Schema/close-stage.json b/Projects/Foundations/Schemas/App-Schema/close-stage.json index 2a976b11d..96fcfb310 100644 --- a/Projects/Foundations/Schemas/App-Schema/close-stage.json +++ b/Projects/Foundations/Schemas/App-Schema/close-stage.json @@ -18,7 +18,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -63,7 +64,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" }, { "name": "userDefinedCode", diff --git a/Projects/Foundations/Schemas/App-Schema/create-order-event.json b/Projects/Foundations/Schemas/App-Schema/create-order-event.json index f53293ca5..beb2eb7fd 100644 --- a/Projects/Foundations/Schemas/App-Schema/create-order-event.json +++ b/Projects/Foundations/Schemas/App-Schema/create-order-event.json @@ -11,7 +11,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -38,7 +39,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" } ], "propertyNameAtParent": "createOrderEvent" diff --git a/Projects/Foundations/Schemas/App-Schema/forward-testing-session.json b/Projects/Foundations/Schemas/App-Schema/forward-testing-session.json index 8a3c088d8..282bd4532 100644 --- a/Projects/Foundations/Schemas/App-Schema/forward-testing-session.json +++ b/Projects/Foundations/Schemas/App-Schema/forward-testing-session.json @@ -47,7 +47,8 @@ "action": "Add UI Object", "label": "Add Social Bots", "relatedUiObject": "Social Bots", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Add Missing Children", @@ -108,7 +109,8 @@ { "name": "socialBots", "type": "node", - "childType": "Social Bots" + "childType": "Social Bots", + "project": "Social-Bots" } ], "propertyNameAtParent": "session" diff --git a/Projects/Foundations/Schemas/App-Schema/live-learning-session.json b/Projects/Foundations/Schemas/App-Schema/live-learning-session.json index 0f470182a..e53108b38 100644 --- a/Projects/Foundations/Schemas/App-Schema/live-learning-session.json +++ b/Projects/Foundations/Schemas/App-Schema/live-learning-session.json @@ -43,6 +43,13 @@ "dontShowAtFullscreen": true, "actionFunction": "uiObject.configEditor.activate" }, + { + "action": "Add UI Object", + "label": "Add Social Bots", + "relatedUiObject": "Social Bots", + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" + }, { "action": "Add Missing Children", "label": "Add Missing Children", @@ -96,7 +103,8 @@ { "name": "socialBots", "type": "node", - "childType": "Social Bots" + "childType": "Social Bots", + "project": "Social-Bots" } ], "propertyNameAtParent": "session" diff --git a/Projects/Foundations/Schemas/App-Schema/live-trading-session.json b/Projects/Foundations/Schemas/App-Schema/live-trading-session.json index d76898c43..dccbfc0f3 100644 --- a/Projects/Foundations/Schemas/App-Schema/live-trading-session.json +++ b/Projects/Foundations/Schemas/App-Schema/live-trading-session.json @@ -47,7 +47,8 @@ "action": "Add UI Object", "label": "Add Social Bots", "relatedUiObject": "Social Bots", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Add Missing Children", @@ -108,7 +109,8 @@ { "name": "socialBots", "type": "node", - "childType": "Social Bots" + "childType": "Social Bots", + "project": "Social-Bots" } ], "propertyNameAtParent": "session" diff --git a/Projects/Foundations/Schemas/App-Schema/manage-stage.json b/Projects/Foundations/Schemas/App-Schema/manage-stage.json index 128eb5c14..5476e35f9 100644 --- a/Projects/Foundations/Schemas/App-Schema/manage-stage.json +++ b/Projects/Foundations/Schemas/App-Schema/manage-stage.json @@ -11,7 +11,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -44,7 +45,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" }, { "name": "userDefinedCode", diff --git a/Projects/Foundations/Schemas/App-Schema/move-to-phase-event.json b/Projects/Foundations/Schemas/App-Schema/move-to-phase-event.json index 1fffd486f..34a979f2a 100644 --- a/Projects/Foundations/Schemas/App-Schema/move-to-phase-event.json +++ b/Projects/Foundations/Schemas/App-Schema/move-to-phase-event.json @@ -11,7 +11,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -41,7 +42,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" } ], "propertyNameAtParent": "moveToPhaseEvents" diff --git a/Projects/Foundations/Schemas/App-Schema/next-phase-event.json b/Projects/Foundations/Schemas/App-Schema/next-phase-event.json index 17c5a63df..c649534d0 100644 --- a/Projects/Foundations/Schemas/App-Schema/next-phase-event.json +++ b/Projects/Foundations/Schemas/App-Schema/next-phase-event.json @@ -11,7 +11,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -38,7 +39,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" } ], "propertyNameAtParent": "nextPhaseEvent" diff --git a/Projects/Foundations/Schemas/App-Schema/open-stage.json b/Projects/Foundations/Schemas/App-Schema/open-stage.json index 0a0badc3e..76ec0bfb3 100644 --- a/Projects/Foundations/Schemas/App-Schema/open-stage.json +++ b/Projects/Foundations/Schemas/App-Schema/open-stage.json @@ -18,7 +18,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -63,7 +64,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" }, { "name": "userDefinedCode", diff --git a/Projects/Foundations/Schemas/App-Schema/paper-trading-session.json b/Projects/Foundations/Schemas/App-Schema/paper-trading-session.json index 88f5ff479..472a246c8 100644 --- a/Projects/Foundations/Schemas/App-Schema/paper-trading-session.json +++ b/Projects/Foundations/Schemas/App-Schema/paper-trading-session.json @@ -47,7 +47,8 @@ "action": "Add UI Object", "label": "Add Social Bots", "relatedUiObject": "Social Bots", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Add Missing Children", @@ -108,7 +109,8 @@ { "name": "socialBots", "type": "node", - "childType": "Social Bots" + "childType": "Social Bots", + "project": "Social-Bots" } ], "propertyNameAtParent": "session" diff --git a/Projects/Foundations/Schemas/App-Schema/phase.json b/Projects/Foundations/Schemas/App-Schema/phase.json index 5d21bd71c..613eebef0 100644 --- a/Projects/Foundations/Schemas/App-Schema/phase.json +++ b/Projects/Foundations/Schemas/App-Schema/phase.json @@ -21,13 +21,15 @@ "action": "Add UI Object", "label": "Add Move To Phase Event", "relatedUiObject": "Move To Phase Event", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -65,7 +67,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" } ], "propertyNameAtParent": "phases" diff --git a/Projects/Foundations/Schemas/App-Schema/take-position-event.json b/Projects/Foundations/Schemas/App-Schema/take-position-event.json index 6f430c606..0dc5d5415 100644 --- a/Projects/Foundations/Schemas/App-Schema/take-position-event.json +++ b/Projects/Foundations/Schemas/App-Schema/take-position-event.json @@ -11,7 +11,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -38,7 +39,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" } ], "propertyNameAtParent": "takePosition" diff --git a/Projects/Foundations/Schemas/App-Schema/trigger-off-event.json b/Projects/Foundations/Schemas/App-Schema/trigger-off-event.json index 0869afd50..d31f72585 100644 --- a/Projects/Foundations/Schemas/App-Schema/trigger-off-event.json +++ b/Projects/Foundations/Schemas/App-Schema/trigger-off-event.json @@ -11,7 +11,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -38,7 +39,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" } ], "propertyNameAtParent": "triggerOff" diff --git a/Projects/Foundations/Schemas/App-Schema/trigger-on-event.json b/Projects/Foundations/Schemas/App-Schema/trigger-on-event.json index b397722a0..da937a55b 100644 --- a/Projects/Foundations/Schemas/App-Schema/trigger-on-event.json +++ b/Projects/Foundations/Schemas/App-Schema/trigger-on-event.json @@ -11,7 +11,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -38,7 +39,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" } ], "propertyNameAtParent": "triggerOn" diff --git a/Projects/Foundations/Schemas/App-Schema/trigger-stage.json b/Projects/Foundations/Schemas/App-Schema/trigger-stage.json index 0864e2d95..aa8496136 100644 --- a/Projects/Foundations/Schemas/App-Schema/trigger-stage.json +++ b/Projects/Foundations/Schemas/App-Schema/trigger-stage.json @@ -11,7 +11,8 @@ "action": "Add UI Object", "label": "Add Announcement", "relatedUiObject": "Announcement", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Delete UI Object", @@ -50,7 +51,8 @@ { "name": "announcements", "type": "array", - "childType": "Announcement" + "childType": "Announcement", + "project": "Social-Bots" }, { "name": "userDefinedCode", diff --git a/Projects/Foundations/UI/Spaces/Floating-Space/CircularMenuItem.js b/Projects/Foundations/UI/Spaces/Floating-Space/CircularMenuItem.js index 9f4a3e5d8..abb7b2cc1 100644 --- a/Projects/Foundations/UI/Spaces/Floating-Space/CircularMenuItem.js +++ b/Projects/Foundations/UI/Spaces/Floating-Space/CircularMenuItem.js @@ -112,7 +112,7 @@ function newCircularMenuItem() { iconPhysics() if (thisObject.icon === undefined) { - console.log('[ERROR] newCircularMenuItem -> initialize -> err = Icon not found, Action: "' + thisObject.action + '", relatedUiObject: "' + thisObject.relatedUiObject +'", label: "' + thisObject.label + '"') + console.log('[ERROR] newCircularMenuItem -> initialize -> err = Icon not found, Action: "' + thisObject.action + '", relatedUiObject: "' + thisObject.relatedUiObject + '", label: "' + thisObject.label + '"') } selfMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) @@ -379,7 +379,21 @@ function newCircularMenuItem() { } /* Execute the action and wait for callbacks to update our statuus. */ - thisObject.actionFunction({ node: thisObject.payload.node, name: thisObject.action, project: thisObject.actionProject, relatedNodeType: thisObject.relatedUiObject, callBackFunction: onPrimaryCallBack }) + let relatedNodeProject = thisObject.actionProject + if (thisObject.relatedUiObjectProject !== undefined) { + relatedNodeProject = thisObject.relatedUiObjectProject + } + + thisObject.actionFunction( + { + node: thisObject.payload.node, + name: thisObject.action, + project: thisObject.actionProject, + relatedNodeType: thisObject.relatedUiObject, + relatedNodeProject: relatedNodeProject, + callBackFunction: onPrimaryCallBack + } + ) return } if (temporaryStatus === STATUS_PRIMARY_WORK_DONE && thisObject.secondaryAction !== undefined) { @@ -502,7 +516,7 @@ function newCircularMenuItem() { if (thisObject.icon === undefined) { thisObject.icon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName('Foundations', 'missing-image') } - + if (thisObject.icon !== undefined) { if (thisObject.icon.canDrawIcon === true && thisObject.currentRadius > 1 && thisObject.isDeployed === true) { browserCanvasContext.drawImage(thisObject.icon, menuPosition.x - iconSize, menuPosition.y - iconSize, iconSize * 2, iconSize * 2) diff --git a/Projects/Machine-Learning/TS/Bot-Modules/Learning-Bot/LearningSession.js b/Projects/Machine-Learning/TS/Bot-Modules/Learning-Bot/LearningSession.js index 50459a29f..58df9554f 100644 --- a/Projects/Machine-Learning/TS/Bot-Modules/Learning-Bot/LearningSession.js +++ b/Projects/Machine-Learning/TS/Bot-Modules/Learning-Bot/LearningSession.js @@ -7,7 +7,7 @@ } TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SOCIAL_BOTS_MODULE = - TS.projects.foundations.botModules.socialBots.newFoundationsBotModulesSocialBots(processIndex) + TS.projects.socialBots.botModules.socialBots.newSocialBotsBotModulesSocialBots(processIndex) return thisObject; diff --git a/Projects/ProjectsSchema.json b/Projects/ProjectsSchema.json index a8544b17a..8a72cd471 100644 --- a/Projects/ProjectsSchema.json +++ b/Projects/ProjectsSchema.json @@ -331,11 +331,6 @@ "name": "Workspace Functions", "propertyName": "workspaceFunctions", "functionName": "newFoundationsFunctionLibraryWorkspaceFunctions" - }, - { - "name": "Social Bots Functions", - "propertyName": "socialBotsFunctions", - "functionName": "newFoundationsFunctionLibrarySocialBotsFunctions" } ], "utilities": [ @@ -739,50 +734,7 @@ "fileName": "ProcessOutput.js" } ], - "botModules": [ - { - "name": "Announcements", - "propertyName": "announcements", - "functionName": "newFoundationsBotModulesAnnouncements", - "fileName": "Announcements.js", - "folderName": "Trading-Bot/Announcements" - }, - { - "name": "Social Bots", - "propertyName": "socialBots", - "functionName": "newFoundationsBotModulesSocialBots", - "fileName": "SocialBots.js", - "folderName": "Trading-Bot/Announcements" - }, - { - "name": "Telegram Bot", - "propertyName": "telegramBot", - "functionName": "newFoundationsBotModulesTelegramBot", - "fileName": "TelegramBot.js", - "folderName": "Trading-Bot/Announcements" - }, - { - "name": "Discord Bot", - "propertyName": "discordBot", - "functionName": "newFoundationsBotModulesDiscordBot", - "fileName": "DiscordBot.js", - "folderName": "Trading-Bot/Announcements" - }, - { - "name": "Slack Bot", - "propertyName": "slackBot", - "functionName": "newFoundationsBotModulesSlackBot", - "fileName": "SlackBot.js", - "folderName": "Trading-Bot/Announcements" - }, - { - "name": "Twitter Bot", - "propertyName": "twitterBot", - "functionName": "newFoundationsBotModulesTwitterBot", - "fileName": "TwitterBot.js", - "folderName": "Trading-Bot/Announcements" - } - ] + "botModules": [] }, "PL": { "utilities": [ @@ -1599,5 +1551,76 @@ } ] } + }, + { + "name": "Social-Bots", + "propertyName": "socialBots", + "UI": { + "functionLibraries": [ + { + "name": "Social Bots Functions", + "propertyName": "socialBotsFunctions", + "functionName": "newSocialBotsFunctionLibrarySocialBotsFunctions" + } + ], + "utilities": [] + }, + "TS": { + "botModules": [ + { + "name": "Announcements", + "propertyName": "announcements", + "functionName": "newSocialBotsBotModulesAnnouncements", + "fileName": "Announcements.js", + "folderName": "" + }, + { + "name": "Social Bots", + "propertyName": "socialBots", + "functionName": "newSocialBotsBotModulesSocialBots", + "fileName": "SocialBots.js", + "folderName": "" + }, + { + "name": "Telegram Bot", + "propertyName": "telegramBot", + "functionName": "newSocialBotsBotModulesTelegramBot", + "fileName": "TelegramBot.js", + "folderName": "" + }, + { + "name": "Discord Bot", + "propertyName": "discordBot", + "functionName": "newSocialBotsBotModulesDiscordBot", + "fileName": "DiscordBot.js", + "folderName": "" + }, + { + "name": "Slack Bot", + "propertyName": "slackBot", + "functionName": "newSocialBotsBotModulesSlackBot", + "fileName": "SlackBot.js", + "folderName": "" + }, + { + "name": "Twitter Bot", + "propertyName": "twitterBot", + "functionName": "newSocialBotsBotModulesTwitterBot", + "fileName": "TwitterBot.js", + "folderName": "" + } + ] + } + }, + { + "name": "Visual-Scripting", + "propertyName": "visualScripting", + "UI": { + "functionLibraries": [], + "utilities": [] + }, + "TS": { + "botModules": [] + } } ] \ No newline at end of file diff --git a/Projects/Foundations/Icons/Announcement/announcement-condition.png b/Projects/Social-Bots/Icons/Announcement/announcement-condition.png similarity index 100% rename from Projects/Foundations/Icons/Announcement/announcement-condition.png rename to Projects/Social-Bots/Icons/Announcement/announcement-condition.png diff --git a/Projects/Foundations/Icons/Announcement/announcement-formula.png b/Projects/Social-Bots/Icons/Announcement/announcement-formula.png similarity index 100% rename from Projects/Foundations/Icons/Announcement/announcement-formula.png rename to Projects/Social-Bots/Icons/Announcement/announcement-formula.png diff --git a/Projects/Foundations/Icons/Announcement/announcement.png b/Projects/Social-Bots/Icons/Announcement/announcement.png similarity index 100% rename from Projects/Foundations/Icons/Announcement/announcement.png rename to Projects/Social-Bots/Icons/Announcement/announcement.png diff --git a/Projects/Foundations/Icons/Announcement/discord-bot.png b/Projects/Social-Bots/Icons/Announcement/discord-bot.png similarity index 100% rename from Projects/Foundations/Icons/Announcement/discord-bot.png rename to Projects/Social-Bots/Icons/Announcement/discord-bot.png diff --git a/Projects/Social-Bots/Icons/Announcement/slack-bot.png b/Projects/Social-Bots/Icons/Announcement/slack-bot.png new file mode 100644 index 000000000..1422ddd50 Binary files /dev/null and b/Projects/Social-Bots/Icons/Announcement/slack-bot.png differ diff --git a/Projects/Foundations/Icons/Announcement/telegram-bot.png b/Projects/Social-Bots/Icons/Announcement/telegram-bot.png similarity index 100% rename from Projects/Foundations/Icons/Announcement/telegram-bot.png rename to Projects/Social-Bots/Icons/Announcement/telegram-bot.png diff --git a/Projects/Social-Bots/Icons/Announcement/twitter-bot.png b/Projects/Social-Bots/Icons/Announcement/twitter-bot.png new file mode 100644 index 000000000..c41449c12 Binary files /dev/null and b/Projects/Social-Bots/Icons/Announcement/twitter-bot.png differ diff --git a/Projects/Foundations/Icons/social-bot-command.png b/Projects/Social-Bots/Icons/social-bot-command.png similarity index 100% rename from Projects/Foundations/Icons/social-bot-command.png rename to Projects/Social-Bots/Icons/social-bot-command.png diff --git a/Projects/Foundations/Icons/social-bots.png b/Projects/Social-Bots/Icons/social-bots.png similarity index 100% rename from Projects/Foundations/Icons/social-bots.png rename to Projects/Social-Bots/Icons/social-bots.png diff --git a/Projects/Foundations/Schemas/App-Schema/announcement-condition.json b/Projects/Social-Bots/Schemas/App-Schema/announcement-condition.json similarity index 82% rename from Projects/Foundations/Schemas/App-Schema/announcement-condition.json rename to Projects/Social-Bots/Schemas/App-Schema/announcement-condition.json index 5d4a232f7..84dc7150d 100644 --- a/Projects/Foundations/Schemas/App-Schema/announcement-condition.json +++ b/Projects/Social-Bots/Schemas/App-Schema/announcement-condition.json @@ -9,7 +9,8 @@ "actionFunction": "uiObject.codeEditor.activate", "label": "Configure", "iconPathOn": "configuration", - "iconPathOff": "configuration" + "iconPathOff": "configuration", + "actionProject": "Foundations" }, { "action": "Delete UI Object", @@ -18,7 +19,8 @@ "label": "Delete", "iconPathOn": "delete-entity", "iconPathOff": "delete-entity", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" } ], "initialValues": { diff --git a/Projects/Foundations/Schemas/App-Schema/announcement-formula.json b/Projects/Social-Bots/Schemas/App-Schema/announcement-formula.json similarity index 80% rename from Projects/Foundations/Schemas/App-Schema/announcement-formula.json rename to Projects/Social-Bots/Schemas/App-Schema/announcement-formula.json index a6e1ad4dd..513014334 100644 --- a/Projects/Foundations/Schemas/App-Schema/announcement-formula.json +++ b/Projects/Social-Bots/Schemas/App-Schema/announcement-formula.json @@ -7,7 +7,8 @@ "iconPathOn": "javascript-code", "iconPathOff": "javascript-code", "dontShowAtFullscreen": true, - "actionFunction": "uiObject.formulaEditor.activate" + "actionFunction": "uiObject.formulaEditor.activate", + "actionProject": "Foundations" }, { "action": "Delete UI Object", @@ -16,7 +17,8 @@ "label": "Delete", "iconPathOn": "delete-entity", "iconPathOff": "delete-entity", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" } ], "addLeftIcons": true, diff --git a/Projects/Foundations/Schemas/App-Schema/announcement.json b/Projects/Social-Bots/Schemas/App-Schema/announcement.json similarity index 75% rename from Projects/Foundations/Schemas/App-Schema/announcement.json rename to Projects/Social-Bots/Schemas/App-Schema/announcement.json index aaba138aa..e308e50a5 100644 --- a/Projects/Foundations/Schemas/App-Schema/announcement.json +++ b/Projects/Social-Bots/Schemas/App-Schema/announcement.json @@ -9,7 +9,8 @@ "actionFunction": "uiObject.configEditor.activate", "label": "Configure", "iconPathOn": "configuration", - "iconPathOff": "configuration" + "iconPathOff": "configuration", + "actionProject": "Foundations" }, { "action": "Add UI Object", @@ -17,7 +18,9 @@ "propertyToCheckFor": "announcementFormula", "label": "Add Announcement Formula", "relatedUiObject": "Announcement Formula", - "actionFunction": "payload.executeAction" + "relatedUiObjectProject": "Social-Bots", + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" }, { "action": "Add UI Object", @@ -25,7 +28,9 @@ "propertyToCheckFor": "announcementCondition", "label": "Add Announcement Condition", "relatedUiObject": "Announcement Condition", - "actionFunction": "payload.executeAction" + "relatedUiObjectProject": "Social-Bots", + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" }, { "action": "Delete UI Object", @@ -34,7 +39,8 @@ "label": "Delete", "iconPathOn": "delete-entity", "iconPathOff": "delete-entity", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" } ], "initialValues": { @@ -50,13 +56,15 @@ "name": "announcementFormula", "type": "node", "childType": "Announcement Formula", - "autoAdd": true + "autoAdd": true, + "project": "Social-Bots" }, { "name": "announcementCondition", "type": "node", "childType": "Announcement Condition", - "autoAdd": true + "autoAdd": true, + "project": "Social-Bots" } ], "propertyNameAtParent": "announcements" diff --git a/Projects/Foundations/Schemas/App-Schema/discord-bot.json b/Projects/Social-Bots/Schemas/App-Schema/discord-bot.json similarity index 80% rename from Projects/Foundations/Schemas/App-Schema/discord-bot.json rename to Projects/Social-Bots/Schemas/App-Schema/discord-bot.json index 7209448d2..d96f4890b 100644 --- a/Projects/Foundations/Schemas/App-Schema/discord-bot.json +++ b/Projects/Social-Bots/Schemas/App-Schema/discord-bot.json @@ -9,14 +9,16 @@ "actionFunction": "uiObject.configEditor.activate", "label": "Configure", "iconPathOn": "configuration", - "iconPathOff": "configuration" + "iconPathOff": "configuration", + "actionProject": "Foundations" }, { "action": "Send Discord Test Message", "label": "Send Discord Test Message", "iconPathOn": "test-entity", "iconPathOff": "test-entity", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "SocialBots" }, { "action": "Delete UI Object", @@ -25,7 +27,8 @@ "label": "Delete", "iconPathOn": "delete-entity", "iconPathOff": "delete-entity", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" } ], "initialValues": { diff --git a/Projects/Foundations/Schemas/App-Schema/slack-bot.json b/Projects/Social-Bots/Schemas/App-Schema/slack-bot.json similarity index 79% rename from Projects/Foundations/Schemas/App-Schema/slack-bot.json rename to Projects/Social-Bots/Schemas/App-Schema/slack-bot.json index d672e4b2d..cba595d2f 100644 --- a/Projects/Foundations/Schemas/App-Schema/slack-bot.json +++ b/Projects/Social-Bots/Schemas/App-Schema/slack-bot.json @@ -9,14 +9,16 @@ "actionFunction": "uiObject.configEditor.activate", "label": "Configure", "iconPathOn": "configuration", - "iconPathOff": "configuration" + "iconPathOff": "configuration", + "actionProject": "Foundations" }, { "action": "Send Slack Test Message", "label": "Send Slack Test Message", "iconPathOn": "test-entity", "iconPathOff": "test-entity", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "SocialBots" }, { "action": "Delete UI Object", @@ -25,7 +27,8 @@ "label": "Delete", "iconPathOn": "delete-entity", "iconPathOff": "delete-entity", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" } ], "initialValues": { diff --git a/Projects/Foundations/Schemas/App-Schema/social-bot-command.json b/Projects/Social-Bots/Schemas/App-Schema/social-bot-command.json similarity index 78% rename from Projects/Foundations/Schemas/App-Schema/social-bot-command.json rename to Projects/Social-Bots/Schemas/App-Schema/social-bot-command.json index dd25f533a..cace9448d 100644 --- a/Projects/Foundations/Schemas/App-Schema/social-bot-command.json +++ b/Projects/Social-Bots/Schemas/App-Schema/social-bot-command.json @@ -9,7 +9,8 @@ "actionFunction": "uiObject.configEditor.activate", "label": "Configure", "iconPathOn": "configuration", - "iconPathOff": "configuration" + "iconPathOff": "configuration", + "actionProject": "Foundations" }, { "action": "Add UI Object", @@ -17,7 +18,8 @@ "propertyToCheckFor": "formula", "label": "Add Formula", "relatedUiObject": "Formula", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" }, { "action": "Delete UI Object", @@ -26,7 +28,8 @@ "label": "Delete", "iconPathOn": "delete-entity", "iconPathOff": "delete-entity", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" } ], "initialValues": { @@ -42,7 +45,8 @@ "name": "formula", "type": "node", "childType": "Formula", - "autoAdd": true + "autoAdd": true, + "project": "Foundations" } ], "propertyNameAtParent": "socialBotCommand" diff --git a/Projects/Social-Bots/Schemas/App-Schema/social-bots.json b/Projects/Social-Bots/Schemas/App-Schema/social-bots.json new file mode 100644 index 000000000..ecb7f1c91 --- /dev/null +++ b/Projects/Social-Bots/Schemas/App-Schema/social-bots.json @@ -0,0 +1,83 @@ +{ + "type": "Social Bots", + "menuItems": [ + { + "action": "Add UI Object", + "label": "Add Telegram Bot", + "relatedUiObject": "Telegram Bot", + "actionFunction": "payload.executeAction", + "actionProject": "Foundations", + "relatedUiObjectProject": "Social-Bots" + }, + { + "action": "Add UI Object", + "label": "Add Discord Bot", + "relatedUiObject": "Discord Bot", + "actionFunction": "payload.executeAction", + "actionProject": "Foundations", + "relatedUiObjectProject": "Social-Bots" + }, + { + "action": "Add UI Object", + "label": "Add Slack Bot", + "relatedUiObject": "Slack Bot", + "actionFunction": "payload.executeAction", + "actionProject": "Foundations", + "relatedUiObjectProject": "Social-Bots" + }, + { + "action": "Add UI Object", + "label": "Add Twitter Bot", + "relatedUiObject": "Twitter Bot", + "actionFunction": "payload.executeAction", + "actionProject": "Foundations", + "relatedUiObjectProject": "Social-Bots" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" + } + ], + "addLeftIcons": true, + "level": 4, + "attachingRules": { + "compatibleTypes": "->Backtesting Session->Live Trading Session->Paper Trading Session->Forward Testing Session->Back Learning Session->Live Learning Session->" + }, + "childrenNodesProperties": [ + { + "name": "telegramBots", + "type": "array", + "childType": "Telegram Bot", + "autoAdd": true, + "project": "Social-Bots" + }, + { + "name": "discordBots", + "type": "array", + "childType": "Discord Bot", + "autoAdd": true, + "project": "Social-Bots" + }, + { + "name": "slackBots", + "type": "array", + "childType": "Slack Bot", + "autoAdd": true, + "project": "Social-Bots" + }, + { + "name": "twitterBots", + "type": "array", + "childType": "Twitter Bot", + "autoAdd": true, + "project": "Social-Bots" + } + ], + "propertyNameAtParent": "socialBots" +} \ No newline at end of file diff --git a/Projects/Foundations/Schemas/App-Schema/telegram-bot.json b/Projects/Social-Bots/Schemas/App-Schema/telegram-bot.json similarity index 75% rename from Projects/Foundations/Schemas/App-Schema/telegram-bot.json rename to Projects/Social-Bots/Schemas/App-Schema/telegram-bot.json index 589ad90a7..51c4345d5 100644 --- a/Projects/Foundations/Schemas/App-Schema/telegram-bot.json +++ b/Projects/Social-Bots/Schemas/App-Schema/telegram-bot.json @@ -9,20 +9,24 @@ "actionFunction": "uiObject.configEditor.activate", "label": "Configure", "iconPathOn": "configuration", - "iconPathOff": "configuration" + "iconPathOff": "configuration", + "actionProject": "Foundations" }, { "action": "Add UI Object", "label": "Add Social Bot Command", "relatedUiObject": "Social Bot Command", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "Foundations", + "relatedUiObjectProject": "Social-Bots" }, { "action": "Send Telegram Test Message", "label": "Send Telegram Test Message", "iconPathOn": "test-entity", "iconPathOff": "test-entity", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "SocialBots" }, { "action": "Delete UI Object", @@ -31,7 +35,8 @@ "label": "Delete", "iconPathOn": "delete-entity", "iconPathOff": "delete-entity", - "actionFunction": "payload.executeAction" + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" } ], "initialValues": { @@ -47,7 +52,8 @@ "name": "socialBotCommand", "type": "array", "childType": "Social Bot Command", - "autoAdd": false + "autoAdd": false, + "project": "Social-Bots" } ], "propertyNameAtParent": "telegramBots" diff --git a/Projects/Social-Bots/Schemas/App-Schema/twitter-bot.json b/Projects/Social-Bots/Schemas/App-Schema/twitter-bot.json new file mode 100644 index 000000000..c5f07af3b --- /dev/null +++ b/Projects/Social-Bots/Schemas/App-Schema/twitter-bot.json @@ -0,0 +1,60 @@ +{ + "type": "Twitter Bot", + "editors": { + "config": true + }, + "menuItems": [ + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration", + "actionProject": "Foundations" + }, + { + "action": "Add UI Object", + "label": "Add Social Bot Command", + "relatedUiObject": "Social Bot Command", + "actionFunction": "payload.executeAction", + "actionProject": "Foundations", + "relatedUiObjectProject": "Social-Bots" + }, + { + "action": "Send Twitter Test Message", + "label": "Send Twitter Test Message", + "iconPathOn": "test-entity", + "iconPathOff": "test-entity", + "actionFunction": "payload.executeAction", + "actionProject": "SocialBots" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction", + "actionProject": "Foundations" + } + ], + "initialValues": { + "config": "{ \n\"botToken\": \"Paste the bot token obtained from Twitter \",\n}" + }, + "addLeftIcons": true, + "level": 3, + "attachingRules": { + "compatibleTypes": "->Social Bots->" + }, + "childrenNodesProperties": [ + { + "name": "socialBotCommand", + "type": "array", + "childType": "Social Bot Command", + "autoAdd": false, + "project": "Social-Bots" + } + ], + "propertyNameAtParent": "twitterBots" +} \ No newline at end of file diff --git a/Projects/Foundations/Schemas/Docs-Nodes/A/Announcement/Announcement-Condition/announcement-condition.json b/Projects/Social-Bots/Schemas/Docs-Nodes/A/Announcement/Announcement-Condition/announcement-condition.json similarity index 100% rename from Projects/Foundations/Schemas/Docs-Nodes/A/Announcement/Announcement-Condition/announcement-condition.json rename to Projects/Social-Bots/Schemas/Docs-Nodes/A/Announcement/Announcement-Condition/announcement-condition.json diff --git a/Projects/Foundations/Schemas/Docs-Nodes/A/Announcement/Announcement-Formula/announcement-formula.json b/Projects/Social-Bots/Schemas/Docs-Nodes/A/Announcement/Announcement-Formula/announcement-formula.json similarity index 100% rename from Projects/Foundations/Schemas/Docs-Nodes/A/Announcement/Announcement-Formula/announcement-formula.json rename to Projects/Social-Bots/Schemas/Docs-Nodes/A/Announcement/Announcement-Formula/announcement-formula.json diff --git a/Projects/Foundations/Schemas/Docs-Nodes/A/Announcement/Announcement/announcement.json b/Projects/Social-Bots/Schemas/Docs-Nodes/A/Announcement/Announcement/announcement.json similarity index 100% rename from Projects/Foundations/Schemas/Docs-Nodes/A/Announcement/Announcement/announcement.json rename to Projects/Social-Bots/Schemas/Docs-Nodes/A/Announcement/Announcement/announcement.json diff --git a/Projects/Foundations/Schemas/Docs-Nodes/D/Discord/Discord-Bot/discord-bot.json b/Projects/Social-Bots/Schemas/Docs-Nodes/D/Discord/Discord-Bot/discord-bot.json similarity index 100% rename from Projects/Foundations/Schemas/Docs-Nodes/D/Discord/Discord-Bot/discord-bot.json rename to Projects/Social-Bots/Schemas/Docs-Nodes/D/Discord/Discord-Bot/discord-bot.json diff --git a/Projects/Foundations/Schemas/Docs-Nodes/S/Social/Social-Bot-Command/social-bot-command.json b/Projects/Social-Bots/Schemas/Docs-Nodes/S/Social/Social-Bot-Command/social-bot-command.json similarity index 100% rename from Projects/Foundations/Schemas/Docs-Nodes/S/Social/Social-Bot-Command/social-bot-command.json rename to Projects/Social-Bots/Schemas/Docs-Nodes/S/Social/Social-Bot-Command/social-bot-command.json diff --git a/Projects/Foundations/Schemas/Docs-Nodes/S/Social/Social-Bots/social-bots.json b/Projects/Social-Bots/Schemas/Docs-Nodes/S/Social/Social-Bots/social-bots.json similarity index 100% rename from Projects/Foundations/Schemas/Docs-Nodes/S/Social/Social-Bots/social-bots.json rename to Projects/Social-Bots/Schemas/Docs-Nodes/S/Social/Social-Bots/social-bots.json diff --git a/Projects/Foundations/Schemas/Docs-Nodes/T/Telegram/Telegram-Bot/telegram-bot.json b/Projects/Social-Bots/Schemas/Docs-Nodes/T/Telegram/Telegram-Bot/telegram-bot.json similarity index 100% rename from Projects/Foundations/Schemas/Docs-Nodes/T/Telegram/Telegram-Bot/telegram-bot.json rename to Projects/Social-Bots/Schemas/Docs-Nodes/T/Telegram/Telegram-Bot/telegram-bot.json diff --git a/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/Announcements.js b/Projects/Social-Bots/TS/Bot-Modules/Announcements.js similarity index 98% rename from Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/Announcements.js rename to Projects/Social-Bots/TS/Bot-Modules/Announcements.js index d0e5821a3..509531592 100644 --- a/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/Announcements.js +++ b/Projects/Social-Bots/TS/Bot-Modules/Announcements.js @@ -1,4 +1,4 @@ -exports.newFoundationsBotModulesAnnouncements = function (processIndex) { +exports.newSocialBotsBotModulesAnnouncements = function (processIndex) { const MODULE_NAME = 'Announcements' diff --git a/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/DiscordBot.js b/Projects/Social-Bots/TS/Bot-Modules/DiscordBot.js similarity index 97% rename from Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/DiscordBot.js rename to Projects/Social-Bots/TS/Bot-Modules/DiscordBot.js index c64b09847..6f1a4c8dd 100644 --- a/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/DiscordBot.js +++ b/Projects/Social-Bots/TS/Bot-Modules/DiscordBot.js @@ -1,4 +1,4 @@ -exports.newFoundationsBotModulesDiscordBot = function (processIndex) { +exports.newSocialBotsBotModulesDiscordBot = function (processIndex) { const MODULE_NAME = 'Discord Bot' diff --git a/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/SlackBot.js b/Projects/Social-Bots/TS/Bot-Modules/SlackBot.js similarity index 97% rename from Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/SlackBot.js rename to Projects/Social-Bots/TS/Bot-Modules/SlackBot.js index 09136775a..f266debd1 100644 --- a/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/SlackBot.js +++ b/Projects/Social-Bots/TS/Bot-Modules/SlackBot.js @@ -1,4 +1,4 @@ -exports.newFoundationsBotModulesSlackBot = function (processIndex) { +exports.newSocialBotsBotModulesSlackBot = function (processIndex) { const MODULE_NAME = 'Slack Bot' diff --git a/Projects/Social-Bots/TS/Bot-Modules/SocialBots.js b/Projects/Social-Bots/TS/Bot-Modules/SocialBots.js new file mode 100644 index 000000000..4efb56d44 --- /dev/null +++ b/Projects/Social-Bots/TS/Bot-Modules/SocialBots.js @@ -0,0 +1,95 @@ +exports.newSocialBotsBotModulesSocialBots = function (processIndex) { + + const MODULE_NAME = 'Social Bots' + + let thisObject = { + sendMessage: sendMessage, + initialize: initialize, + finalize: finalize + } + + return thisObject + + function initialize() { + if (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots !== undefined) { + for (let prop in TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots) { + if (prop.toLowerCase().includes("Bots".toLowerCase())) { + for (let i = 0; i < TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop].length; i++) { + let socialBot = TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop][i] + let config = socialBot.config + let commands = socialBot.socialBotCommand + if (socialBot.type === "Telegram Bot") { + socialBot.botInstance = TS.projects.socialBots.botModules.telegramBot.newSocialBotsBotModulesTelegramBot(processIndex) + socialBot.botInstance.initialize(config, commands) + } else if (socialBot.type === "Discord Bot") { + socialBot.botInstance = TS.projects.socialBots.botModules.discordBot.newSocialBotsBotModulesDiscordBot(processIndex) + socialBot.botInstance.initialize(config) + } else if (socialBot.type === "Slack Bot") { + socialBot.botInstance = TS.projects.socialBots.botModules.slackBot.newSocialBotsBotModulesSlackBot(processIndex) + socialBot.botInstance.initialize(config) + } else if (socialBot.type === "Twitter Bot") { + socialBot.botInstance = TS.projects.socialBots.botModules.slackBot.newSocialBotsBotModulesTwitterBot(processIndex) + socialBot.botInstance.initialize(config) + } + } + } + } + + function announce(text) { + for (let prop in TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots) { + if (prop.toLowerCase().includes("Bots".toLowerCase())) { + if (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop] !== undefined) { + for (let i = 0; i < TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop].length; i++) { + let socialBot = TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop][i] + try { + if (socialBot.type === "Telegram Bot") { + socialBot.botInstance.telegramAPI.sendMessage(socialBot.botInstance.chatId, text).catch(err => TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[WARN] initialize -> initializeSocialBots -> announce -> Telegram API error -> err = " + err)) + } else if (socialBot.type === "Discord Bot" || socialBot.type === "Slack Bot") { + socialBot.botInstance.sendMessage(text).catch(err => TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[WARN] initialize -> initializeSocialBots -> announce -> Discord Bot error -> err = " + err)) + } + } catch (err) { + TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, "[WARN] initialize -> announce -> err = " + err.stack); + } + } + } + } + } + } + + TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots.announce = announce + } + } + + function finalize() { + if (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots === undefined) { return } + for (let prop in TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots) { + if (prop.includes("Bots")) { + if (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop] !== undefined) { + for (let i = 0; i < TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop].length; i++) { + let socialBot = TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop][i] + if (socialBot.type === "Telegram Bot" || socialBot.type === "Discord Bot" || socialBot.type === "Slack Bot") { + socialBot.botInstance.finalize() + } + } + } + } + } + } + + function sendMessage(message) { + if (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots !== undefined) { + for (let prop in TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots) { + if (prop.includes("Bots")) { + if (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop] !== undefined) { + for (let i = 0; i < TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop].length; i++) { + let socialBot = TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots[prop][i] + if (socialBot.type === "Telegram Bot" || socialBot.type === "Discord Bot" || socialBot.type === "Slack Bot") { + socialBot.botInstance.sendMessage(message) + } + } + } + } + } + } + } +} diff --git a/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/TelegramBot.js b/Projects/Social-Bots/TS/Bot-Modules/TelegramBot.js similarity index 98% rename from Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/TelegramBot.js rename to Projects/Social-Bots/TS/Bot-Modules/TelegramBot.js index 5fe10448c..72437baaa 100644 --- a/Projects/Foundations/TS/Bot-Modules/Trading-Bot/Announcements/TelegramBot.js +++ b/Projects/Social-Bots/TS/Bot-Modules/TelegramBot.js @@ -1,4 +1,4 @@ -exports.newFoundationsBotModulesTelegramBot = function (processIndex) { +exports.newSocialBotsBotModulesTelegramBot = function (processIndex) { const MODULE_NAME = 'Telegram Bot' diff --git a/Projects/Social-Bots/TS/Bot-Modules/TwitterBot.js b/Projects/Social-Bots/TS/Bot-Modules/TwitterBot.js new file mode 100644 index 000000000..15e248865 --- /dev/null +++ b/Projects/Social-Bots/TS/Bot-Modules/TwitterBot.js @@ -0,0 +1,97 @@ +exports.newSocialBotsBotModulesTwitterBot = function (processIndex) { + + const MODULE_NAME = 'Twitter Bot' + + let thisObject = { + taskParameters: undefined, + format: undefined, + twitterclient: undefined, + sendMessage: sendMessage, + initialize: initialize, + finalize: finalize + } + + return thisObject + + function initialize(config) { + /* Twitter Bot Initialization */ + var Twitter = SA.nodeModules.twitter + + let consumer_key = config.consumer_key + let consumer_secret = config.consumer_secret + let access_token_key = config.access_token_key + let access_token_secret = config.access_token_secret + + if (process.env.TWITTER_CONSUMER_KEY) { + consumer_key = process.env.TWITTER_CONSUMER_KEY + } + if (process.env.TWITTER_CONSUMER_SECRET) { + consumer_secret = process.env.TWITTER_CONSUMER_SECRET + } + if (process.env.TWITTER_ACCESS_TOKEN_KEY) { + access_token_key = process.env.TWITTER_ACCESS_TOKEN_KEY + } + if (process.env.TWITTER_ACCESS_TOKEN_SECRET) { + access_token_secret = process.env.TWITTER_ACCESS_TOKEN_SECRET + } + + var twitterclient = new Twitter({ + consumer_key: consumer_key, + consumer_secret: consumer_secret, + access_token_key: access_token_key, + access_token_secret: access_token_secret + }); + thisObject.twitterclient = twitterclient + + try { + thisObject.taskParameters = { + exchange: TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.name, + market: 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 + } + if (config.format === undefined) { + thisObject.format = "%{MESSAGE}" + } else { + thisObject.format = config.format + } + } catch (err) { + logError("initialize -> err = " + err.stack); + } + + } + + function finalize() {} + + function sendMessage(message) { + try { + message = formatMessage(message) + message = JSON.stringify({status: message}) + } catch (err) { + logError("announce -> Twitter JSON message error -> err = " + err) + } + + thisObject.twitterclient.post('statuses/update', message, function(error, tweet, response) { + if(error) throw error; + console.log(tweet); // Tweet body. + console.log(response); // Raw response object. + }); + + } + + function formatMessage(message) { + formattedMessage = thisObject.format + formattedMessage = formattedMessage.replace('%{EXCHANGE}', thisObject.taskParameters.exchange) + formattedMessage = formattedMessage.replace('%{MARKET}', thisObject.taskParameters.market) + formattedMessage = formattedMessage.replace('%{MESSAGE}', message) + return formattedMessage + } + + function logWarn(message) { + TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[WARN] ' + message) + } + + function logError(message) { + TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] ' + message) + } +} \ No newline at end of file diff --git a/Projects/Social-Bots/UI/Function-Libraries/ActionSwitch.js b/Projects/Social-Bots/UI/Function-Libraries/ActionSwitch.js new file mode 100644 index 000000000..747eedfbb --- /dev/null +++ b/Projects/Social-Bots/UI/Function-Libraries/ActionSwitch.js @@ -0,0 +1,43 @@ +function newSocialBotsActionSwitch() { + + let thisObject = { + executeAction: executeAction, + initialize: initialize, + finalize: finalize + } + + return thisObject + + function finalize() { + + } + + function initialize() { + /* Nothing to initialize since a Function Library does not hold any state. */ + } + + async function executeAction(action) { + switch (action.name) { + case 'Send Telegram Test Message': + { + UI.projects.socialBots.functionLibraries.socialBotsFunctions.sendTelegramTestMessage(action.node, action.callBackFunction) + } + break + case 'Send Discord Test Message': + { + UI.projects.socialBots.functionLibraries.socialBotsFunctions.sendDiscordTestMessage(action.node, action.callBackFunction) + } + break + case 'Send Slack Test Message': + { + UI.projects.socialBots.functionLibraries.socialBotsFunctions.sendSlackTestMessage(action.node, action.callBackFunction) + } + break + case 'Send Twitter Test Message': + { + UI.projects.socialBots.functionLibraries.socialBotsFunctions.sendTwitterTestMessage(action.node, action.callBackFunction) + } + break + } + } +} diff --git a/Projects/Social-Bots/UI/Function-Libraries/SocialBotsFunctions.js b/Projects/Social-Bots/UI/Function-Libraries/SocialBotsFunctions.js new file mode 100644 index 000000000..914a2d0f0 --- /dev/null +++ b/Projects/Social-Bots/UI/Function-Libraries/SocialBotsFunctions.js @@ -0,0 +1,191 @@ +function newSocialBotsFunctionLibrarySocialBotsFunctions() { + let thisObject = { + sendTelegramTestMessage: sendTelegramTestMessage, + sendDiscordTestMessage: sendDiscordTestMessage, + sendSlackTestMessage: sendSlackTestMessage, + sendTwitterTestMessage: sendTwitterTestMessage + } + + return thisObject + + function sendTelegramTestMessage(node, callBackFunction) { + + let botToken = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'botToken') + let chatId = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'chatId') + + if (botToken === undefined) { + node.payload.uiObject.setErrorMessage('botToken parameter not defined.') + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + return + } + + if (chatId === undefined) { + node.payload.uiObject.setErrorMessage('chatId parameter not defined.') + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + return + } + + let params = { + text: "Test Message from Superalgos", + chat_id: chatId + } + + httpRequestJSON(JSON.stringify(params),"https://api.telegram.org/bot" + botToken + "/sendMessage", onResponse) + + function onResponse(err) { + if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { + node.payload.uiObject.setInfoMessage('Telegram message sent.') + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE) + } else { + node.payload.uiObject.setErrorMessage('Could not send Telegram message. Error Response: ' + err.message) + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + } + } + + function httpRequestJSON(pContentToSend, pPath, callBackFunction) { + let xmlHttpRequest = new XMLHttpRequest(); + xmlHttpRequest.onreadystatechange = function () { + if (this.readyState === 4 && this.status === 200) { + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, xmlHttpRequest.responseText); + return; + } else if (this.readyState === 4 && (this.status === 404 || this.status === 401 || this.status === 400)) { + callBackFunction({ + result: "Fail", + message: JSON.parse(xmlHttpRequest.responseText).description, + code: JSON.parse(xmlHttpRequest.responseText).error_code + }); + return; + } + }; + + if (pContentToSend === undefined) { + xmlHttpRequest.open("GET", pPath, true); + xmlHttpRequest.send(); + } else { + try { + let blob = new Blob([pContentToSend], { type: 'application/json' }); + xmlHttpRequest.open("POST", pPath, true); + xmlHttpRequest.send(blob); + } catch (err) { + if (ERROR_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] callServer -> err.message = " & err.message); } + callBackFunction({ result: "Fail", message: err.message }) + } + } + } + } + + function sendDiscordTestMessage(node, callBackFunction) { + + let webhookURL = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'webhookURL') + + if (webhookURL === undefined) { + node.payload.uiObject.setErrorMessage('webhookURL parameter not defined.') + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + return + } + + let message = "Test message from Superalgos!" + + httpRequestJSON(JSON.stringify({content: message}), webhookURL, onResponse) + + function onResponse(err) { + if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { + node.payload.uiObject.setInfoMessage('Discord message sent.') + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE) + } else { + node.payload.uiObject.setErrorMessage('Could not send Discord message. Error Response: ' + err.message) + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + } + } + + function httpRequestJSON(pContentToSend, pPath, callBackFunction) { + let xmlHttpRequest = new XMLHttpRequest(); + xmlHttpRequest.onreadystatechange = function () { + if (this.readyState === 4 && this.status === 200) { + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, xmlHttpRequest.responseText); + return; + } else if (this.readyState === 4 && (this.status === 404 || this.status === 401 || this.status === 400)) { + callBackFunction({ + result: "Fail", + message: JSON.parse(xmlHttpRequest.responseText).description, + code: JSON.parse(xmlHttpRequest.responseText).error_code + }); + return; + } + }; + + if (pContentToSend === undefined) { + xmlHttpRequest.open("GET", pPath, true); + xmlHttpRequest.send(); + } else { + try { + let blob = new Blob([pContentToSend], { type: 'application/json' }); + xmlHttpRequest.open("POST", pPath, true); + xmlHttpRequest.send(blob); + } catch (err) { + if (ERROR_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] callServer -> err.message = " & err.message); } + callBackFunction({ result: "Fail", message: err.message }) + } + } + } + } + + function sendSlackTestMessage(node, callBackFunction) { + + let webhookURL = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(node.payload, 'webhookURL') + + if (webhookURL === undefined) { + node.payload.uiObject.setErrorMessage('webhookURL parameter not defined.') + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + return + } + + let message = "Test message from Superalgos!" + + httpRequestJSON(JSON.stringify({text: message}), webhookURL, onResponse) + + function onResponse(err) { + if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { + node.payload.uiObject.setInfoMessage('Slack message sent.') + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE) + } else { + node.payload.uiObject.setErrorMessage('Could not send Slack message. Error Response: ' + err.message) + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + } + } + + function httpRequestJSON(pContentToSend, pPath, callBackFunction) { + let xmlHttpRequest = new XMLHttpRequest(); + xmlHttpRequest.onreadystatechange = function () { + if (this.readyState === 4 && this.status === 200) { + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, xmlHttpRequest.responseText); + return; + } else if (this.readyState === 4 && (this.status === 404 || this.status === 401 || this.status === 400)) { + callBackFunction({ + result: "Fail", + message: xmlHttpRequest.responseText + }); + return; + } + }; + + if (pContentToSend === undefined) { + xmlHttpRequest.open("GET", pPath, true); + xmlHttpRequest.send(); + } else { + try { + let blob = new Blob([pContentToSend]); + xmlHttpRequest.open("POST", pPath, true); + xmlHttpRequest.send(blob); + } catch (err) { + if (ERROR_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] callServer -> err.message = " & err.message); } + callBackFunction({ result: "Fail", message: err.message }) + } + } + } + } + + function sendTwitterTestMessage(node, callBackFunction) { + + } +}