Base Asset with no formula object
This commit is contained in:
1 parent
afc5e5fc2d
commit
98e34a1119
8 files changed
+30
-24
No files matched your search
@@ -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 }
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,9 +291,6 @@ function newNodeDeleter () {
|
||||
} else {
|
||||
completeDeletion(node, rootNodes)
|
||||
}
|
||||
if (node.formula !== undefined) {
|
||||
deleteFormula(node.formula, rootNodes)
|
||||
}
|
||||
destroyPart(node)
|
||||
cleanNode(node)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user