Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop
No files matched your search
@@ -122,6 +122,7 @@ function newFoundationsFunctionLibraryTaskFunctions() {
|
||||
'Trading Bot Instance->' +
|
||||
'Learning Bot Instance->' +
|
||||
'Sensor Process Instance->Time Frames Filter->API Data Fetcher Process Instance->Indicator Process Instance->Trading Process Instance->Learning Process Instance->' +
|
||||
'Social Trading Bot Reference->Social Trading Bot->Signing Account->' +
|
||||
'Execution Started Event->' +
|
||||
'Key Reference->Exchange Account Key->' +
|
||||
'Task Manager->' +
|
||||
|
||||
@@ -18166,17 +18166,17 @@
|
||||
"id": "a8de78f0-c3e4-4a2a-b7e8-f659073969db",
|
||||
"savedPayload": {
|
||||
"position": {
|
||||
"x": 37500,
|
||||
"x": 33333.333333333336,
|
||||
"y": 18800
|
||||
},
|
||||
"targetPosition": {
|
||||
"x": 37500,
|
||||
"x": 33333.333333333336,
|
||||
"y": 18800
|
||||
},
|
||||
"floatingObject": {
|
||||
"isPinned": false,
|
||||
"isFrozen": false,
|
||||
"isCollapsed": false,
|
||||
"isCollapsed": true,
|
||||
"angleToParent": 1,
|
||||
"distanceToParent": 3,
|
||||
"arrangementStyle": 0
|
||||
|
||||
@@ -18,6 +18,16 @@
|
||||
"relatedUiObject": "Social Trading Bots Following",
|
||||
"relatedUiObjectProject": "Governance"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "availableSignals",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Available Signals",
|
||||
"relatedUiObject": "Available Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
@@ -53,6 +63,12 @@
|
||||
"type": "node",
|
||||
"childType": "Signing Account",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "availableSignals",
|
||||
"type": "node",
|
||||
"childType": "Available Signals",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -124,6 +124,8 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
'User Profile',
|
||||
UI.projects.foundations.spaces.designSpace.workspace.workspaceNode.rootNodes
|
||||
)
|
||||
|
||||
UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(node, userProfile)
|
||||
/*
|
||||
Set up a basic profile to start receiving benefits
|
||||
*/
|
||||
@@ -142,11 +144,11 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
let liquidProg = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(liquidProgs, "Liquidity Program", userProfile)
|
||||
liquidProg.payload.floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_180
|
||||
liquidProg.payload.uiObject.menu.internalClick('Add Tokens Awarded')
|
||||
|
||||
/*
|
||||
Check if the user already has the SA fork. If not, do it for them.
|
||||
*/
|
||||
|
||||
/*
|
||||
const hasFork = UI.projects.governance.spaces.userProfileSpace.githubForks.get(githubUsername)
|
||||
if (hasFork === undefined) {
|
||||
// New user! Probably doesn't have a fork, so let's create it.
|
||||
@@ -198,6 +200,7 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
We store at the User Profile the Signed githubUsername
|
||||
*/
|
||||
@@ -217,10 +220,6 @@ function newGovernanceFunctionLibraryProfileConstructor() {
|
||||
Delete the mnemonic from the Profile Constructor config.
|
||||
*/
|
||||
node.config = "{}"
|
||||
/*
|
||||
TODO: Let's create a nice basic profile to start with liquidity and community
|
||||
*/
|
||||
|
||||
/*
|
||||
Show nice message.
|
||||
*/
|
||||
|
||||
@@ -1740,5 +1740,30 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Trading-Signals",
|
||||
"propertyName": "tradingSignals",
|
||||
"UI": {
|
||||
"functionLibraries": [
|
||||
{
|
||||
"name": "Trading Signals Functions",
|
||||
"propertyName": "tradingSignalsFunctions",
|
||||
"functionName": "newSocialBotsFunctionLibraryTradingSignalsFunctions"
|
||||
}
|
||||
],
|
||||
"utilities": []
|
||||
},
|
||||
"TS": {
|
||||
"botModules": [
|
||||
{
|
||||
"name": "Trading Signals",
|
||||
"propertyName": "tradingSignals",
|
||||
"functionName": "newTradingSignalsBotModulesTradingSignals",
|
||||
"fileName": "TradingSignals.js",
|
||||
"folderName": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"type": "Available Signals",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "triggerStageSignals",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Trigger Stage Signals",
|
||||
"relatedUiObject": "Trigger Stage Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "openStageSignals",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Open Stage Signals",
|
||||
"relatedUiObject": "Open Stage Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "manageStageSignals",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Manage Stage Signals",
|
||||
"relatedUiObject": "Manage Stage Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "closeStageSignals",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Close Stage Signals",
|
||||
"relatedUiObject": "Close Stage Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Social Trading Bot->"
|
||||
},
|
||||
"propertyNameAtParent": "availableSignals",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "triggerStageSignals",
|
||||
"type": "node",
|
||||
"childType": "Trigger Stage Signals",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "openStageSignals",
|
||||
"type": "node",
|
||||
"childType": "Open Stage Signals",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "manageStageSignals",
|
||||
"type": "node",
|
||||
"childType": "Manage Stage Signals",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "closeStageSignals",
|
||||
"type": "node",
|
||||
"childType": "Close Stage Signals",
|
||||
"autoAdd": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"type": "Cancel Order Signal",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Limit Buy Order Signals->Limit Sell Order Signals->Market Buy Order Signals->Market Sell Order Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "cancelOrderSignal",
|
||||
"childrenNodesProperties": []
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"type": "Close Stage Signals",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Limit Buy Order Signals",
|
||||
"relatedUiObject": "Limit Buy Order Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Limit Sell Order Signals",
|
||||
"relatedUiObject": "Limit Sell Order Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Market Buy Order Signals",
|
||||
"relatedUiObject": "Market Buy Order Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Market Sell Order Signals",
|
||||
"relatedUiObject": "Market Sell Order Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Available Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "closeStageSignals",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "limitBuyOrderSignals",
|
||||
"type": "array",
|
||||
"childType": "Limit Buy Order Signals",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "limitSellOrderSignals",
|
||||
"type": "array",
|
||||
"childType": "Limit Sell Order Signals",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "marketBuyOrderSignals",
|
||||
"type": "array",
|
||||
"childType": "Market Buy Order Signals",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "marketBuyOrderSignals",
|
||||
"type": "array",
|
||||
"childType": "Market Buy Order Signals",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"type": "Create Order Signal",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Limit Buy Order Signals->Limit Sell Order Signals->Market Buy Order Signals->Market Sell Order Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "createOrderSignal",
|
||||
"childrenNodesProperties": []
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"type": "Limit Buy Order Signals",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "createOrderSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Create Order Signal",
|
||||
"relatedUiObject": "Create Order Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "cancelOrderSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Cancel Order Signal",
|
||||
"relatedUiObject": "Cancel Order Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Open Stage Signals->Close Stage Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "limitBuyOrderSignals",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "createOrderSignal",
|
||||
"type": "node",
|
||||
"childType": "Create Order Signal",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "cancelOrderSignal",
|
||||
"type": "node",
|
||||
"childType": "Cancel Order Signal",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"type": "Limit Sell Order Signals",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "createOrderSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Create Order Signal",
|
||||
"relatedUiObject": "Create Order Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "cancelOrderSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Cancel Order Signal",
|
||||
"relatedUiObject": "Cancel Order Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Open Stage Signals->Close Stage Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "limitSellOrderSignals",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "createOrderSignal",
|
||||
"type": "node",
|
||||
"childType": "Create Order Signal",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "cancelOrderSignal",
|
||||
"type": "node",
|
||||
"childType": "Cancel Order Signal",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"type": "Manage Stage Signals",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Available Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "manageStageSignals",
|
||||
"childrenNodesProperties": []
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"type": "Market Buy Order Signals",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "createOrderSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Create Order Signal",
|
||||
"relatedUiObject": "Create Order Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "cancelOrderSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Cancel Order Signal",
|
||||
"relatedUiObject": "Cancel Order Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Open Stage Signals->Close Stage Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "marketBuyOrderSignals",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "createOrderSignal",
|
||||
"type": "node",
|
||||
"childType": "Create Order Signal",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "cancelOrderSignal",
|
||||
"type": "node",
|
||||
"childType": "Cancel Order Signal",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"type": "Market Sell Order Signals",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "createOrderSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Create Order Signal",
|
||||
"relatedUiObject": "Create Order Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "cancelOrderSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Cancel Order Signal",
|
||||
"relatedUiObject": "Cancel Order Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Open Stage Signals->Close Stage Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "marketSellOrderSignals",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "createOrderSignal",
|
||||
"type": "node",
|
||||
"childType": "Create Order Signal",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "cancelOrderSignal",
|
||||
"type": "node",
|
||||
"childType": "Cancel Order Signal",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"type": "Open Stage Signals",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Limit Buy Order Signals",
|
||||
"relatedUiObject": "Limit Buy Order Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Limit Sell Order Signals",
|
||||
"relatedUiObject": "Limit Sell Order Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Market Buy Order Signals",
|
||||
"relatedUiObject": "Market Buy Order Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Market Sell Order Signals",
|
||||
"relatedUiObject": "Market Sell Order Signals",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Available Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "openStageSignals",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "limitBuyOrderSignals",
|
||||
"type": "array",
|
||||
"childType": "Limit Buy Order Signals",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "limitSellOrderSignals",
|
||||
"type": "array",
|
||||
"childType": "Limit Sell Order Signals",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "marketBuyOrderSignals",
|
||||
"type": "array",
|
||||
"childType": "Market Buy Order Signals",
|
||||
"autoAdd": false
|
||||
},
|
||||
{
|
||||
"name": "marketSellOrderSignals",
|
||||
"type": "array",
|
||||
"childType": "Market Sell Order Signals",
|
||||
"autoAdd": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"type": "Take Position Signal",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Trigger Stage Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "takePositionSignal",
|
||||
"childrenNodesProperties": []
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"type": "Trigger Off Signal",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Trigger Stage Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "triggerOffSignal",
|
||||
"childrenNodesProperties": []
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"type": "Trigger On Signal",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Trigger Stage Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "triggerOnSignal",
|
||||
"childrenNodesProperties": []
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"type": "Trigger Stage Signals",
|
||||
"menuItems": [
|
||||
{
|
||||
"action": "Configure",
|
||||
"actionFunction": "uiObject.configEditor.activate",
|
||||
"label": "Configure",
|
||||
"iconPathOn": "configuration",
|
||||
"iconPathOff": "configuration"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "triggerOnSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Trigger On Signal",
|
||||
"relatedUiObject": "Trigger On Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "triggerOffSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Trigger Off Signal",
|
||||
"relatedUiObject": "Trigger Off Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Add UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"disableIfPropertyIsDefined": true,
|
||||
"propertyToCheckFor": "takePositionSignal",
|
||||
"actionFunction": "payload.executeAction",
|
||||
"label": "Add Take Position Signal",
|
||||
"relatedUiObject": "Take Position Signal",
|
||||
"relatedUiObjectProject": "Trading-Signals"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
"actionProject": "Visual-Scripting",
|
||||
"askConfirmation": true,
|
||||
"confirmationLabel": "Confirm to Delete",
|
||||
"label": "Delete",
|
||||
"iconPathOn": "delete-entity",
|
||||
"iconPathOff": "delete-entity",
|
||||
"actionFunction": "payload.executeAction"
|
||||
}
|
||||
],
|
||||
"editors": {
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{}"
|
||||
},
|
||||
"addLeftIcons": true,
|
||||
"level": 2,
|
||||
"attachingRules": {
|
||||
"compatibleTypes": "->Available Signals->"
|
||||
},
|
||||
"propertyNameAtParent": "triggerStageSignals",
|
||||
"childrenNodesProperties": [
|
||||
{
|
||||
"name": "triggerOnSignal",
|
||||
"type": "node",
|
||||
"childType": "Trigger On Signal",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "triggerOffSignal",
|
||||
"type": "node",
|
||||
"childType": "Trigger Off Signal",
|
||||
"autoAdd": true
|
||||
},
|
||||
{
|
||||
"name": "takePositionSignal",
|
||||
"type": "node",
|
||||
"childType": "Take Position Signal",
|
||||
"autoAdd": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
exports.newTradingSignalsBotModulesTradingSignals = function (processIndex) {
|
||||
|
||||
let thisObject = {
|
||||
makeAnnouncements: makeAnnouncements,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let tradingSystem
|
||||
let tradingEngine
|
||||
let sessionParameters
|
||||
let taskParameters
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize() {
|
||||
tradingSystem = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingSystem
|
||||
tradingEngine = TS.projects.foundations.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SIMULATION_STATE.tradingEngine
|
||||
sessionParameters = TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.tradingParameters
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
function finalize() {
|
||||
tradingSystem = undefined
|
||||
tradingEngine = undefined
|
||||
sessionParameters = undefined
|
||||
taskParameters = undefined
|
||||
TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.messagesSent = undefined
|
||||
}
|
||||
|
||||
function makeAnnouncements(node, status='Open') {
|
||||
if (node === undefined) { return }
|
||||
if (node.announcements === undefined) { return }
|
||||
|
||||
for (let i = 0; i < node.announcements.length; i++) {
|
||||
let announcement = node.announcements[i]
|
||||
let canAnnounce = true
|
||||
|
||||
// Check configuration to see if Announcement should be run at Enter or Exit of Node
|
||||
// set defaults, protect against empty configurations or missing values
|
||||
let onEnter = true
|
||||
let onExit = false
|
||||
if (announcement.config.onEnter !== undefined) {
|
||||
onEnter = announcement.config.onEnter
|
||||
}
|
||||
if (announcement.config.onExit !== undefined) {
|
||||
onExit = announcement.config.onExit
|
||||
if (announcement.config.onEnter === undefined) {
|
||||
onEnter = false
|
||||
}
|
||||
}
|
||||
if ((status === 'Open' && onEnter) || (status === 'Closed' && onExit)) {
|
||||
canAnnounce = true
|
||||
} else {
|
||||
canAnnounce = false
|
||||
}
|
||||
|
||||
if (announcement.announcementCondition !== undefined) {
|
||||
let conditionValue
|
||||
try {
|
||||
conditionValue = eval(announcement.announcementCondition.code)
|
||||
} catch (err) {
|
||||
|
||||
const message = 'Announcement Condition Evaluation Error'
|
||||
let docs = {
|
||||
project: 'Foundations',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.education.utilities.docsFunctions.buildPlaceholder(docs, err, announcement.announcementCondition.name, announcement.announcementCondition.code, undefined, undefined, undefined)
|
||||
|
||||
tradingSystem.addError([announcement.announcementCondition.id, err.message, docs])
|
||||
}
|
||||
if (conditionValue !== true) { canAnnounce = false }
|
||||
}
|
||||
if (canAnnounce === true) {
|
||||
let text = announcement.config.text
|
||||
if (announcement.announcementFormula !== undefined) {
|
||||
let formulaValue
|
||||
let errorMessage
|
||||
|
||||
try {
|
||||
formulaValue = eval(announcement.announcementFormula.code)
|
||||
} catch (err) {
|
||||
|
||||
errorMessage = err.message
|
||||
const message = 'Announcement Formula Evaluation Error'
|
||||
let docs = {
|
||||
project: 'Foundations',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
TS.projects.education.utilities.docsFunctions.buildPlaceholder(docs, err, announcement.announcementFormula.name, announcement.announcementFormula.code, undefined, undefined, undefined)
|
||||
|
||||
tradingSystem.addError([announcement.announcementFormula.id, err.message, docs])
|
||||
}
|
||||
if (errorMessage == undefined) { text = formulaValue }
|
||||
}
|
||||
|
||||
if (TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots !== undefined) {
|
||||
TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.socialBots.announce(text)
|
||||
tradingSystem.announcements.push([announcement.id, text])
|
||||
} else {
|
||||
|
||||
const message = 'Social Bots Node Missing'
|
||||
let docs = {
|
||||
project: 'Foundations',
|
||||
category: 'Topic',
|
||||
type: 'TS LF Trading Bot Error - ' + message,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
tradingSystem.addError([TS.projects.foundations.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.id, message, docs])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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
|
||||
default: {
|
||||
console.log("[WARN] Action sent to Social-Bots Action Switch does not belong here. Verify at the App Schema file of the node that triggered this action that the actionProject is pointing to the right project. -> Action = " + action.name + " -> Action Node Name = " + action.node.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
function newSocialBotsFunctionLibraryTradingSignalsFunctions() {
|
||||
let thisObject = {
|
||||
sendTelegramTestMessage: sendTelegramTestMessage
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function sendTelegramTestMessage(node, callBackFunction) {
|
||||
|
||||
let botToken = UI.projects.visualScripting.utilities.nodeConfig.loadConfigProperty(node.payload, 'botToken')
|
||||
let chatId = UI.projects.visualScripting.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 })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||