diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index e8653f1ad..930a99e1f 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -224,6 +224,18 @@ function newStrategyPart () { compatibleType = '->' + 'Parameters' compatibleSubType = undefined break + case 'Time Range': + compatibleType = '->' + 'Parameters' + compatibleSubType = undefined + break + case 'Slippage': + compatibleType = '->' + 'Parameters' + compatibleSubType = undefined + break + case 'Fee Structure': + compatibleType = '->' + 'Parameters' + compatibleSubType = undefined + break case 'Strategy': compatibleType = '->' + 'Trading System' compatibleSubType = undefined @@ -289,7 +301,7 @@ function newStrategyPart () { compatibleSubType = undefined break case 'Formula': - compatibleType = '->' + 'Base Asset' + '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' + compatibleType = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' compatibleSubType = undefined break case 'Next Phase Event': @@ -326,6 +338,9 @@ function newStrategyPart () { if (thisObject.payload.node.type === 'Personal Data' && nearbyNode.personalData !== undefined) { continue } if (thisObject.payload.node.type === 'Parameters' && nearbyNode.parameters !== undefined) { continue } if (thisObject.payload.node.type === 'Base Asset' && nearbyNode.baseAsset !== undefined) { continue } + if (thisObject.payload.node.type === 'Time Range' && nearbyNode.timeRange !== undefined) { continue } + if (thisObject.payload.node.type === 'Slippage' && nearbyNode.slippage !== undefined) { continue } + if (thisObject.payload.node.type === 'Fee Structure' && nearbyNode.feeStructure !== undefined) { continue } if (thisObject.payload.node.type === 'Trigger Stage' && nearbyNode.triggerStage !== undefined) { continue } if (thisObject.payload.node.type === 'Open Stage' && nearbyNode.openStage !== undefined) { continue } if (thisObject.payload.node.type === 'Manage Stage' && nearbyNode.manageStage !== undefined) { continue } diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/StrategyPartConstructor.js index 0ea5e295b..43470d5ce 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/StrategyPartConstructor.js @@ -551,6 +551,11 @@ function newStrategyPartConstructor () { break } case 'Base Asset': { + strategyPart.codeEditor = newCodeEditor() + strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction + strategyPart.codeEditor.initialize() + strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { @@ -570,11 +575,12 @@ function newStrategyPartConstructor () { ) menuItemsInitialValues.push( { - action: 'Add Formula', - actionFunction: payload.onMenuItemClick, - label: 'Add Formula', + action: 'Edit Base Asset', + actionFunction: strategyPart.codeEditor.activate, + label: 'Edit Base Asset', visible: false, - relatedStrategyPart: 'Formula', + iconPathOn: 'settings', + iconPathOff: 'settings', rawRadius: 8, targetRadius: 0, currentRadius: 0, diff --git a/Globals.js b/Globals.js index 564259e92..9bae5463f 100644 --- a/Globals.js +++ b/Globals.js @@ -135,6 +135,7 @@ if (testUser !== null) { LOGGED_IN_ACCESS_TOKEN_LOCAL_STORAGE_KEY = "access_token" } +const DEFAULT_CONFIG_TEXT = '// Write your config here' const DEFAULT_FORMULA_TEXT = '// Write your formula here' const DEFAULT_CODE_TEXT = '// Write your code here' diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js index 9d57b1a87..cf8d0b6d2 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js @@ -219,12 +219,6 @@ function newNodeChildren () { childrenCount: 0, childIndex: undefined } - if (parentNode.formula !== undefined) { - response.childrenCount++ - if (parentNode.formula.id === childNode.id) { - response.childIndex = response.childrenCount - } - } return response } @@ -536,4 +530,3 @@ function newNodeChildren () { return response } } - diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index e4ded4e0b..e0410e3b2 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -291,9 +291,6 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } - if (node.formula !== undefined) { - deleteFormula(node.formula, rootNodes) - } destroyPart(node) cleanNode(node) } diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 5aa38b5ff..51e5c2864 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -244,9 +244,6 @@ function newPartsFromNodes () { } case 'Base Asset': { createPart('Base Asset', node.name, node, parentNode, chainParent, 'Base Asset') - if (node.formula !== undefined) { - createPartFromNode(node.formula, node, node) - } return } case 'Parameters': { @@ -440,12 +437,9 @@ function newPartsFromNodes () { if (node.baseAsset === undefined) { node.baseAsset = { name: 'Base Asset', - formula: { - code: DEFAULT_FORMULA_TEXT - } + code: DEFAULT_CONFIG_TEXT } createPart('Base Asset', '', node.baseAsset, node, node) - createPart('Formula', '', node.baseAsset.formula, node.baseAsset, node.baseAsset) } } diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index c3eb4d943..77596d2eb 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -248,7 +248,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData) + code: node.code } return object } diff --git a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js index 4191cacd0..b3e61406d 100644 --- a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js @@ -293,7 +293,7 @@ function newStringifyNode () { type: node.type, subType: node.subType, name: node.name, - formula: prepareForStringify(node.formula, removePersonalData), + code: node.code, savedPayload: getSavedPayload(node) } return object