position rate implemented
This commit is contained in:
1 parent
64bb38e728
commit
1725e388b9
11 files changed
+231
-53
No files matched your search
@@ -35,6 +35,9 @@ function newNodeChildren () {
|
||||
case 'Position Size': {
|
||||
return countChildrenPositionSize(parentNode, childNode)
|
||||
}
|
||||
case 'Position Rate': {
|
||||
return countChildrenPositionSize(parentNode, childNode)
|
||||
}
|
||||
case 'Initial Definition': {
|
||||
return countChildrenInitialDefinition(parentNode, childNode)
|
||||
}
|
||||
@@ -183,12 +186,6 @@ function newNodeChildren () {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
if (parentNode.positionSize !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.positionSize.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -248,11 +245,31 @@ function newNodeChildren () {
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenPositionRate (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
if (parentNode.formula !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.formula.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
function countChildrenInitialDefinition (parentNode, childNode) {
|
||||
let response = {
|
||||
childrenCount: 0,
|
||||
childIndex: undefined
|
||||
}
|
||||
if (parentNode.positionSize !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.positionSize.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
if (parentNode.stopLoss !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.stopLoss.id === childNode.id) {
|
||||
@@ -265,6 +282,12 @@ function newNodeChildren () {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
if (parentNode.positionRate !== undefined) {
|
||||
response.childrenCount++
|
||||
if (parentNode.positionRate.id === childNode.id) {
|
||||
response.childIndex = response.childrenCount
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user