Available translations

Social Bot Command

social-bots.png
social-bot-command.png
The Social Bot Command node is used to configure slash commands to be interpreted and executed by Superalgos.
Overview
The Social Bot Command node is used to configure slash commands which when triggered by a user from the messaging application will be interpreted and executed by Superalgos.
  • The configuration of the Social Bot Command node defines the slash command that is registered.
  • The child Formula node defines the string which is evaluated and sent when the command is received.
The formula can contain any of the node paths from your Trading Engine and these can be entered exactly as the are within your Trading Strategy.
Example
The below example will set up the slash command "/counters" which will send a message with the current Trading Episode Counters when received.
Social Bot Command Configuration:
 {
   "name": "counters"
 }
Child Node Formula:
 "SUPERALGOS COUNTERS\n" +
 "\nPeriods: " + tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.periods.value +
 "\nStrategies: " + tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.strategies.value +
 "\nPositions: " + tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.positions.value +
 "\nOrders: " + tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.orders.value +
 "\nHits: " + tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.hits.value +
 "\nFails: " + tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.fails.value
Examples
Below are several example formulas and suggested command names.
/balances
 let baseAsset = TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName
 let quotedAsset = TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.quotedAsset.referenceParent.config.codeName

 "SUPERALGOS BALANCES\n" +
 "\nPair: " + baseAsset + "/" + quotedAsset +
 "\nBase Asset: " + tradingEngine.tradingCurrent.tradingEpisode.episodeBaseAsset.balance.value + " " + baseAsset +
 "\nQuoted Asset: " + tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value + " " + quotedAsset
/statistics
 "SUPERALGOS STATISTICS\n" +
 "\nDays: " + (tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeStatistics.days.value).toFixed(2) +
 "\nProfit Loss: " + tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeStatistics.profitLoss.value +
 "\nROI: " + (tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeStatistics.ROI.value).toFixed(2) +
 "\nAnnualized Rate Of Return: " + (tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeStatistics.annualizedRateOfReturn.value).toFixed(2) +
 "\nHit Fail: " + tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeStatistics.hitFail.value
/uptime
 let sessionBegin = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_BEGIN

 let dateBegin = new Date(sessionBegin)
 let dateNow = new Date();

 let seconds = Math.floor((dateNow - (dateBegin))/1000)
 let minutes = Math.floor(seconds/60)
 let hours = Math.floor(minutes/60)
 let days = Math.floor(hours/24)

 hours = hours-(days*24)
 minutes = minutes-(days*24*60)-(hours*60)
 seconds = seconds-(days*24*60*60)-(hours*60*60)-(minutes*60)

 let uptime = days + "D, " + hours + "H, " + minutes + "M, " + seconds + "S"

 "SUPERALGOS UPTIME\n\nUptime: " + uptime
Initial Values
These are the Initial Values for Social Bot Command configuration:
 {
    "name": "Enter the name of the command without a leading slash"
}
Examples
This is a list of properties featured by the Social Bot Command configuration. Expanding a property shows sample values for the property extracted from the current Workspace.
Social Bot Command Menu
The Social Bot Command node has the following Node Menu items:
The Configure menu item has the following properties:
  • action: Configure
  • actionFunction: uiObject.configEditor.activate
  • label: Configure
  • iconPathOn: configuration
  • iconPathOff: configuration
  • actionProject: Foundations
The Add Formula menu item has the following properties:
  • action: Add UI Object
  • disableIfPropertyIsDefined: true
  • propertyToCheckFor: formula
  • label: Add Formula
  • actionFunction: payload.executeAction
  • actionProject: Visual-Scripting
  • relatedUiObjectProject: Foundations
The Delete menu item has the following properties:
  • action: Delete UI Object
  • actionProject: Visual-Scripting
  • askConfirmation: true
  • confirmationLabel: Confirm to Delete
  • label: Delete
  • iconPathOn: delete-entity
  • iconPathOff: delete-entity
  • actionFunction: payload.executeAction
Social Bot Command Children
The Social Bot Command node has the following childrenNodesProperties:
The Formula node property features the following properties:
  • name: formula
  • type: node
  • autoAdd: true
  • project: Foundations
Social Bot Command Attaching Rules
The following are the Node Attaching Rules that govern the attachment of Social Bot Command with other nodes:
Compatible Types: